🟪 Polygon
trace_callMany

Polygon API Documentation


trace_callMany RPC Method

Executes a call like eth_call but returns traces. In trace_callMany you can specify multiple trace_call objects and execute them on the same block.

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] - Interger 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", "pending", "safe" or "finalized".

"Safe" and "finalized" are only availible on Ethereum and Arbitrum One chains. Read block parameter description in Ethereum documentation (opens in a new tab).

Request

POST https://<network>.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 polygon-mainnet
curl https://polygon-mainnet.chainnodes.org/YOUR-API-KEY \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"method":"trace_callMany","params":[[[{"from":null,"to":"0x6b175474e89094c44da98b954eedeac495271d0f","data":"0x70a082310000000000000000000000006E0d01A76C3Cf4288372a29124A26D4353EE51BE"},["stateDiff"]],[{"from":null,"to":"0x6b175474e89094c44da98b954eedeac495271d0f","data":"0x70a082310000000000000000000000006E0d01A76C3Cf4288372a29124A26D4353EE51BE"},["trace"]]],"latest"],"id":1,"jsonrpc":"2.0"}'

Body

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

JSON-RPC Polygon API Documentation by CHAINNODES is based on Erigon node client. Contact us if you are interested in specific methods that are only available on geth, besu, Nethermind or reth