BNB Smart Chain
BNB Smart Chain
BNB Smart Chain
El plan gratuito cubre proyectos personales. El pago por uso escala sin necesidad de tarjeta.
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.
| # | 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 BNB Smart Chain 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() 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.Parámetros
0x-prefixed 20-byte address
hex block number or "latest"/"earliest"/"pending"/"safe"/"finalized"