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"