curl --request POST \
--url https://nd-954-882-037.p2pify.com/66f812de2a6724a75a51f60dd6f2a154 \
--header 'Content-Type: application/json' \
--data '
{
"id": 1,
"jsonrpc": "2.0",
"method": "debug_intermediateRoots",
"params": [
"0x5765eab677d93b81a1c29de804e115d0e4db8dd40e0deabcf187e4e0d047c758",
{}
]
}
'{
"jsonrpc": "<string>",
"id": 123,
"result": [
"<string>"
]
}curl --request POST \
--url https://nd-954-882-037.p2pify.com/66f812de2a6724a75a51f60dd6f2a154 \
--header 'Content-Type: application/json' \
--data '
{
"id": 1,
"jsonrpc": "2.0",
"method": "debug_intermediateRoots",
"params": [
"0x5765eab677d93b81a1c29de804e115d0e4db8dd40e0deabcf187e4e0d047c758",
{}
]
}
'{
"jsonrpc": "<string>",
"id": 123,
"result": [
"<string>"
]
}arbtrace_* methods instead.hash — the hash of the block to compute intermediate roots for.object — (optional) tracing configuration:
timeout — the timeout for the computation. Defaults to 5s. See Go time format for accepted values.reexec — the number of blocks to re-execute to reconstruct historical state. Defaults to 128.result — an array of state root hashes (as hex strings), one per transaction in the block. Each root represents the state after the corresponding transaction was executed.debug_intermediateRoots code examplesconst ethers = require('ethers');
const NODE_URL = "YOUR_CHAINSTACK_ENDPOINT";
const provider = new ethers.JsonRpcProvider(NODE_URL);
const debugIntermediateRoots = async (blockHash) => {
const result = await provider.send("debug_intermediateRoots", [blockHash, {}]);
console.log(result);
};
debugIntermediateRoots("0x5765eab677d93b81a1c29de804e115d0e4db8dd40e0deabcf187e4e0d047c758");
debug_intermediateRoots method is useful for verifying state transitions within a block. By computing the intermediate state root after each transaction, developers can identify exactly which transaction caused a state change and verify the correctness of state transitions. This is particularly valuable for building state verification tools and debugging state-related issues in smart contracts.Was this page helpful?