BNB Smart Chain
BNB Smart Chain
BNB Smart Chain
Le niveau gratuit couvre les projets personnels. Le paiement à l'usage évolue sans carte bancaire.
eth_getBalance reports how much BNB an address holds at a chosen block. BNB is the native gas token of BNB Smart Chain. Pass an account and a block tag to https://bsc.therpc.io/YOUR_API_KEY (chain ID 56), and the node returns that account's spendable balance as hex wei, snapshotted at the height you named. BSC reaches deterministic finality, so a balance read at a finalized block is a stable, reorg-safe figure you can record with confidence.
| # | 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 BNB Smart Chain 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() silently loses precision. Parse with BigInt(value) every time.latest can still be unwound by a reorg before finality; for any system of record, read at "finalized" instead.eth_call to its balanceOf.Paramètres
0x-prefixed 20-byte address
hex block number or "latest"/"earliest"/"pending"/"safe"/"finalized"