EVM debug_trace and trace_block: Timeouts and Performance
Tracing whole blocks with trace_block or debug_traceBlockBy* can hit the Gateway's 120-second limit; use a lighter tracer or trace single transactions.
Tracing full blocks is computationally expensive. When using trace_block, debug_traceBlockByNumber, or debug_traceBlockByHash, you may encounter:
execution timeout
AttentionTatum Gateway enforces a hard 120 second request ceiling, regardless of any custom timeout you provide in the request payload.
Example request:
- Block on Sonic Mainnet: https://sonicscan.org/block/37616150
curl --location 'https://sonic-mainnet.gateway.tatum.io/' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {YOUR_API_KEY}' \
--data '{
"jsonrpc": "2.0",
"method": "debug_traceBlockByHash",
"params": [
"0xdf4b451b14728cec5b1f52a2b73dc45229f5afbc266a8c7abb0c219f755bfd3e",
{
"tracer": "callTracer",
"timeout": "5m"
}
],
"id": 1
}'
//Response
{
"id": 1,
"jsonrpc": "2.0",
"error": {
"code": -32000,
"message": "execution timeout"
}
}Why This Happens
Tracing methods such as trace_block , debug_traceBlockByNumber, and debug_traceBlockByHash are resource-intensive. When blocks are large, contain many internal calls, or originate from high-throughput networks (Polygon, BSC, Sonic), the node must process significant computation.
Adding callTracer increases the load even further. Even long custom timeouts like "5m" cannot override the Gateway’s 120-second cap. Very large traces can also fail with Response is too big (-32008).
trace_block vs. debug_traceBlockBy*
trace_block vs. debug_traceBlockBy*Key differences:
trace_block
- Always produces a full trace of the block with all transactions.
- Does not accept tracer options like
callTraceror4byteTracer. - Must replay every transaction in detail → inherently heavy.
- Can time out on high-throughput chains (Polygon, BSC, Sonic) even without a custom tracer.
debug_traceBlockByNumber / debug_traceBlockByHash
- More flexible: supports different tracers (
callTracer,4byteTracer, etc.) and timeout configuration. - Timeouts usually happen only when using heavy tracers like
callTracer. - Using the lighter
4byteTraceroften avoids timeouts.
Workarounds
1. Use a Lighter Tracer (Recommended)
If you don’t require full internal call details, switch to a more efficient tracer such as 4byteTracer. This extracts only function selectors (4-byte method signatures) and drastically reduces processing time.
Example using 4byteTracer:
curl --location 'https://sonic-mainnet.gateway.tatum.io/' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {YOUR_API_KEY}' \
--data '{
"jsonrpc": "2.0",
"method": "debug_traceBlockByHash",
"params": [
"0xdf4b451b14728cec5b1f52a2b73dc45229f5afbc266a8c7abb0c219f755bfd3e",
{
"tracer": "4byteTracer",
"timeout": "5m"
}
],
"id": 1
}'
//Response:
{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"txHash": "0xda8b7db420780ac9e606937517f09bf6ed3e679a98a28de3ae0387b5711064ec",
"result": {
"0x00000000-221": 1,
"0x07a2d13a-32": 21,
"0x07a2d13a-96": 13,
"0x09...2. Trace Individual Transactions
If you need internal call data, run the trace on single transactions rather than entire blocks.
Example usingdebug_traceTransaction:
curl --location 'https://ethereum-mainnet.gateway.tatum.io' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {YOUR_API_KEY}' \
--data '{
"jsonrpc":"2.0",
"method":"debug_traceTransaction",
"params":["0xa1b562b91c6b2ba6a4fb099e1c85000dff85d7cbe7d5aaa883c9eb9a49e258c7",
{
"tracer":"callTracer",
"timeout": "90s"
}
],
"id":1
}'Debug and tracer error: reexec=128
reexec=128Debug and tracer calls are highly resource-consuming, so they can take extra time to return a response. Because of this, you may get errors like reexec=128 on your RPC calls.
To troubleshoot, add the optional timeout parameter to your debug and tracer requests. The value is a Go duration string such as 10s or 1m (see time.ParseDuration). The Gateway's 120-second ceiling still applies, whatever timeout you set.
Example for Optimism:
curl --location 'https://optimism-mainnet.gateway.tatum.io' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {YOUR_API_KEY}' \
--data '{
"jsonrpc": "2.0",
"method": "debug_traceBlockByNumber",
"params": [
"0x666c7f4",
{
"tracer": "callTracer",
"timeout":"1m"
}
],
"id": 2
}'Optimism debug_trace and node performance issues
debug_trace and node performance issuesThe Optimism chain behaves like a non-deterministic chain. As a result, debug_trace* methods perform notably poorly on Optimism, especially for pre-Bedrock blocks. For those blocks, debug_traceBlockByHash also returns a zero txHash on Optimism.
Observed response times for debug_traceBlockByNumber in batch requests:
| Queries | Result |
|---|---|
| 1 (no batch) | 1 second |
| 2 | 12.5 seconds |
| 3 | 22 seconds |
| 4 | 28 seconds and a timeout |
Good to know:
- Older blocks respond more slowly than the latest blocks (if you follow the tip).
- Large batches perform worse than running a single call multiple times.
- When fetching old data, you usually can't get more than 5 requests per second (RPS) with
debug_traceBlockByNumber.
For more about Optimism and debug_traceBlockByNumber, see the Optimism issues on GitHub.
Updated 1 day ago