> ## Documentation Index
> Fetch the complete documentation index at: https://docs.theblockchainlibrary.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Batch Read with Multicall

> Batch multiple contract reads into a single RPC call using viem's multicall.

# Batch Read with Multicall

Batch multiple contract reads into a single RPC call using viem's multicall.

Batch multiple contract reads into a single RPC call using viem's multicall.

## Explanation

Multicall batches multiple read-only calls into a single RPC request via a Multicall3 contract. This reduces network round-trips and is essential when querying many token balances or metadata in one go.

## Code

```typescript theme={null}
import { createPublicClient, http, parseAbi } from "viem";
import { mainnet } from "viem/chains";

const client = createPublicClient({
  chain: mainnet,
  transport: http(),
});

const erc20Abi = parseAbi([
  "function name() view returns (string)",
  "function decimals() view returns (uint8)",
  "function totalSupply() view returns (uint256)",
]);

const results = await client.multicall({
  contracts: [
    { address: "0xA0b8...eB48", abi: erc20Abi, functionName: "name" },
    { address: "0xA0b8...eB48", abi: erc20Abi, functionName: "decimals" },
    { address: "0xA0b8...eB48", abi: erc20Abi, functionName: "totalSupply" },
  ],
});

console.log(results);
// => [{ result: "USD Coin" }, { result: 6n }, { result: 1000000...n }]
```

***

**Canonical knowledge ID:** `code-example:batch-read-multicall`
