Ethereum
Ethereum
Ethereum
免费套餐涵盖个人项目。按量付费,无需绑卡即可扩展。
eth_getBalance returns the ETH balance of an account on Ethereum mainnet, measured at a block you pick. The value comes back as wei — the smallest unit of Ether, with 18 decimals — so a balance of one ETH reads as 0xde0b6b3a7640000. Pass an address plus a block tag: latest for the current head, finalized for a value that can't be reorged, or a specific hex height for a point-in-time read. Send it to https://ethereum.therpc.io/YOUR_API_KEY (chain ID 1). This reports only native ETH; a token's balance lives in that token's own contract, not here.
eth_estimateGas or signing.latest and react when it rises to spot an incoming deposit.| # | 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|---|
| 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 Ethereum 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(hex) silently loses precision. Always parse with BigInt(value) and divide by 10n**18n to reach whole ETH.latest sits at the head and can shift in a short reorg before justification. For a ledger or system of record, read at finalized so the figure can't be revised out from under you.balanceOf on the token contract via eth_call — this method never sees token balances.参数
0x-prefixed 20-byte address
hex block number or "latest"/"earliest"/"pending"/"safe"/"finalized"