Ethereum
¿Listo para usar esto en producción?
El plan gratuito cubre proyectos personales. El pago por uso escala sin necesidad de tarjeta.
Ethereum
El plan gratuito cubre proyectos personales. El pago por uso escala sin necesidad de tarjeta.
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.| # | Nombre | Tipo | Requerido | Descripción |
|---|---|---|---|---|
| 1 | address | string (hex) | Sí | The account address to query. |
| 2 | blockTag | string | No | Block at which to read the balance.Predeterminado: latest |
| Tipo | Descripción |
|---|---|
| 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 | Mensaje | 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"