BNB Smart Chain
trace_transaction
Give trace_transaction one BSC transaction hash and it returns the OpenEthereum/Nethermind-style call tree for that single historical transaction: every internal call, contract creation, and self-destruct it set off. The chain runs on BNB gas and carries most of the BEP-20 economy, so a single swap or router call can fan out into dozens of nested sub-calls. The traceAddress on each entry encodes its position in that tree, which lets you rebuild the nesting exactly. Send the request to chain ID 56 at https://bsc.therpc.io/YOUR_API_KEY. It reads far more easily than the opcode-level debug tracers when you are following money rather than instructions, but it still leans on a trace-enabled archive node to reach historical state.
Use cases
- List every internal BNB transfer inside a transaction, including the ones that never surfaced as events.
- Follow fund flow across several contracts in a layered DeFi interaction like a multi-hop swap.
- Walk the call tree to pin down which sub-call triggered a revert inside a multi-hop transaction.
- Index internal transactions to power a block explorer's internal-transfer view.
Parameters
| # | Name | Type | Required | Description |
|---|---|---|---|---|
| 1 | transactionHash | string | Yes | Hash of the transaction to retrieve traces for. |
Response
| Type | Description |
|---|---|
| array | Flat array of trace objects, each with `{action, result, subtraces, traceAddress, transactionHash, transactionPosition, blockHash, blockNumber, type}`. `traceAddress` encodes the path through the call tree. |
Example request
Try it live in the BNB Smart Chain playground.
Errors & troubleshooting
| Code | Message | Cause |
|---|---|---|
-32601 | Method not found | trace namespace not enabled; node requires --gcmode=archive and trace API enabled (Geth), or equivalent flag on Nethermind/Erigon. |
-32602 | Invalid params | Transaction hash is missing or malformed. |
-32000 | transaction not found | Transaction does not exist or archive trace data is unavailable for that block. |
Common pitfalls
- It needs a trace-enabled archive node (Geth with
--gcmode=archiveplus trace, or Erigon/Nethermind running their trace API), so most public light nodes and lower tiers will not serve it. - Its output is not
debug_traceTransactionoutput. There is no opcode-level detail here, only call, create, and self-destruct actions. - A failed transaction comes back truncated at the revert point instead of as a full execution path.
Supported networks
- Mainnet — Chain ID: 56
- Testnet — Chain ID: 97
See also
Parameters
0x-prefixed 32-byte hash