debug_traceBlockByNumber
Traces the execution of all transactions within a block specified by number.
Parameters
See Ethereum JSON-RPC spec for parameters of debug_traceBlockByNumber
.
Examples
- cURL
- Ethers.js v6
- Viem
- web3.py
curl -X POST https://api-chiliz-mainnet-archive.n.dwellir.com/YOUR_API_KEY \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "debug_traceBlockByNumber",
"params": [
"0x1000000",
{"tracer": "callTracer"}
],
"id": 1
}'
import { JsonRpcProvider } from 'ethers';
const provider = new JsonRpcProvider(
'https://api-chiliz-mainnet-archive.n.dwellir.com/YOUR_API_KEY'
);
// Trace a block by number
const blockNumber = '0x1000000';
const result = await provider.send('debug_traceBlockByNumber', [
blockNumber,
{ tracer: 'callTracer' }
]);
console.log(result);
import { createPublicClient, http, defineChain } from 'viem';
const chiliz = defineChain({
id: 88888,
name: 'Chiliz',
nativeCurrency: {
decimals: 18,
name: 'CHZ',
symbol: 'CHZ',
},
rpcUrls: {
default: {
http: ['https://api-chiliz-mainnet-archive.n.dwellir.com/YOUR_API_KEY'],
},
},
blockExplorers: {
default: { name: 'ChilizScan', url: 'https://chiliscan.com' },
},
});
const client = createPublicClient({
chain: chiliz,
transport: http('https://api-chiliz-mainnet-archive.n.dwellir.com/YOUR_API_KEY'),
});
// Trace block by number
const result = await client.request({
method: 'debug_traceBlockByNumber',
params: ['0x1000000', { tracer: 'callTracer' }],
});
from web3 import Web3
w3 = Web3(Web3.HTTPProvider(
'https://api-chiliz-mainnet-archive.n.dwellir.com/YOUR_API_KEY'
))
# Trace block by number
result = w3.manager.request_blocking('debug_traceBlockByNumber', [
'0x1000000',
{'tracer': 'callTracer'}
])
print(result)
Response
Returns an array of transaction traces for all transactions in the specified block. Common error responses:
{"code": -32700, "message": "Parse error"}
- Invalid JSON{"code": -32602, "message": "Invalid params"}
- Invalid parameters{"code": -32603, "message": "Internal error"}
- Server error