trace_callMany
Traces multiple calls in sequence on Ethereum, where each call can depend on the state changes of the previous one.
Archive Node Required
This method requires an archive node. It is not available on full nodes.
Use Cases#
- Multi-step simulation - Simulate a sequence of dependent transactions
- Arbitrage analysis - Test multi-hop swap paths
- Batch operations - Preview multiple contract interactions for DeFi protocols (60% market share), NFT marketplaces, DAOs, and enterprise dApps
Parameters#
| Parameter | Type | Required | Description |
|---|---|---|---|
calls | Array | Yes | Array of [callObject, traceTypes] pairs |
blockNumber | QUANTITY|TAG | No | Block number or tag (default: latest) |
Each element in calls is a tuple of:
callObject- Transaction call object (from,to,gas,value,data)traceTypes- Array of trace types:["trace"],["vmTrace"],["stateDiff"]
Request#
{
"jsonrpc": "2.0",
"method": "trace_callMany",
"params": [
[
[{"to": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", "data": "0x70a08231000000000000000000000000d8dA6BF26964aF9D7eEd9e03E53415D37aA96045"}, ["trace"]],
[{"to": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", "data": "0x18160ddd"}, ["trace"]]
],
"latest"
],
"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_callMany",
"params": [
[
[{"to": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", "data": "0x70a08231000000000000000000000000d8dA6BF26964aF9D7eEd9e03E53415D37aA96045"}, ["trace"]],
[{"to": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", "data": "0x18160ddd"}, ["trace"]]
],
"latest"
],
"id": 1
}'
import { JsonRpcProvider } from 'ethers';
const provider = new JsonRpcProvider('https://api-ethereum-mainnet.n.dwellir.com/YOUR_API_KEY');
const results = await provider.send('trace_callMany', [
[
[{ to: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045', data: '0x70a08231000000000000000000000000d8dA6BF26964aF9D7eEd9e03E53415D37aA96045' }, ['trace']],
[{ to: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045', data: '0x18160ddd' }, ['trace']]
],
'latest'
]);
console.log('Call results:', results.length);
for (const result of results) {
console.log(' Output:', result.output);
}
from web3 import Web3
w3 = Web3(Web3.HTTPProvider('https://api-ethereum-mainnet.n.dwellir.com/YOUR_API_KEY'))
results = w3.provider.make_request('trace_callMany', [
[
[{'to': '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045', 'data': '0x70a08231000000000000000000000000d8dA6BF26964aF9D7eEd9e03E53415D37aA96045'}, ['trace']],
[{'to': '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045', 'data': '0x18160ddd'}, ['trace']]
],
'latest'
])
for i, result in enumerate(results['result']):
print(f'Call {i}: output={result.get("output", "N/A")}')
Related Methods#
trace_call- Trace a single calleth_call- Execute call without trace