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.

Связанные методы