Skip to content

debug_traceTransaction

Replays a transaction and returns its complete EVM execution trace, including every opcode executed, gas consumed at each step, stack contents, and storage changes.

Debug methods replay transactions and are computationally expensive. Availability and rate limits vary by node provider — avoid calling them in hot paths.

NameTypeRequiredDescription
transactionHashstringYesThe 32-byte transaction hash to trace.
traceOptionsobjectNoOptional tracing configuration.

The traceOptions object accepts:

FieldTypeDescription
tracerstringBuilt-in tracer name. "callTracer" returns a call tree. "prestateTracer" returns the pre-execution account state. Omit to use the default struct log tracer.
tracerConfigobjectOptions for the selected tracer. For "callTracer", \{ "onlyTopCall": true \} skips internal calls.
disableStoragebooleanIf true, omits storage capture from struct logs. Reduces response size. Defaults to false.
disableMemorybooleanIf true, omits memory capture from struct logs. Reduces response size. Defaults to false.
disableStackbooleanIf true, omits stack capture from struct logs. Defaults to false.
timeoutstringExecution timeout as a Go duration string (for example, "10s", "30s"). Defaults to "5s".

result is the execution trace. The shape depends on the tracer option.

FieldTypeDescription
gasnumberTotal gas provided for the transaction.
failedbooleanWhether the transaction failed (reverted).
returnValuestringHex-encoded return value from the execution.
structLogsarrayArray of struct log entries, one per EVM opcode executed.

Each entry in structLogs contains:

FieldTypeDescription
pcnumberProgram counter position.
opstringEVM opcode name (for example, "PUSH1", "SLOAD").
gasnumberRemaining gas at this step.
gasCostnumberGas cost of this opcode.
depthnumberCall depth (1 = top-level call).
stackarrayEVM stack values at this step.
memoryarrayEVM memory contents as 32-byte chunks.
storageobjectContract storage changes at this step (slot to value).
FieldTypeDescription
typestringCall type: "CALL", "STATICCALL", "DELEGATECALL", or "CREATE".
fromstringSender address.
tostringRecipient address.
valuestringETH value sent with the call.
gasstringGas provided for the call.
gasUsedstringGas actually consumed.
inputstringCall data sent.
outputstringReturn data from the call.
errorstringError message if the call reverted. Optional.
callsarrayArray of nested call objects for internal calls.
{
"jsonrpc": "2.0",
"method": "debug_traceTransaction",
"params": [
"0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238",
{}
],
"id": 1
}
{
"jsonrpc": "2.0",
"method": "debug_traceTransaction",
"params": [
"0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238",
{ "tracer": "callTracer" }
],
"id": 1
}
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"gas": 21000,
"failed": false,
"returnValue": "",
"structLogs": [
{
"pc": 0,
"op": "PUSH1",
"gas": 21000,
"gasCost": 3,
"depth": 1,
"stack": [],
"memory": [],
"storage": {}
}
]
}
}
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"type": "CALL",
"from": "0xd3cda913deb6f4967b2ef66ae97de114a83bcc01",
"to": "0x4200000000000000000000000000000000000006",
"value": "0x2c68af0bb14000",
"gas": "0x5208",
"gasUsed": "0x5208",
"input": "0x",
"output": "0x",
"calls": []
}
}