The trace_block
method returns execution traces for all transactions included in a specified block. This provides comprehensive insight into all contract interactions that occurred within a single block.
This method returns an array of traces for all transactions in the specified block.
Block number (hex block number or "latest", "earliest", "pending")
Array of trace objects for all transactions in the block
Information about the action taken
Call type (e.g., "call", "delegatecall", "staticcall")
Sender address
Gas provided for this action
Input data
Recipient address
Value sent (in wei)
Contract initialization code (for create traces)
Hash of the block
Block number
Result of the call
Amount of gas used
Output data
Created contract address (for create traces)
Contract code (for create traces)
Number of subtraces
Address path within the execution trace
Hash of the transaction
Index position of the transaction in the block
Trace type (e.g., "call", "create", "suicide")
Error message (if transaction failed)
The response contains traces for all transactions in the block, with each transaction potentially containing multiple traces. The traces form a hierarchical structure:
traceAddress: []
) represent the initial transactiontraceAddress
array indicating its position in the call treesubtraces
field shows the number of direct children a trace hasHere's a simplified visual representation of how traces are structured:
Transaction 1
├── Call to Contract A [traceAddress: []]
│ ├── Call from A to B [traceAddress: [0]]
│ └── Call from A to C [traceAddress: [1]]
│ └── Call from C to D [traceAddress: [1, 0]]
└── Call to Contract E [traceAddress: []]
Transaction 2
└── ... (similar structure)
The method returns different types of traces indicated by the type
field:
For traces with type: "call"
, the callType
field indicates the type of call:
If a transaction or subtrace failed:
error
field will contain the reason (e.g., "out of gas", "reverted")result
field may be null or incomplete{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"action": {
"callType": "call",
"from": "0x8bb73bcb5d553b5a556358d27625323fd781d37",
"gas": "0x576e",
"input": "0x370158ea000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"to": "0x6090a6e47849629b7245dfa1ca21d94cd15878ef",
"value": "0x0"
},
"blockHash": "0x8512d367492371edf44ebcbbbd935bc434946dddc2b126cb558df5906012186c",
"blockNumber": 1059416,
"result": {
"gasUsed": "0x14a0",
"output": "0x0000000000000000000000000000000000000000000000000000000000000001"
},
"subtraces": 0,
"traceAddress": [],
"transactionHash": "0x4c253746e8d0ab1d135df9711532c41a85ab33f069f1c733ceb0a6bf3e304503",
"transactionPosition": 0,
"type": "call"
},
{
"action": {
"callType": "call",
"from": "0x431957dbd818eaab7c5ed352430d1bf44dccd837",
"gas": "0x3d090",
"input": "0x4c37a69b00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001",
"to": "0x6090a6e47849629b7245dfa1ca21d94cd15878ef",
"value": "0x0"
},
"blockHash": "0x8512d367492371edf44ebcbbbd935bc434946dddc2b126cb558df5906012186c",
"blockNumber": 1059416,
"result": {
"gasUsed": "0x2b43",
"output": "0x0000000000000000000000000000000000000000000000000000000000000001"
},
"subtraces": 0,
"traceAddress": [],
"transactionHash": "0x1eb099b3e9396b9d188b1c313261f6a13c7e13cb5c1afd3884847cc2c61289c0",
"transactionPosition": 1,
"type": "call"
}
]
}
trace_transaction
for specific transactions if you don't need the entire block--gcmode=archive
and OpenEthereum/Nethermind)