debug_traceTransaction

Attempts to run the transaction in the exact same manner as it was executed on the network. It will replay any transaction that may have been executed prior to this one before it and will then attempt

Parameters

  1. Transaction parameters with the following field:

    • transactionHash - string - This describes the transaction hash of the transaction that needs to be traced.

  2. Object - Options for call

  • tracer - string to specify the type of tracer. Currently supports callTracer and prestateTracer (see below for definitions).

  • timeout - string - A duration string of decimal numbers that overrides the default timeout of 5 seconds for JavaScript-based tracing calls. Max timeout is "10s". Valid time units are "ns", "us", "ms", "s" each with optional fraction, such as "300ms" or "2s45ms".

Returns

  • Object - trace object

callTracer

The callTracer tracks all the call frames executed during a transaction, including depth 0. The result will be a nested list of call frames, resembling how EVM works. They form a tree with the top-level call at root and sub-calls as children of the higher levels. Each call frame has the following fields:

field
type
description

type

string

CALL or CREATE

from

string

address

to

string

address

value

string

hex-encoded amount of value transfer

gas

string

hex-encoded gas provided for call

gasUsed

string

hex-encoded gas used during call

input

string

call data

output

string

return data

error

string

error, if any

revertReason

string

Solidity revert reason, if any

calls

[]callframe

list of sub-calls

Request

cURL


Response

cURL

Things to note about the call tracer:

  • Calls to precompiles are also included in the result

  • In case a frame reverts, the field output will contain the raw return data

  • In case the top level frame reverts, its revertReason field will contain the parsed reason of revert as returned by the Solidity contract

  • Setting the tracerConfig of onlyTopCall to true will only trace the main (top-level) call and none of the sub-calls

Example

Request

Result

prestateTracer

Executing a transaction requires the prior state, including account of sender and recipient, contracts that are called during execution, etc. The prestateTracer replays the tx and tracks every part of state that is touched during that transaction. This is similar to the concept of a stateless witness, the difference being this tracer doesn’t return any cryptographic proof, rather only the trie leaves. The result is an object. The keys are addresses of accounts. The value is an object with the following fields:

field
type
description

balance

string

balance in wei

nonce

uint64

nonce

code

string

hex-encoded bytecode

storage

map[string]string

storage slots of the contract

Request

cURL


Response

cURL

Example

Request

Result

Last updated