curl --request POST \
--url https://rpc.testnet.tempo.xyz/ \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"method": "trace_transaction",
"params": [
"0xb3e821e696897b02283b7b2d602941b1d3cb08448d3a204bab05955215fc2035"
],
"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": "trace_transaction",
"params": [
"0xb3e821e696897b02283b7b2d602941b1d3cb08448d3a204bab05955215fc2035"
],
"id": 1
}
'{
"jsonrpc": "<string>",
"id": 123,
"result": [
{}
]
}transactionHash — the hash of the transaction to traceresult — array of trace objects for the transaction:
action — the action object:
from — sender addressto — recipient addresscallType — type of call (call, delegatecall, staticcall, etc.)gas — gas providedinput — call datavalue — value transferredblockHash — hash of the blockblockNumber — block numberresult — the result object:
gasUsed — gas consumedoutput — return datasubtraces — number of child tracestraceAddress — position in the trace treetransactionHash — hash of the transactiontransactionPosition — index of the transaction in the blocktype — trace type (call, create, suicide, reward)trace_transaction code examplesconst ethers = require('ethers');
const NODE_URL = "CHAINSTACK_NODE_URL";
const provider = new ethers.JsonRpcProvider(NODE_URL);
const traceTransaction = async (txHash) => {
const traces = await provider.send("trace_transaction", [txHash]);
console.log(`Transaction has ${traces.length} traces`);
for (const trace of traces) {
const indent = " ".repeat(trace.traceAddress.length);
const callType = trace.action.callType || trace.type;
const to = trace.action.to || "Contract Creation";
console.log(`${indent}[${trace.traceAddress.join(",")}] ${callType}`);
console.log(`${indent} From: ${trace.action.from}`);
console.log(`${indent} To: ${to}`);
console.log(`${indent} Gas Used: ${trace.result?.gasUsed || "N/A"}`);
if (trace.error) {
console.log(`${indent} Error: ${trace.error}`);
}
}
};
traceTransaction("0xb3e821e696897b02283b7b2d602941b1d3cb08448d3a204bab05955215fc2035");
Was this page helpful?