debug_traceBlockByNumber - Optimism
debug_traceBlockByNumber. Returns detailed traces for all transactions in a block specified by its number
debug_traceBlockByNumber - optimism [Value: 90CU]
The debug_traceBlockByNumber method traces the execution of all transactions within a specified block, identified by its block number
Use cases
- Analyze block's internal transactions for debugging purposes
- Trace smart contract interactions within a specific block
- Investigate gas usage for all transactions in block
Constraints
- Requires valid block number as input parameter
- Node must support the debug_traceBlockByNumber method
- High computational cost for tracing complex blocks
Unlock Access to 50+ chains
Boost your app's speed and reliability with dRPC - get your access API key
Language
Request
Examples
curl https://optimism.drpc.org \
-X POST \
-H "Content-Type: application/json" \
--data '{"method":"debug_traceBlockByNumber","params":["0xccde12", {"tracer": "callTracer"}],"id":1,"jsonrpc":"2.0"}'
Response
200
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"type": "CALL",
"from": "0x0000000000000000000000000000000000000000",
"to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
"value": "0x0",
"gas": "0x7fffffffffffadf7",
"gasUsed": "0x0",
"input": "0x",
"output": "0x"
}
}
Request params
idinteger
jsonrpcstring
methodstring
array
blockNumberstring
Specifies the block number for fetching the transaction.
tracerobject
Supports callTracer and prestateTracer for detailed trace analysis.
array
tracerstring
Default: callTracer
tracerConfigobject
array
onlyTopCallboolean
Response
200
Array of block traces.Response params
object
idinteger
jsonrpcstring
resultarray_of_objects
Varies for callTracer and prestateTracer.
object
callTracerobject
object
fromstring
Sender's address.
tostring
Receiver's address.
valuestring
Amount transferred in wei.
gasstring
Gas allocated for the call.
inputstring
Data sent with the call.
gasUsedstring
Gas consumed by the trace.
outputstring
Result of the call.
errorstring
Any error encountered.
revertReasonstring
Solidity revert reason, if any.
callsarray
list of sub-calls
prestateTracerobject
object
balancestring
Account balance in wei.
nonceuint64
The transaction count for the account.
codestring
Hex-encoded contract bytecode.
storagemap[string]string
Contract's storage slots.