Ethereum
Prêt à utiliser cela en production ?
Le niveau gratuit couvre les projets personnels. Le paiement à l'usage évolue sans carte bancaire.
Ethereum
Le niveau gratuit couvre les projets personnels. Le paiement à l'usage évolue sans carte bancaire.
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.| # | Nom | Type | Obligatoire | Description |
|---|---|---|---|---|
| 1 | address | string (hex) | Oui | The account address to query. |
| 2 | blockTag | string | Non | Block at which to read the balance.Défaut : latest |
| Type | Description |
|---|---|
| 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.
| Code | Message | Cause |
|---|---|---|
-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.Paramètres
0x-prefixed 20-byte address
hex block number or "latest"/"earliest"/"pending"/"safe"/"finalized"