BNB Smart Chain
BNB Smart Chain
BNB Smart Chain
免费套餐涵盖个人项目。按量付费,无需绑卡即可扩展。
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.
| # | 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|---|
| 1 | address | string (hex) | 是 | The account address to query. |
| 2 | blockTag | string | 否 | Block at which to read the balance.默认值: latest |
| 类型 | 描述 |
|---|---|
| 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.
| 错误码 | 错误信息 | 原因 |
|---|---|---|
-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.参数
0x-prefixed 20-byte address
hex block number or "latest"/"earliest"/"pending"/"safe"/"finalized"