Skip to main content

fetch_account_fields_bulk

Function fetch_account_fields_bulk 

Source
pub async fn fetch_account_fields_bulk<P: Provider<AnyNetwork>>(
    provider: &P,
    addresses: &[Address],
    block: BlockId,
) -> StorageFetchResult<Vec<(Address, AccountFieldsSample)>>
Expand description

Fetch balance + code hash for many accounts in one eth_call.

BALANCE/EXTCODEHASH read other accounts, so only one code override (the extractor host, at MULTICALL3_ADDRESS) is injected and the queried accounts are untouched. Costs ~5.3k gas per address (two cold account accesses), so thousands of accounts fit in one call. Querying the host address itself reports the extractor’s own code hash — give it a dedicated eth_getProof instead.