debug_traceTransaction

The debug_traceTransaction method returns the full trace of a transaction that has already been executed and included in a block. This method provides comprehensive debugging information including all internal calls, opcode execution, gas consumption at each step, and storage modifications.

This method is essential for post-mortem analysis of transactions, identifying bugs in smart contracts, and understanding complex transaction flows involving multiple contract interactions. Developers can use it to debug failed transactions, optimize gas usage, analyze reentrancy patterns, trace internal function calls, and understand exactly how a transaction executed at the EVM level. The configurable tracer options allow focusing on specific aspects of execution while minimizing overhead.

This method is available only on the full archive node.


Parameters

parameter
type
description
transactionHash
string (required)
The hash of the transaction to trace (32-byte hex string with 0x prefix)
traceConfig
object (optional)
Configuration object to customize the trace output

Trace Config Properties:

property
type
description
tracer
string (optional)
The type of tracer: 'callTracer' for call tree, 'prestateTracer' for state diff, '4byteTracer' for method signatures, or custom JavaScript tracer code
timeout
string (optional)
Maximum time allowed for the trace operation (e.g., '10s'). Defaults to '5s'
disableStorage
boolean (optional)
Set to true to disable storage capture, significantly reducing trace size and improving performance
disableMemory
boolean (optional)
Set to true to disable memory capture in the trace
disableStack
boolean (optional)
Set to true to disable stack capture in the trace
enableMemory
boolean (optional)
Set to true to enable memory capture (opposite of disableMemory)
enableReturnData
boolean (optional)
Set to true to enable capturing return data from calls
Return Object

The method returns detailed trace information with structure depending on the tracer used:

With default tracer:

gasnumber: Total gas used by the transaction

failedboolean: Whether the transaction failed mc39

returnValuestring: The return data from the transaction execution

structLogsarray: Array of opcode execution steps, where each step contains:

pcnumber: Program counter position

opstring: Opcode name (PUSH1, ADD, SSTORE, etc.)

gas (per step)number: Remaining gas before executing this opcode

gasCostnumber: Gas cost of this opcode

depthnumber: Call depth

stackarray: The EVM stack state

memoryarray: The memory state

storageobject: Storage changes


With callTracer:

typestring: The type of the call (CALL, CREATE, DELEGATECALL, STATICCALL, etc.)

fromstring: The address initiating the call

tostring: The address receiving the call

valuestring: The value transferred in wei (hex)

gasstring: The gas provided for the call (hex)

gasUsedstring: The gas actually consumed (hex)

inputstring: The input data sent with the call

outputstring: The output data returned from the call

errorstring: Error message if the call failed

callsarray: Array of nested internal calls made during execution, each with the same structure


Request Example
Request
Response Example
Response

Share on
Share on FacebookShare on XShare on LinkedIn
Did you find this page useful?