🔷 Arbitrum
arbtrace_callMany

Polygon API Documentation


debug_traceCallMany RPC Method

debug_traceCallMany executes a list of bundles (a bundle is a collection of transactions), without creating transactions on the blockchain. Returns their traces.

See eth_callMany as a reference. This call does the same simulation but returns debug traces.

Parameters

1.BUNDLES [required]

  • array - The list of bundles

    • transactions - An array of objects with the same parameters as in eth_call

    • blockOverride - Optional overrides of the execution context block header

      • blockNumber - Block number. Defaults to the block number of the first simulated block. Each following block increments its block number by 1

      • blockHash - A dictionary that maps blockNumber to a user-defined hash. It could be queried from the solidity opcode BLOCKHASH

      • coinbase - The address of miner. Defaults to the original miner of the first simulated block.

      • timestamp - The timestamp of the current block. Defaults to the timestamp of the first simulated block. Each following block increments its timestamp by 1.

      • difficulty - The difficulty of the current block. Defaults to the difficulty of the first simulated block.

      • gasLimit - The gas limit of the current block. Defaults to the difficulty of the first simulated block.

      • baseFee - The base fee of the current block. Defaults to the base fee of the first simulated block.

2.SIMULATION CONTEXT [required]

  • object - The simulation context

    • blockNumber or Tag - Block number or 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).

    • transactionIndex - The transaction index of the simulated transactions. Default value of the transaction index is -1, which would place the simulated transactions after the entire block.

3.STATE OVERRIDES [optional]

The state override set is an optional address-to-state mapping, which follows the eth_call standard.

  • object - The state override

    • some_hash - object

      • balance - the balance to override

4.TIMEOUT [optional]

The upper limit running time for the simulations in milliseconds. Defaults to 5000 milliseconds.

5.TRACE TYPE [optional]

  • The type of tracer - String - It might be callTracer or prestateTracer

    • callTracer - The calltracer keeps track of all call frames, including depth 0 calls, that are made during a transaction.

    • prestateTracer - The prestateTracer replays the transaction and tracks every part of state that occured during the transaction.

  • tracerConfig - The object to specify the configurations of the tracer

    • onlyTopCall - When set to true, this will only trace the primary (top-level) call and not any sub-calls. It eliminates the additional processing for each call frame.

Need RPC API keys?

Get 12.5M archival requests for free today.

Returns

The return value described below is the same as debug_traceCall. The only difference is that you get an array as you are tracing an array of calls with debug_traceCallMany.

callTracer response

FieldDescription
type of the callType of the call
fromThe transaction sender.
toThe address of the transaction recipient.
gasThe gas included in the transaction by the sender.
transaction valueThe actual value per gas deducted from the sender's account.
gasUsedThe total used gas by the call. Encoded as hexadecimal.
inputThe optional input data sent with the transaction, usually used to interact with smart contracts.
outputThe return value of the call, encoded as a hexadecimal string.
errorAn error message in case the execution failed.
callsA list of sub-calls made by the contract during the call, each represented as a nested call frame object.
revertReasonThe reason why the transaction was reverted, returned by the smart contract if any.

prestateTracer response

  • smart contract address — The address of the smart contract associated with the result.

    • balance — The balance of the contract, expressed in wei and encoded as a hexadecimal string.

    • code — The bytecode of the contract, encoded as a hexadecimal string.

    • nonce — The nonce of the account associated with the contract, represented as an unsigned integer.

    • storage — A map of key-value pairs representing the storage slots of the contract. The keys and values are both encoded as hexadecimal strings.

Struct/opcode response

  • The transaction trace object:

  • failed - Successful or failed

  • gas - The total consumed gas in the transaction

  • returnValue - The return value of the executed contract call

  • structLogs - The trace result of each step:

    • pc - The current index in bytecode.

    • op - The name of current executing operation.

    • gas - The available gas in the execution.

    • gasCost - The gas cost of the operation.

    • depth- The number of levels of calling functions.

    • stack - An array of values in the current stack.

    • storage - The mapping of the current storage.

    • refund - The total of current refund value.

    • error- The error of the execution.

    • memory - An array of values in the current memory.

Request

POST https://<network>.chainnodes.org/YOUR-API-KEY

Example

💡 Confusing?

Ask our experienced blockchain developers in Telegram

  • 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 '{"jsonrpc":"2.0","method":"debug_traceCallMany","params":[[{"transactions":[{"from":"0xDAFEA492D9c6733ae3d56b7Ed1ADB60692c98Bc5","to":"0xdAC17F958D2ee523a2206206994597C13D831ec7","gas":"0x92c0","gasPrice":"0x7896e72a000","value":"0x0","data":"0x70a0823100000000000000000000000047ac0fb4f2d84898e4d9e7b4dab3c24507a6d503"}],"blockOverride":{"blockNumber":"0xe39dd0"}}],{"blockNumber":"0x103434E","transactionIndex":234},{}],"id":1}'

Body

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": [
        [
            {
                "structLogs": [
                    {
                        "pc": 0,
                        "op": "PUSH1",
                        "gas": 16136,
                        "gasCost": 3,
                        "depth": 1,
                        "stack": [],
                        "memory": []
                    },
                    {
                        "pc": 2,
                        "op": "PUSH1",
                        "gas": 16133,
                        "gasCost": 3,
                        "depth": 1,
                        "stack": [
                            "0x60"
                        ],
                        "memory": []
                    },
                    {
                        "pc": 4,
                        "op": "MSTORE",
                        "gas": 16130,
                        "gasCost": 12,
                        "depth": 1,
                        "stack": [
                            "0x60",
                            "0x40"
                        ],
                        "memory": [
                            "0000000000000000000000000000000000000000000000000000000000000000",
                            "0000000000000000000000000000000000000000000000000000000000000000",
                            "0000000000000000000000000000000000000000000000000000000000000000"
                        ]
                    },
 
 
............
............
............