Skip to main content

Ethereum trace methods

info

Trace API is an open beta feature, available to paying Infura customers.

Infura provides access to trace API methods that provide insights into the execution of smart contracts and transactions.

MethodDiagnostic options
trace_blocktrace
trace_calltrace, stateDiff
trace_callManytrace, stateDiff
trace_transactiontrace
trace_filtertrace
caution

Trace responses are handled generically to enable support of additional fields beyond those documented here. This requires graceful handling.

trace

Provides an ordered trace of the instructions executed by the Ethereum Virtual Machine (EVM) during the execution of a smart contract transaction. Excludes precompiled contracts.

Trace example
"trace":[
{
"action":{
"callType":"call",
"from":"0xfe3b557e8fb62b89f4916b721be55ceb828dbd73",
"gas":"0xffadea",
"input":"0x",
"to":"0x0100000000000000000000000000000000000000",
"value":"0x0"
},
"result":{
"gasUsed":"0x1e",
"output":"0x"
},
"subtraces":0,
"traceAddress":[
],
"type":"call"
}
]
KeyValue
actionTransaction details.
  - creationMethodOpcode used during contract creation: create or create2. Returned for create operations.
  - callTypeWhether the transaction is call, staticcall, delegatecall. Returned for call operations.
  - fromAddress of the transaction sender.
  - gasGas provided by sender.
  - inputTransaction data. Returned for call operations.
  - initContract initialization code. Returned for create operations.
  - toTarget of the transaction. Returned for call operations.
  - valueValue transferred in the transaction.
blockHashHash of the block containing this trace.
blockNumberBlock number containing this trace.
resultTransaction result.
  - addressAddress of the newly created contract. Returned for create operations.
  - codeBytecode of the newly created contract. Returned for create operations.
  - gasUsedGas used by the transaction. Includes any refunds of unused gas.
  - outputReturn value of the contract call. Contains only the actual value sent by a RETURN operation. If a RETURN was not executed, the output is empty bytes. Returned for call operations.
subtracesNumber of sub-traces (nested contract calls) made by the transaction.
traceAddressTree list address of where the call occurred, address of the parents, and order of the current sub call.
transactionHashHash of the transaction.
transactionPositionTransaction position within the block.
typeWhether the transaction is a call or create operation.

stateDiff

Displays state changes in the requested block for each transaction, represented as a map of accounts to an object. Lists the balance, code, nonce, and storage changes from immediately before the transaction to after the transaction. For the key:value pairs:

  • + indicates the field didn’t exist before and now has the specified value
  • - indicates a deleted value
  • * has a from and a to value

An absent value is distinct from zero when creating accounts or clearing storage. For example, when clearing storage, an absent value means that a particular storage slot has not yet been assigned a value, while a zero value means that the storage slot has been assigned and set to zero.

stateDiff example
"stateDiff":{
"0xfe3b557e8fb62b89f4916b721be55ceb828dbd73":{
"balance":{
"*":{
"from":"0xffffffffffffffffffffffffffffffffc3e12a20b",
"to":"0xffffffffffffffffffffffffffffffffc3dc5f091"
}
},
"code":"=",
"nonce":{
"*":{
"from":"0x14",
"to":"0x15"
}
},
"storage":{
}
}
}
KeyValue
balanceChange of balance event.
balance.fromBalance before the transaction.
balance.toBalance after the transaction.
codeChanges to code. None in this example.
nonceChange of nonce.
nonce.fromNonce before the transaction.
nonce.toNonce after the transaction.
storageChanges to storage. None in this example.
On this page