BNB Smart Chain
debug_getBadBlocks
Every block a BNB Smart Chain (BSC) node rejects as invalid lands in a short list, and debug_getBadBlocks reads that list back. Each entry carries the block's hash, its decoded header, and the raw RLP a peer actually sent, so an operator can see precisely what malformed candidate hit the node and why it bounced. BSC runs Proof-of-Staked-Authority consensus, sealing a block about every three seconds with BNB covering the gas, which means a bad block usually points at a misbehaving validator rather than ordinary load. Query it on chain ID 56 at https://bsc.therpc.io/YOUR_API_KEY. It is a debug-namespace call, so the node has to be started with debug access for it to answer.
Use cases
- Catch PoSA consensus violations or malformed blocks that a misbehaving validator or peer tried to push onto your node.
- Investigate a fork on BSC by lining up the rejected alternative block against the canonical one.
- Audit client validation logic by checking the rejected RLP against the protocol rules it failed to satisfy.
Parameters
This method takes no parameters. Pass an empty array [].
Response
| Type | Description |
|---|---|
| array | Array of objects, each with `{hash, block, rlp}` — `block` contains the decoded header fields and `rlp` is the raw RLP-encoded block. Returns an empty array if no bad blocks have been seen. |
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, or client does not implement this method. |
Common pitfalls
- The history lives in memory only and is wiped the instant the node restarts, so it is no substitute for a durable audit log.
- A healthy BSC node rarely sees a bad block, so an empty array is the normal answer rather than a sign anything is wrong.
- Not every EVM-compatible client implements the method, and lower service tiers may not expose the debug namespace at all.
Supported networks
- Mainnet — Chain ID: 56
- Testnet — Chain ID: 97