TriportRPC

eth_getBalance

Last updated:

eth_getBalance returns the amount of wei held by an Ethereum address at a specific point in the chain's history. The balance is the native ETH balance only — it does not include ERC-20 token balances, which live in their respective token contracts.

Use this method to display an account's spendable ETH, to check a contract's treasury, or to confirm a deposit has landed. By varying the second parameter (the block tag) you can read the balance as of the latest block, a pending block, the genesis block, or any historical block height.

The result is a hex-encoded u256 string measured in wei (1 ETH = 10¹⁸ wei). For example, 0x1bc16d674ec80000 is 2000000000000000000 wei = 2 ETH. You are responsible for converting the hex value to a decimal and dividing by 10¹⁸ when presenting it to users.

Parameters

This method takes no parameters.

Returns

eth_getBalance return value
FieldType
resultobject

Examples

curl https://triport.io/eth \
  -X POST -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <api-key>' \
  -d '{"id":1,"method":"eth_getBalance","params":[],"jsonrpc":"2.0"}'
const res = await fetch("https://triport.io/eth", {
  method: "POST",
  headers: { "Content-Type": "application/json", Authorization: "Bearer <api-key>" },
  body: JSON.stringify({
  "id": 1,
  "method": "eth_getBalance",
  "params": [],
  "jsonrpc": "2.0"
}),
});
const data = await res.json();
import requests
resp = requests.post(
    "https://triport.io/eth",
    headers={"Authorization": "Bearer <api-key>"},
    json={"id":1,"method":"eth_getBalance","params":[],"jsonrpc":"2.0"},
)
print(resp.json())

Usage

  1. Transport: HTTP (JSON-RPC).
  2. Networks: mainnet.
  3. Credit cost: 1 per call.

FAQ

What does eth_getBalance do?
Returns the native ETH balance of an account, in wei, at a given block.
How many credits does eth_getBalance cost?
eth_getBalance costs 1 credit(s) per call on Triport by default.
Is eth_getBalance available over WebSocket?
eth_getBalance is an HTTP JSON-RPC method.