BNB Smart Chain

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

TypeDescription
arrayArray 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

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

Try it live in the BNB Smart Chain playground.

Errors & troubleshooting

CodeMessageCause
-32601Method not founddebug 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

See also

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

Ready to call this in production?

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