BNB Smart Chain
debug_traceBlockByNumber
Reach for debug_traceBlockByNumber when you think in heights rather than hashes. You name a block by its hex number or by a tag like latest, earliest, or pending, and the node returns an opcode-level trace of every transaction it contains. That addressing fits the common jobs: walking a contiguous range of heights, or grabbing whatever block sits at the tip right now. BNB Smart Chain (BSC) mints those blocks roughly every three seconds and charges gas in BNB, so the tip moves fast. Point the call at chain ID 56 via https://bsc.therpc.io/YOUR_API_KEY. A full-block replay is heavy work, and it needs a debug-enabled archive node to reach back past the recent window.
Use cases
- Trace every transaction at a known height in one pass to audit all of that block's state transitions together.
- Pull a whole block's call graph for MEV research with
callTracer, mapping how value moves transaction to transaction. - Line up per-transaction gas profiles across a block and flag the outliers worth a closer look.
Parameters
| # | Name | Type | Required | Description |
|---|---|---|---|---|
| 1 | blockNumber | string | Yes | Block to trace. |
| 2 | options | object | No | Same tracer configuration object as debug_traceTransaction. |
Response
| Type | Description |
|---|---|
| array | Array of per-transaction trace results in block order. Each element has the same shape as debug_traceTransaction output for the active tracer. |
Example request
Try it live in the BNB Smart Chain playground.
Errors & troubleshooting
| Code | Message | Cause |
|---|---|---|
-32601 | Method not found | debug namespace not enabled on the node. |
-32602 | Invalid params | Block number is malformed or not a recognized tag. |
-32000 | block not found | Block does not exist or archive state is unavailable for that number. |
Common pitfalls
- A full-block replay re-runs every transaction inside, so a busy BSC block can take minutes and spill gigabytes of structLog data.
- Historical heights need an archive node. A non-archive node keeps only the recent window and rejects older blocks outright.
- The
latesttag works but races the three-second cadence, so the height you trace can advance between request and response, and lower tiers may rate-limit the call.
Supported networks
- Mainnet — Chain ID: 56
- Testnet — Chain ID: 97
See also
Parameters
hex block number or "latest" | "earliest" | "pending"
Same tracer configuration object as debug_traceTransaction.