Integration engineering

JSON-RPC batching and Multicall solve different problems

Choose transport batching or contract Multicall according to state consistency, call context and failure isolation.

JSON-RPC batching groups requests in one transport message. Multicall groups contract calls inside one EVM execution. They reduce different forms of overhead and have different semantics.

Geth's batching guide demonstrates independent requests sent as an array. Match responses by request ID rather than relying on arrival order. A batch alone does not turn several latest-state queries into one atomic contract read.

The Multicall3 project describes collecting contract read results through one eth_call, with a shared block context and per-call success handling for supported methods.

Choose by dependency

TaskUseful approach
Independent receipts for known hashesJSON-RPC batch
Several token balance reads at one stateVerified Multicall deployment or explicitly pinned RPC reads
Read depending on a previous resultSeparate stages

Multicall changes call context. A target sees the calling contract according to CALL or DELEGATECALL semantics, so a function depending on msg.sender may behave differently from a direct call. Do not generalize a read optimization into a wallet authorization mechanism.

Handle partial failure

One broken metadata method should not necessarily hide every balance. Select an aggregation method whose failure behavior matches the task, inspect each result and decode only successful return data. Bound batch size so one oversized request does not exceed node limits.

Verify the actual deployment on the selected chain. A familiar address string is not a guarantee of identical code. Fixtures should include reordered RPC responses, one failed subcall and a sender-sensitive function. These cases reveal semantic differences that a latency-only comparison misses.

Sources & verification (2)

Source-check date is recorded in the article details. URLs are provided for manual verification. Use Copy to keep this page open.

  1. Batch requests

    Independent JSON-RPC request batching

    https://geth.ethereum.org/docs/interacting-with-geth/rpc/batch
  2. Multicall3

    Call aggregation, same-block reads and msg.sender behavior

    https://github.com/mds1/multicall3

Continue reading

Swap API integration: quote, approve, simulate, submit