🔵 Base
trace_callMany

🔍 trace_callMany RPC Method - Base Chain

Executes multiple calls like eth_call but returns traces for each call. In trace_callMany you can specify multiple trace_call objects and execute them on the same block of the Base blockchain.

Returns

  • array - The list of trace objects
    • output - The output (return value) of the call
    • stateDiff - The state changes that would happen due to the transaction in the given eth_call
    • trace - The trace of the call
      • action - The action to be performed
        • from - The address of the sender
        • callType - The type of method such as call, delegatecall
        • gas - The gas provided by the sender
        • input - The input data of the call or delegatecall
        • to - The address of the receiver
        • value - The amount of ETH sent with this transaction
      • result - The result of the transaction
        • gasUsed - Gas used by the transaction
        • output - The return value of the call. Can be empty.
      • subtraces - The traces of internal transactions (calls made by the contract)
      • traceAddress - The list of addresses where the call was executed, the address of the parents and the order of the current sub call
      • type - The value of the method such as call or create
    • vmTrace - The full trace of the virtual machine's state during execution of the given eth_call, including any sub-calls

Need RPC API keys?

Get 12.5M archival requests for free today.

Parameters

1.ARRAY OF TRACE CALL PARAM ARRAYS [required]

The individual objects are similar to eth_call. The difference to trace_call is that you provide an array of trace_call params and get a response for each trace.

1st inner param of the array

object - The eth_call data

  • from [optional] - The address from which the transaction is sent.
  • to - The address where the transaction is sent to.
  • gas [optional] - Integer of the gas provided for the transaction execution. Although eth_call consumes zero gas, this parameter may still be needed by some executions.
  • gasPrice [optional] - Integer of the gasPrice used for each paid gas as hexadecimal.
  • value [optional] - Integer of the value sent with a stated transaction
  • data [optional] - Hash of the method signature and encoded parameters. More info 👉 Ethereum Contract ABI (opens in a new tab)

2nd inner param of the array

  • array - The type of traces to include
    • vmTrace - Include the full trace of the virtual machine during the transaction
    • trace - Include the basic trace of the transaction
    • stateDiff - Include state changes caused by the transaction

2.Block number or Tag [required]

Hexadecimal block number or a Tag "latest", "earliest", or "pending".

Note: Unlike Ethereum mainnet, Base chain does not support the "safe" and "finalized" tags.

Request

POST https://base-mainnet.chainnodes.org/YOUR-API-KEY

Example

💡

Confusing? Ask blockchain developers in Chainnodes Telegram Chat (opens in a new tab)

  • HTTPS POST Request with a JSON RPC call in the body
  • Replace YOUR-API-KEY with the API key from your Chainnodes.org Dashboard
  • You can use a different supported network by replacing base-mainnet
curl https://base-mainnet.chainnodes.org/YOUR-API-KEY \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"method":"trace_callMany","params":[[[{"from":null,"to":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","data":"0x70a082310000000000000000000000004200000000000000000000000000000000000011"},["stateDiff"]],[{"from":null,"to":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","data":"0x70a082310000000000000000000000004200000000000000000000000000000000000011"},["trace"]]],"latest"],"id":1,"jsonrpc":"2.0"}'

Body

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": [
        {
            "output": "0x00000000000000000000000000000000000000000000000000000000e8d4a51000",
            "stateDiff": {
                "0x0000000000000000000000000000000000000000": {
                    "balance": {
                        "*": {
                            "from": "0x1bc16cf6c9dac36f8",
                            "to": "0x1bc16cf6c7e65f1e0"
                        }
                    },
                    "code": "=",
                    "nonce": {
                        "*": {
                            "from": "0x0",
                            "to": "0x1"
                        }
                    },
                    "storage": {}
                }
            },
            "trace": [],
            "vmTrace": null
        },
        {
            "output": "0x00000000000000000000000000000000000000000000000000000000e8d4a51000",
            "stateDiff": null,
            "trace": [
                {
                    "action": {
                        "from": "0x0000000000000000000000000000000000000000",
                        "callType": "call",
                        "gas": "0x2fa9cc8",
                        "input": "0x70a082310000000000000000000000004200000000000000000000000000000000000011",
                        "to": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
                        "value": "0x0"
                    },
                    "result": {
                        "gasUsed": "0xa2a",
                        "output": "0x00000000000000000000000000000000000000000000000000000000e8d4a51000"
                    },
                    "subtraces": 0,
                    "traceAddress": [],
                    "type": "call"
                }
            ],
            "vmTrace": null
        }
    ]
}

Common Use Cases

Multi-Token Balance Checking

This example checks USDC and WETH balances in a single request:

{"method":"trace_callMany","params":[
  [
    [
      {"to":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","data":"0x70a08231000000000000000000000000YourAddress"},
      ["trace"]
    ],
    [
      {"to":"0x4200000000000000000000000000000000000006","data":"0x70a08231000000000000000000000000YourAddress"},
      ["trace"]
    ]
  ],
  "latest"
],"id":1,"jsonrpc":"2.0"}

Transaction Simulation with State Changes

Simulate a token transfer while also seeing state changes:

{"method":"trace_callMany","params":[
  [
    [
      {
        "from":"0xYourAddress",
        "to":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
        "data":"0xa9059cbb000000000000000000000000RecipientAddress0000000000000000000000000000000000000000000000000000000000000064"
      },
      ["stateDiff","trace"]
    ]
  ],
  "latest"
],"id":1,"jsonrpc":"2.0"}

Related Methods