debug_getBadBlocks - Blast
Example code for the debug_getBadBlocks JSON-RPC method. Complete guide on how to use debug_getBadBlocks JSON-RPC in GetBlock Web3 documentation.
This method returns blocks the client recently rejected as invalid, with the reason. It is a Dedicated Node tier diagnostic used to investigate consensus or propagation issues.
This method belongs to the debug namespace and is available on GetBlock Dedicated Nodes only. It is not served on shared endpoints.
Parameters
Request
curl --location --request POST 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"method": "debug_getBadBlocks",
"params": [],
"id": "getblock.io"
}'const axios = require('axios');
const response = await axios.post('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/', {
jsonrpc: '2.0',
method: 'debug_getBadBlocks',
params: [],
id: 'getblock.io'
}, {
headers: { 'Content-Type': 'application/json' }
});
console.log(response.data.result);import requests
response = requests.post(
'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/',
headers={'Content-Type': 'application/json'},
json={
'jsonrpc': '2.0',
'method': 'debug_getBadBlocks',
'params': [],
'id': 'getblock.io'
}
)
print(response.json())Response
{
"jsonrpc": "2.0",
"id": "getblock.io",
"result": []
}Response Parameters
jsonrpc
string
JSON-RPC protocol version ("2.0")
id
string
Request identifier matching the request
result
array
Array of rejected block records (empty if none)
Use Cases
Consensus Debugging: Inspect blocks the node rejected and why
Incident Analysis: Correlate bad blocks with a network event
Client Diagnostics: Detect propagation of malformed blocks
Monitoring: Alert when bad blocks appear on an endpoint
Error Handling
-32603
Internal error
The node failed to return bad block records
-32601
Method not found
The debug namespace is not enabled on this endpoint
Web3 Integration
Last updated
Was this helpful?