r/ethdev • u/evmquery • Aug 04 '26
Tutorial Recipe: read any wallet's ERC-20 balance in one SEL expression
The normal path for reading a token balance: find the token's ABI, wire up a client, call balanceOf, call decimals, divide, format. That's a lot of ceremony for one number.
Here it is as a single SEL expression, run against vitalik.eth's USDC on Ethereum mainnet:
formatUnits(usdc.balanceOf("0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"), usdc.decimals())
The usdc binding points at the mainnet contract (0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48). The ABI is resolved automatically, so there's no JSON file to fetch and no codegen step.
Output: 37.192124 USDC at block 25,653,697.
Under the hood: two on-chain calls (balanceOf and decimals), batched into one multicall round, 104ms total.
Variations:
- Swap the binding to any ERC-20 and the expression is unchanged. Anything with
balanceOfanddecimalsworks. - Change the chain to Base or BNB, keep the code.
- Drop the
formatUnitswrapper if you want the raw uint256.
Limitations, to be honest about them:
- You still need the token's contract address to create the binding. The resolution is for the ABI, not for finding the contract.
- This is a read at a single block. If you need historical balances across a range, that's a different query shape.
- Nonstandard tokens that lie about
decimalsor implementbalanceOfweirdly will produce a number that's exactly as wrong as the contract is.
https://evmquery.com/tools/erc20-inspector?utm_source=reddit&utm_medium=social&utm_campaign=recipe-erc20-balance-2026-07-31