Avalanche
Avalanche
Avalanche
免费套餐涵盖个人项目。按量付费,无需绑卡即可扩展。
eth_getBalance returns the native AVAX balance of an Avalanche C-Chain account at the block you specify. The value is the account's spendable gas token — what it can use to pay fees on the C-Chain — and not any ERC-20 holding. Send the address and a block tag to https://avalanche.therpc.io/YOUR_API_KEY (chain ID 43114) and the node replies with a hex-encoded wei amount; divide by 10^18 to express it in whole AVAX.
| # | 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|---|
| 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 Avalanche 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() on the raw hex value — an AVAX balance above 2^53 wei loses precision; always use BigInt(value)."latest" still reflects the freshest tip; for systems of record query the "finalized" tag instead.eth_call to the token contract's balanceOf.参数
0x-prefixed 20-byte address
hex block number or "latest"/"earliest"/"pending"/"safe"/"finalized"