Moonbeam

eth_getBalance
eth_getBalance returns the native-token balance of a given account at a specific block. On Ethereum that's ETH in wei; on BSC it's BNB in wei; on Polygon it's MATIC in wei. The unit is always wei (10^-18 of the chain's native token).
Parameters
| # | Name | Type | Description |
|---|---|---|---|
| 1 | address | string | 20-byte hex-encoded account address (with the 0x prefix). |
| 2 | block | string | Block number in hex, or a tag: latest, pending, earliest, safe, finalized. |
safe and finalized are supported on Ethereum mainnet, Gnosis, Arbitrum, Arbitrum Nova, and Avalanche C-chain.
Response shape
The result is a hex-encoded integer in wei. Convert to a number with BigInt(value); converting to a decimal display value requires dividing by 10n ** 18n for the native token.
0x1a055690d9db80000 = 30,000,000,000,000,000,000 wei = 30 ETH.
Common pitfalls
- Don't divide raw integers in JS.
Number("0x1a055690d9db80000") / 1e18silently loses precision past ~2^53. UseBigIntand an explicit decimal formatter. latestis not necessarily final. If you need a value safe from reorgs, query at thefinalizedblock tag instead.- **For ERC-20 balances, use eth_call against the token contract's
balanceOf(address)selector —eth_getBalanceonly returns the native-token balance.
See also
- eth_getTransactionCount — get the nonce alongside the balance.
- eth_call — read ERC-20 balances and other contract state.
Parameters
20-byte address (vitalik.eth in the default value)
block number, hash, "latest", "pending", "earliest" or "safe"