This method traces the execution of every transaction in a block identified by number or tag. Same output as debug_traceBlockByHash but with the convenient block-number-based lookup. The most common entry point when iterating through historical blocks for batch trace analysis.
bashcurl --location --request POST 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"method": "debug_traceBlockByNumber",
"params": [
"0x1720340",
{
"tracer": "callTracer"
}
],
"id": "getblock.io"
}'
javascriptconst axios = require('axios');
const response = await axios.post('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/', {
jsonrpc: '2.0',
method: 'debug_traceBlockByNumber',
params: [
"0x1720340",
{
"tracer": "callTracer"
}
],
id: 'getblock.io'
}, {
headers: { 'Content-Type': 'application/json' }
});
console.log(response.data.result);
pythonimport requests
response = requests.post(
'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/',
headers={'Content-Type': 'application/json'},
json={
'jsonrpc': '2.0',
'method': 'debug_traceBlockByNumber',
'params': [
"0x1720340",
{
"tracer": "callTracer"
}
],
'id': 'getblock.io'
}
)
print(response.json())
rustuse reqwest::Client;
use serde_json::{json, Value};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
let response = client
.post("https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/")
.header("Content-Type", "application/json")
.json(&json!({
"jsonrpc": "2.0",
"method": "debug_traceBlockByNumber",
"params": [
"0x1720340",
{
"tracer": "callTracer"
}
],
"id": "getblock.io"
}))
.send()
.await?
.json::<Value>()
.await?;
println!("Result: {}", response["result"]);
Ok(())
}
javascriptimport { ethers } from 'ethers';
const provider = new ethers.JsonRpcProvider('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/');
const traces = await provider.send('debug_traceBlockByNumber', [
'latest',
{ tracer: 'callTracer' }
]);
console.log('Traces:', traces.length);
javascriptimport { createPublicClient, http } from 'viem';
import { mainnet } from 'viem/chains';
const client = createPublicClient({
chain: mainnet,
transport: http('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/'),
});
const traces = await client.request({
method: 'debug_traceBlockByNumber',
params: ['latest', { tracer: 'callTracer' }],
});
console.log('Traces:', traces.length);