Ethereum
Pronto para usar isso em produção?
O plano gratuito cobre projetos pessoais. O pay-as-you-go escala sem cartão de crédito.
Ethereum
O plano gratuito cobre projetos pessoais. O pay-as-you-go escala sem cartão de crédito.
eth_getBalance returns the ETH balance of an account on Ethereum mainnet, measured at a block you pick. The value comes back as wei — the smallest unit of Ether, with 18 decimals — so a balance of one ETH reads as 0xde0b6b3a7640000. Pass an address plus a block tag: latest for the current head, finalized for a value that can't be reorged, or a specific hex height for a point-in-time read. Send it to https://ethereum.therpc.io/YOUR_API_KEY (chain ID 1). This reports only native ETH; a token's balance lives in that token's own contract, not here.
eth_estimateGas or signing.latest and react when it rises to spot an incoming deposit.| # | Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|---|
| 1 | address | string (hex) | Sim | The account address to query. |
| 2 | blockTag | string | Não | Block at which to read the balance.Padrão: latest |
| Tipo | Descrição |
|---|---|
| string (hex) | Hex-encoded balance in wei. Convert with BigInt(value); divide by 10n**18n to get the chain's base unit. |
Try it live in the Ethereum playground.
| Código | Mensagem | Causa |
|---|---|---|
-32602 | Invalid params | Address is malformed, missing 0x prefix, or block tag is unrecognised. |
-32000 | Missing trie node | Queried a historical block that the node has pruned (non-archive node). |
Number(hex) silently loses precision. Always parse with BigInt(value) and divide by 10n**18n to reach whole ETH.latest sits at the head and can shift in a short reorg before justification. For a ledger or system of record, read at finalized so the figure can't be revised out from under you.balanceOf on the token contract via eth_call — this method never sees token balances.Parâmetros
0x-prefixed 20-byte address
hex block number or "latest"/"earliest"/"pending"/"safe"/"finalized"