debug_traceBlock - Ethereum
Example code for the debug_traceBlock JSON RPC method. Сomplete guide on how to use debug_traceBlock JSON RPC in GetBlock Web3 documentation.
This method traces the execution of every transaction in a block, given the block's RLP-encoded bytes. Returns per-transaction execution traces including internal calls, state changes, and opcode-level operations depending on the tracer used. The RLP-input variant is useful for tracing hypothetical blocks not present in the local chain. Requires the debug module (Dedicated Node tier).
Parameters
blockRlp
string
Yes
Hex-encoded RLP of the block to trace
tracerOptions
object
No
Trace configuration — {tracer, timeout, tracerConfig} (see below)
Tracer Options
tracer
string
No
Tracer name — callTracer, prestateTracer, 4byteTracer, opcodeTracer, or a JS/WASM tracer script
timeout
string
No
Trace timeout as a duration string (10s, 1m). Defaults to 5s
tracerConfig
object
No
Tracer-specific configuration passed to the tracer
Request
curl --location --request POST 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"method": "debug_traceBlock",
"params": [
"0xf90211a0abcd...",
{
"tracer": "callTracer"
}
],
"id": "getblock.io"
}'const axios = require('axios');
const response = await axios.post('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/', {
jsonrpc: '2.0',
method: 'debug_traceBlock',
params: [
"0xf90211a0abcd...",
{
"tracer": "callTracer"
}
],
id: 'getblock.io'
}, {
headers: { 'Content-Type': 'application/json' }
});
console.log(response.data.result);Response
Response Parameters
jsonrpc
string
JSON-RPC protocol version ("2.0")
id
string
Request identifier matching the request
result
array
Array of per-transaction traces — shape depends on the tracer used
Use Cases
Historical Block Replay: Trace hypothetical blocks (e.g. from another fork) for what-if analysis
Consensus-Client Testing: Feed hand-crafted RLP blocks into a tracer to test EVM implementations
Analytics Backfill: Trace blocks captured from a peer's gossip to reconstruct execution history
Error Handling
-32601
Method not found
debug module not enabled — Dedicated Node tier required
-32602
Invalid params
Block RLP is malformed or tracer options are invalid
-32603
Internal error
Node failed to execute the trace
Web3 Integration
Last updated
Was this helpful?