BNB Smart Chain

BNB Smart Chain

debug_traceCall

debug_traceCall runs a call against a chosen block's state and hands back a full opcode-level trace, all without submitting a transaction or burning a single unit of gas. BNB Smart Chain (BSC) charges that gas in BNB and hosts the BEP-20 contracts behind protocols like PancakeSwap and Venus, so a dry run that costs nothing is genuinely useful here. Aim it at chain ID 56 via https://bsc.therpc.io/YOUR_API_KEY. The call object and block parameter are only the start: state and block overrides let you rehearse a contract interaction under hypothetical balances or an invented block context. Any block but the latest forces a reach back into historical state, which is heavy, so plan on a debug-enabled archive node.

Use cases

  • Debug a contract interaction before you broadcast it. The trace shows its exact path and the precise opcode where it would revert.
  • Replay how a call would have behaved at a past height, which leans on archive state for the block you target.
  • Profile the gas a prospective transaction would burn without spending a single BNB wei.
  • Test proposed contract logic against live state by injecting bytecode through state overrides.

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://bsc.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 BNB Smart Chain 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 call runs against the block state you name, so results drift from real execution whenever the logic leans on block context such as coinbase or timestamp.
  • Reaching a historical block state requires an archive node. A pruned node holds only recent state.
  • Output balloons for an intricate contract. Pick a compact tracer like callTracer, or just switch off the stack and storage dumps. Heavy traces may get throttled on lower tiers.

Supported networks

  • Mainnet — Chain ID: 56
  • Testnet — Chain ID: 97

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://bsc.therpc.io/YOUR_API_KEY \
-X POST \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"debug_traceCall","params":[{"to":"0x8894E0a0c962CB723c1976a4421c95949bE2D4E3","data":"0x"},"latest",{}]}'

Ready to call this in production?

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