curl --request POST \
--url https://rpc.testnet.tempo.xyz/ \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"method": "trace_replayTransaction",
"params": [
"0xb3e821e696897b02283b7b2d602941b1d3cb08448d3a204bab05955215fc2035",
[
"trace"
]
],
"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_replayTransaction",
"params": [
"0xb3e821e696897b02283b7b2d602941b1d3cb08448d3a204bab05955215fc2035",
[
"trace"
]
],
"id": 1
}
'{
"jsonrpc": "<string>",
"id": 123,
"result": {}
}transactionHash — the hash of the transaction to replaytraceTypes — array of trace types to include:
trace — basic execution tracevmTrace — full VM execution tracestateDiff — state changesresult — trace result object:
output — return data from the transactiontrace — array of trace objects (if requested)vmTrace — VM execution trace (if requested)stateDiff — state differences (if requested)trace_replayTransaction code examplesconst ethers = require('ethers');
const NODE_URL = "CHAINSTACK_NODE_URL";
const provider = new ethers.JsonRpcProvider(NODE_URL);
const replayTransaction = async (txHash) => {
// Replay with all trace types
const result = await provider.send("trace_replayTransaction", [
txHash,
["trace", "stateDiff"]
]);
console.log("Transaction Output:", result.output);
console.log("Traces:", result.trace?.length || 0);
if (result.trace) {
for (const trace of result.trace) {
const callType = trace.action.callType || trace.type;
const to = trace.action.to || "Contract Creation";
console.log(` ${callType}: ${trace.action.from} -> ${to}`);
}
}
if (result.stateDiff) {
console.log("\nState changes:");
for (const [address, diff] of Object.entries(result.stateDiff)) {
console.log(` ${address}:`);
if (diff.balance) {
console.log(` Balance: ${diff.balance['*']?.from || 'new'} -> ${diff.balance['*']?.to || diff.balance['+']}`);
}
}
}
};
replayTransaction("0xb3e821e696897b02283b7b2d602941b1d3cb08448d3a204bab05955215fc2035");
Was this page helpful?