Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSONRPC: eth_multiCall #616

Open
Kriys94 opened this issue Dec 20, 2024 · 0 comments
Open

JSONRPC: eth_multiCall #616

Kriys94 opened this issue Dec 20, 2024 · 0 comments

Comments

@Kriys94
Copy link

Kriys94 commented Dec 20, 2024

Motivation


Some Dapps/Wallets use https://www.multicall3.com/ to read multiple smart contracts data in a single JSON-RPC request. However, this is computationally inefficient and slow because the Reads are executed in the EVM runtime context, which is fully sequential. This proposal enables the simultaneous reading of multiple contracts and boosts read performance. To avoid any race condition, the sub-reads are executed independently.

Spec


Parameters:

  • List
    • Object
      • from: 20 bytes [Required] Address the transaction is sent from
      • to: 20 bytes - Address the transaction is directed to
      • gas: Hexadecimal value of the gas provided for the transaction execution. eth_call consumes zero gas, but this parameter may be needed by some executions.
      • gasPrice: Hexadecimal value of the gasPrice used for each paid gas.
      • maxPriorityFeePerGas: Maximum fee, in wei, the sender is willing to pay per gas above the base fee. See EIP-1559 transactions.
      • maxFeePerGas: Maximum total fee (base fee + priority fee), in wei, the sender is willing to pay per gas. See EIP-1559 transactions.
      • value: Hexadecimal of the value sent with this transaction.
      • data: Hash of the method signature and encoded parameters. See Ethereum contract ABI specification.
  • block parameter: [Required] A hexadecimal block number, or one of the string tags latest, earliest, pending, safe, or finalized. See the default block parameter.
{
  "jsonrpc": "2.0",
  "method": "eth_multiCall",
  "params": [
      [
        {
         "from": "0x0000000000000000000000000000000000000000", 
         "to": "0xdac17f958d2ee523a2206206994597c13d831ec7",
          "data": "0x70a082310000000000000000000000007B071A4C0a77B525e0a9446A598fc97AFaB5E6Ab"
        },
        {
         "from": "0x0000000000000000000000000000000000000000", 
          "to": "0xB8c77482e45F1F44dE1745F52C74426C631bDD52",
          "data": "0x70a082310000000000000000000000007B071A4C0a77B525e0a9446A598fc97AFaB5E6Ab"
        },
        {
         "from": "0x0000000000000000000000000000000000000000", 
          "to": "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619",
          "data": "0x70a082310000000000000000000000007B071A4C0a77B525e0a9446A598fc97AFaB5E6Ab"
        },
      ],
      "latest"
  ],
  "id": 1
}

Response:

  • List
    • Object
      • OR
        • data: The return value of the executed contract method
        • Object:
          • data
          • code
          • message
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "data": "0x000000000000000000000000000000000000000000000000000000000000000a"
    },
    {
      "error": {
        "code": -32000,
        "message": "execution reverted: ERC721: invalid token ID",
        "data": "0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001a4552433732313a20696e76616c696420746f6b656e2049440000000000000000",
      }
    },
    {
      "error": {
        "code": -32000,
        "message": "invalid address",
        "data": "0x",
      } 
    }
  ]
}
@Kriys94 Kriys94 changed the title WIP - Open standard specification: eth_multiCall WIP - JSONRPC: eth_multiCall Dec 20, 2024
@Kriys94 Kriys94 changed the title WIP - JSONRPC: eth_multiCall JSONRPC: eth_multiCall Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant