Ethereum

Ethereum

debug_traceCall

debug_traceCall runs a message call against a chosen Ethereum mainnet block state (chain ID 1, native coin ETH) and returns a full opcode-level trace — all without broadcasting anything or paying gas. Think of it as eth_call with the EVM's instrumentation switched on: same call object, same from/to/value/data fields, but you see every step the virtual machine takes. Nothing is mined, no ETH moves, and the call never touches the mempool. You can also pin it to any historical block and layer in state or block overrides to explore what-if scenarios. Send requests to https://ethereum.therpc.io/YOUR_API_KEY. Simulating against past block states needs a debug-enabled archive node.

Use cases

  • Debug a contract interaction before you sign it: trace the exact execution path and pull out the revert reason, so you never burn ETH on a transaction that was always going to fail.
  • Replay a call as it would have behaved at a past block height — for instance, checking what an Aave borrow would have returned before a parameter change. Historical blocks require an archive node.
  • Profile the gas a prospective transaction would consume without spending a wei, then size your maxFeePerGas against the current EIP-1559 base fee accordingly.
  • Test proposed contract logic against live mainnet state by injecting new bytecode through stateOverrides, validating a fix before deploying it for real.

Parameters

#NameTypeRequiredDescription
1transactionobjectYesCall object — same fields as eth_call: `from?`, `to`, `gas?`, `gasPrice?`, `maxFeePerGas?`, `maxPriorityFeePerGas?`, `value?`, `data?`.
2blockParameterstringNoBlock number or tag defining the state against which the call is simulated.Default: latest
3optionsobjectNoSame tracer configuration object as debug_traceTransaction (tracer, tracerConfig, timeout, reexec, enableMemory, enableReturnData, disableStack, disableStorage, limit, debug).
4stateOverridesobjectNoOptional map of address → { balance, nonce, code, state, stateDiff } overrides applied only for this call.
5blockOverridesobjectNoOptional map of block-context fields to override (e.g. `number`, `time`, `gasLimit`, `coinbase`, `random`, `baseFee`) for the simulated call.

Response

TypeDescription
objectSame shape as debug_traceTransaction: structLog array with default tracer, or tracer-specific object (callTracer, prestateTracer, etc.).

Example request

curl https://ethereum.therpc.io/YOUR_API_KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "debug_traceCall",
"params": [
{
"to": "0x0000000000000000000000000000000000000000",
"data": "0x"
},
"latest",
{},
{},
{}
],
"id": 1
}'

Try it live in the Ethereum playground.

Errors & troubleshooting

CodeMessageCause
-32601Method not founddebug namespace not enabled on the node.
-32602Invalid paramsTransaction object is missing required fields or blockParameter is unrecognized.
-32000execution revertedSimulated call reverted; trace is still returned up to the revert point.

Common pitfalls

  • The trace reflects the block state you point at. If the call reads block context — block.timestamp, block.coinbase, the base fee — a simulation at latest can diverge from how the call lands once it's actually mined a few slots later.
  • Past block states require archive data. Trace at a recent height on a pruned node, or against a finalized historical block on an archive node; otherwise the state simply isn't there.
  • Output balloons for complex contracts. The default struct logger emits every opcode, stack, and storage touch — switch to callTracer or set disableStack/disableStorage/disableMemory to keep the response manageable.

Supported networks

  • Mainnet — Chain ID: 1
  • Sepolia — Chain ID: 11155111

See also

Parameters

Call object — same fields as eth_call: `from?`, `to`, `gas?`, `gasPrice?`, `maxFeePerGas?`, `maxPriorityFeePerGas?`, `value?`, `data?`.

hex block number or "latest" | "earliest" | "pending"

Same tracer configuration object as debug_traceTransaction (tracer, tracerConfig, timeout, reexec, enableMemory, enableReturnData, disableStack, disableStorage, limit, debug).

Optional map of address → { balance, nonce, code, state, stateDiff } overrides applied only for this call.

Optional map of block-context fields to override (e.g. `number`, `time`, `gasLimit`, `coinbase`, `random`, `baseFee`) for the simulated call.

curl https://ethereum.therpc.io/YOUR_API_KEY \
-X POST \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"debug_traceCall","params":[{"to":"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045","data":"0x"},"latest",{}]}'

Ready to call this in production?

Free tier covers personal projects. Pay-as-you-go scales without a card.