🟪 Polygon
eth_callMany

Polygon API Documentation


eth_callMany RPC Method

Executes a list of bundles (a bundle is a collection of transactions), without creating transactions on the blockchain. The eth_callMany method can be used similarly as eth_call besides three major distinctions.

  1. The method supports simulating transactions at a intermediate state of a block (e.g. inheriting the block state after executing a portion of transactions in that block)
  2. The method supports simulating multiple transactions with sequential dependencies. The transactions could be separated into different blocks.
  3. The method supports overwrites for block headers (e.g. coinbase, difficulties, blockHash, and etc.)

Returns

The method returns a list of list of Binary containing either the return value of the executed contract call or the reverted error code.

  • array - All the return/error values
    • value - The value if was successful
    • error - The error if the transaction failed

Need RPC API keys?

Get 12.5M archival requests for free today.

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 - The Tag "latest", "earliest", "pending", "safe" or "finalized", or an hexadecimal block number. "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.

💡 Confusing?

Ask our experienced blockchain developers in Telegram

Request

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

Example

  • 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":"eth_callMany","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": [
        [
            {
                "value": "000000000000000000000000000000000000000000000000000470de54da7138"
            }
        ]
    ]
}

JSON-RPC 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