Skip to main content

Transaction trace types

When tracing transactions, the trace type options are trace, vmTrace, and stateDiff.

trace

An ordered list of calls to other contracts, excluding 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.
callTypeWhether the transaction is call or create.
fromAddress of the transaction sender.
gasGas provided by sender.
inputTransaction data.
toTarget of the transaction.
valueValue transferred in the transaction.
resultTransaction result.
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.
subTracesTraces of 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.
typeWhether the transaction is a CALL or CREATE series operation.

vmTrace

An ordered list of EVM actions when processing the transaction.

vmTrace only reports actual data returned from a RETURN opcode and does not return the contents of the reserved output space for the call operations. As a result:

  • vmTrace reports null when a call operation ends because of a STOP, HALT, REVERT, running out of instructions, or any exceptional halts.
  • When a RETURN operation returns data of a different length to the space reserved by the call, vmTrace reports only the data passed to the RETURN operation and does not include pre-existing memory data or trim the returned data.

For out of gas operations, vmTrace reports the operation that caused the out of gas exception, including the calculated gas cost. vmTrace does not report ex values because the operation is not executed.

vmTrace example
"vmTrace":{
"code":"0x7f3940be4289e4c3587d88c1856cc95352461992db0a584c281226faefe560b3016000527f14c4d2c102bdeb2354bfc3dc96a95e4512cf3a8461e0560e2272dbf884ef3905601052600851",
"ops":[
{
"cost":3,
"ex":{
"mem":null,
"push":[
"0x8"
],
"store":null,
"used":16756175
},
"pc":72,
"sub":null
},
...
]
}
KeyValue
codeCode executed by the EVM.
opsSequence of EVM operations (opcodes) executed in the transaction.
costGas cost of the opcode. Includes memory expansion costs but not gas refunds. For precompiled contract calls, reports only the actual cost.
exExecuted operations.
memMemory read or written by the operation.
pushAdjusted stack items. For swap, includes all intermediate values and the result. Otherwise, is the value pushed onto the stack.
storeAccount storage written by the operation.
usedRemaining gas taking into account the all but 1/64th rule for calls.
pcProgram counter.
subSub call operations.

stateDiff

State changes in the requested block for each transaction represented as a map of accounts to an object. Besu 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.

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.

Applicable API methods

The trace options trace, vmTrace, and stateDiff are available for the following ad-hoc tracing API methods:

Only the trace option is available for the following transaction-trace filtering API methods: