BNB Smart Chain

BNB Smart Chain

trace_replayTransaction

For forensic work on a single BSC transaction, trace_replayTransaction is the sharpest tool in the namespace. It re-runs one historical transaction against the block state it executed in and returns whatever you ask for through traceTypes: the trace call tree, the vmTrace opcode stream, the stateDiff, or any mix of the three. Direct it to chain ID 56 at https://bsc.therpc.io/YOUR_API_KEY. The stateDiff is where forensics happens. It tags every touched account with =, +, -, or *{from,to}, so you can read off exactly how each balance, nonce, code blob, and storage slot moved. That replay against original state is what makes it heavy, and what ties it to a trace-enabled archive node that still keeps the history.

Use cases

  • Reconstruct the exact storage mutations a historical transaction caused, slot by slot, for a forensic write-up.
  • Read the stateDiff to find which storage slot or balance check tripped a revert.
  • Build a complete audit trail of balance and storage changes for compliance or reconciliation.

Parameters

#NameTypeRequiredDescription
1transactionHashstringYesHash of the transaction to replay.
2traceTypesarrayYesOne or more of `"trace"`, `"vmTrace"`, `"stateDiff"`. At least one value is required.

Response

TypeDescription
object`{output, trace?, stateDiff?, vmTrace?}` — `trace` is the call tree, `stateDiff` maps each affected address to balance/nonce/code/storage diffs using `=` (unchanged), `+` (created), `-` (deleted), `*{from,to}` (modified), `vmTrace` is the Parity-format opcode trace.

Example request

curl https://bsc.therpc.io/YOUR_API_KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "trace_replayTransaction",
"params": [
"0x0000000000000000000000000000000000000000000000000000000000000000",
[
"trace"
]
],
"id": 1
}'

Try it live in the BNB Smart Chain playground.

Errors & troubleshooting

CodeMessageCause
-32601Method not foundtrace namespace not enabled or not supported by this client (primarily OpenEthereum/Nethermind/Erigon).
-32602Invalid paramsTransaction hash is missing/malformed or traceTypes is empty or contains unknown values.
-32000transaction not foundTransaction does not exist or archive trace data is unavailable for that block.

Common pitfalls

  • Asking for vmTrace on a complex transaction produces enormous output, so reach for trace or stateDiff when you do not need opcode detail.
  • A trace-enabled archive node is required, and lower tiers may rate-limit the method or not expose it at all.
  • The vmTrace shape is Parity-specific. Do not confuse it with the structLog format that Geth's debug_traceTransaction returns.

Supported networks

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

See also

Parameters

0x-prefixed 32-byte hash

["trace"] | ["trace","vmTrace","stateDiff"]

curl https://bsc.therpc.io/YOUR_API_KEY \
-X POST \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"trace_replayTransaction","params":["0x0000000000000000000000000000000000000000000000000000000000000000",[]]}'

Ready to call this in production?

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