Ethereum
debug_getBadBlocks
debug_getBadBlocks reports the blocks a geth-style Ethereum node tried to import but rejected as invalid. On Ethereum mainnet (chain ID 1, native coin ETH), every proposed block must pass execution-layer validation before it joins the canonical chain; anything that fails — a bad state root, an unexecutable transaction, a header that breaks the rules — gets discarded and recorded here. Call it over the TheRPC endpoint at https://ethereum.therpc.io/YOUR_API_KEY. The response is the running list of those rejected blocks observed since the node last started, each carrying its hash, decoded header, and raw RLP bytes for inspection.
Use cases
- Spot consensus violations or malformed blocks that misbehaving peers gossiped onto the network, before they ever reach your application logic.
- Investigate a fork at the head: when a short reorg happens around a 12-second slot, the rejected alternative block shows up here with its full RLP, so you can compare it against the one that won.
- Audit a client's validation path by checking that the blocks it rejected actually violate protocol rules — useful when running geth, erigon, or nethermind side by side.
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 Ethereum 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 list lives in memory only. Restart the node and it resets to empty, so this is not a durable audit log.
- On a healthy mainnet node you will almost always get back an empty array. Bad blocks are the exception, not the routine — seeing none is the normal state.
- Not every execution client exposes this method. It is a geth convention; some clients in the Ethereum landscape return
-32601instead of implementing it.
Supported networks
- Mainnet — Chain ID: 1
- Sepolia — Chain ID: 11155111