ethereum / execution-apis

Collection of APIs provided by Ethereum execution layer clients
Creative Commons Zero v1.0 Universal
961 stars 374 forks source link

Add eth_multicall #267

Open zemse opened 2 years ago

zemse commented 2 years ago

Abstract

Takes array of call objects and executes them one after the other.

Motivation

The eth_call executes the call on the latest state. When someone wants to inspect a state that would be, after a transaction would go through, currently it involves a non cheap way, i.e. using the mainnet fork (like ganache/hardhat network/anvil) to confirm the first tx and then query state on it, which makes a lot of rpc calls. Having a eth_multicall can be achieved by the clients cheaply.

Specification

TransactionCallObject be the type/interface for first arg of eth_call.

eth_multicall(calls: Array<TransactionCallObject>, blockTag?: number) -> Array<Bytes>

The first arg calls is an array and required, while the second arg blockTag is optional.

Based on the discussion in EF JS discord.

lightclient commented 2 years ago

This makes a lot of sense to me. The path of least resistance for this is to probably to propose it during next ACD. I would want to have it formally spec'd so we could share with client teams, is that something you could do between now and Aug 4? (preferably a few days early so we can go through a first round of reviews)