trace_transaction
Returns all traces for a specific transaction on Ethereum.
Archive Node Required
This method requires an archive node. It is not available on full nodes.
Use Cases#
- Transaction analysis - See all internal calls made by a transaction
- Token transfer tracking - Trace value flows through contracts
- Debugging - Understand execution flow for DeFi protocols (60% market share), NFT marketplaces, DAOs, and enterprise dApps
Parameters#
| Parameter | Type | Required | Description |
|---|---|---|---|
txHash | DATA | Yes | 32-byte transaction hash |
Request#
{
"jsonrpc": "2.0",
"method": "trace_transaction",
"params": ["0x42690cc81dfd7f6a5ebc973fd8c4912e6068df47646c665a1b54fae904b0470a"],
"id": 1
}
Code Examples#
- cURL
- JavaScript
- Python
curl -X POST https://api-ethereum-mainnet.n.dwellir.com/YOUR_API_KEY \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "trace_transaction",
"params": ["0x42690cc81dfd7f6a5ebc973fd8c4912e6068df47646c665a1b54fae904b0470a"],
"id": 1
}'
import { JsonRpcProvider } from 'ethers';
const provider = new JsonRpcProvider('https://api-ethereum-mainnet.n.dwellir.com/YOUR_API_KEY');
const traces = await provider.send('trace_transaction', [
'0x42690cc81dfd7f6a5ebc973fd8c4912e6068df47646c665a1b54fae904b0470a'
]);
console.log('Traces:', traces.length);
for (const trace of traces) {
console.log(` ${trace.action.from} -> ${trace.action.to} (${trace.type})`);
}
from web3 import Web3
w3 = Web3(Web3.HTTPProvider('https://api-ethereum-mainnet.n.dwellir.com/YOUR_API_KEY'))
traces = w3.provider.make_request('trace_transaction', [
'0x42690cc81dfd7f6a5ebc973fd8c4912e6068df47646c665a1b54fae904b0470a'
])
for trace in traces['result']:
action = trace['action']
print(f'{action["from"]} -> {action.get("to", "CREATE")} ({trace["type"]})')
Related Methods#
trace_get- Get a specific trace by indextrace_block- Get all traces in a blocktrace_filter- Filter traces by criteria