Try it live
This call runs from your browser against Sei Mainnet. It returns the balance in wei, the smallest unit of SEI. One SEI is 1018 wei.Install
await. Run them with npx tsx script.ts on Node.js 18 or later.
Read a native balance
The native balance is the amount of SEI that an address holds.bigint in viem and ethers, and an int in web3.py. The formatEther and from_wei(…, 'ether') helpers divide by 1018. They carry Ethereum names, but they apply to SEI because SEI also uses 18 decimals on the EVM.
EVM RPC methods take
0x addresses. If you have a sei1… address, see Accounts to find the EVM address of the same account.Read an ERC-20 balance
A token balance lives in the token contract, so you call itsbalanceOf function. Then you scale the result by the token’s decimals. This example reads USDC on Sei Mainnet at 0xe15fC38F6D8c56aF07bbCBe3BAf5708A2Bf42392, which uses 6 decimals.
0 USDC. ethers prints 0.0 USDC, because formatUnits in ethers always includes a decimal place. Replace address with your own address to see a real balance.
Read many balances at once
Each read above is a separate RPC request. To read dozens of balances in one request, batch them with Multicall3, which is deployed at0xcA11bde05977b3631167028862bE2a173976CA11 on Sei Mainnet and Sei Testnet.
Related recipes
- Send SEI: move SEI to another address
- ERC-20 interaction: token metadata, transfers, and approvals
- Multicall: batch many reads into one request