Ethereum
trace_replayBlockTransactions
The trace_replayBlockTransactions method replays all transactions in a specified block and returns detailed trace information for each transaction. This provides insights into the execution flow of transactions, allowing for detailed analysis and debugging.
Use Cases
- Analyzing transaction execution flows in specific blocks
- Debugging complex smart contract interactions
- Understanding state changes from transaction execution
- Auditing and verifying transaction results
- Gas optimization research
- Investigating failed transactions
- Research and analysis of historical blocks
- Testing contract behavior under specific block conditions
- Identifying patterns across multiple transactions in a block
- Verifying consensus rules at the transaction level
Method Details
This method replays all transactions in a block with detailed trace information.
Response Example
Trace Types
The traceTypes parameter accepts an array of the following values:
- trace: The basic trace of transaction execution
- vmTrace: A detailed trace of the EVM execution
- stateDiff: State changes resulting from the transaction
You can request any combination of these trace types.
State Diff Format
The state diff format uses the following symbols:
- "=": No change in the value
- "+": The value was created
- "-": The value was deleted
- "*": The value was modified, with "from" and "to" values
VM Trace Format
The VM trace contains:
- code: The EVM bytecode being executed
- ops: Array of operations with:
- cost: Gas cost of the operation
- ex: Execution result (memory, stack, storage)
- pc: Program counter
- sub: Information for subcalls
Trace Format
The trace format shows the execution path:
- action: Details about the call
- result: Result of the call
- subtraces: Number of child calls
- traceAddress: Position in the call tree
- type: Type of operation (call, create, suicide)
Important Notes
- This method is computationally intensive and may take time to complete
- Requires trace APIs to be enabled on the Ethereum node
- Not all Ethereum clients support this method
- The response size can be very large for blocks with many transactions
- Consider limiting the trace types for better performance
- Empty blocks will return an empty array
- Historical blocks can only be traced if the node maintains archive data
- For blocks with complex transactions, the response might be extremely large
- Each trace type adds significantly to the response size
- Different clients may implement slight variations of the trace formats
Block Tags
The blockNumber parameter accepts:
- Hex-encoded block number (
0x1b4) latest: The most recent mined blockearliest: The genesis blockpending: Currently pending block (transactions waiting to be mined)
See also
- trace_block - Get basic traces for all transactions in a block
- trace_call - Execute and trace a call without creating a transaction
- debug_traceTransaction - Get detailed execution trace for a single transaction
Parameters
Block number in hex format or block tag (latest, earliest, pending)
Array of trace types to include in the response (JSON)