curl --request POST \
--url https://rpc.testnet.tempo.xyz/ \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"method": "debug_traceBlockByHash",
"params": [
"0x1c3830dd03a362ba82e82017a5f4e361c12fc43b64a1e4ebd2902f0c313cad7e",
{
"tracer": "callTracer"
}
],
"id": 1
}
'{
"jsonrpc": "<string>",
"id": 123,
"result": [
{}
]
}curl --request POST \
--url https://rpc.testnet.tempo.xyz/ \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"method": "debug_traceBlockByHash",
"params": [
"0x1c3830dd03a362ba82e82017a5f4e361c12fc43b64a1e4ebd2902f0c313cad7e",
{
"tracer": "callTracer"
}
],
"id": 1
}
'{
"jsonrpc": "<string>",
"id": 123,
"result": [
{}
]
}blockHash — the hash of the block to tracetracerConfig — (optional) tracer configuration object:
tracer — tracer type (e.g., callTracer, prestateTracer)timeout — (optional) timeout for the tracetracerConfig — (optional) tracer-specific configurationresult — array of trace objects, one for each transaction in the block. The format depends on the tracer used.callTracer, each trace contains:
from — sender addressto — recipient addressgas — gas providedgasUsed — gas consumedinput — call dataoutput — return datacalls — nested array of internal callstype — call type (CALL, DELEGATECALL, etc.)debug_traceBlockByHash code examplesconst ethers = require('ethers');
const NODE_URL = "CHAINSTACK_NODE_URL";
const provider = new ethers.JsonRpcProvider(NODE_URL);
const traceBlockByHash = async (blockHash) => {
const traces = await provider.send("debug_traceBlockByHash", [
blockHash,
{ tracer: "callTracer" }
]);
console.log(`Block contains ${traces.length} transaction traces`);
for (let i = 0; i < traces.length; i++) {
const trace = traces[i].result;
console.log(`\nTx ${i}: ${trace.from} -> ${trace.to}`);
console.log(` Type: ${trace.type}, Gas Used: ${trace.gasUsed}`);
}
};
traceBlockByHash("0x1c3830dd03a362ba82e82017a5f4e361c12fc43b64a1e4ebd2902f0c313cad7e");
Was this page helpful?