How it works
Multicall3 is a contract that takes a list of calls, runs each one, and returns all the results together. viem wraps it: you pass an array of reads tomulticall, and viem sends them as one eth_call to Multicall3’s aggregate3 function.
Fewer requests mean faster pages and less chance of hitting RPC rate limits.
BOT Chain’s Multicall3 is at the same address on both networks:
What you’ll build
A script that reads five values in one request, including one call that fails on purpose, and handles each result on its own.Prerequisites
- Node.js 22 or later.
Steps
1
Create the project
@uzolabs/sdk/chains already set contracts.multicall3 to BOT Chain’s address, so viem knows where to send the batch.2
Write the script
multicall.ts
holder with your own address.Each item in results has a status. A failed call returns status: "failure" and an error, and the other calls still succeed. Checking status also narrows the type of result, so TypeScript knows usdtBalance.result is a bigint.3
Run it
Verify it worked
Output from a run on testnet on 2026-10-02:Output
multicall.ts
eth_call whose data starts with 0x82ad56cb, the selector of aggregate3.
Options
To batch reads automatically without calling
multicall yourself, create the client with batch: { multicall: true }. viem then groups readContract calls made in the same tick into one Multicall3 request.
Troubleshooting
Chain does not support contract multicall3
Chain does not support contract multicall3
Your chain object has no
contracts.multicall3. Use botChainTestnet from @uzolabs/sdk/chains, add the address to your own defineChain, or pass multicallAddress. If the client has no chain at all, the error reads client chain not configured. multicallAddress is required.Every call fails on testnet
Every call fails on testnet
You’re probably using the standard address
0xcA11...CA11, which has no code on testnet. Use 0x47FA21f684bBAD707A53a0f9BE59F1422F46C265.One call fails and I don't know why
One call fails and I don't know why
Log
result.error.message for that item. Common causes are a wrong address, an address with no contract, or a function the contract doesn’t have.The RPC rejects the request as too large
The RPC rejects the request as too large
Lower
batchSize, or split your list into several multicall calls.Next steps
Read contract state
Batch reads in React with wagmi.
Use the BOTScan API
Query history the RPC can’t give you.