L0vdL0vd

eth_getBalance

Returns the native token balance of an address at a given block.

归档 · 可查询任意历史区块

Pass a past block number to read the balance as it was then. This is the classic archive read.

curl https://eth.l0vdinfra.com/YOUR_KEY \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{"jsonrpc":"2.0","id":1,"method":"eth_getBalance","params":["0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045","0x1208a5f"]}'

响应示例

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x63495bbdb7fa5e302"
}
参数与您的端点

参数

addressstring必填
20-byte address, hex encoded.
blockstring必填
Block number in hex (e.g. "0x1208a5f") or a tag: "latest", "safe", "finalized", "earliest" or "pending". L0vd endpoints run archive nodes, so any historical block works.

返回值

string Balance in wei, hex encoded.

适用场景

Read how much native token (ETH on Ethereum, BNB on BNB Chain, POL on Polygon, AVAX on Avalanche) an address held at a block.

Pass a historical block number to rebuild balances at a date: end of month for accounting, the block before an exploit for forensics, or a snapshot block for an airdrop.

如何解读结果

The result is wei as a hex string. Divide by 10^18 to get whole tokens: 0x63495bbdb7fa5e302 = 114,469,605,655,173,260,034 wei ≈ 114.47 ETH.

In JavaScript use BigInt(result) or viem's formatEther; in Python int(result, 16) / 10**18. Plain floats lose precision on large balances.

提示

  • This is the native balance only. ERC-20 balances live in the token contract: call balanceOf with eth_call.
  • To find the block at a date, binary-search eth_getBlockByNumber on the timestamp field.
  • Batch many addresses at the same block in one HTTP request (JSON array) to save round trips.

相关方法