EVM - Troubleshooting debug_traceBlockByHash Timeouts
When using the debug_traceBlockByHash
method with callTracer
, you may receive execution timeout
errors.
Example request:
- Sonic Mainnet block example: 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"
}
}
Cause
The callTracer
is a resource-heavy tracer. When applied to blocks with many transactions, internal calls, or high gas usage, the node may time out before completing the trace, even with a high timeout value such as "timeout": "5m"
.
Workaround
If you're analyzing an entire block and do not need full internal call details, switch to a lighter tracer like 4byteTracer
. This tracer extracts only the function selectors (4-byte method signatures) and significantly 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...
Alternative Option
If full internal call data is required, run callTracer
on individual transactions rather than entire blocks:
{
"method": "debug_traceTransaction",
"params": ["<transaction_hash>", { "tracer": "callTracer" }]
}
Updated about 7 hours ago