eth_getBalance
eth_getBalance(address, blockNumber) → quantity Returns the OKRW balance of the specified address at a given block. Since OKRW is the native token, this returns the native balance (equivalent to ETH balance on Ethereum).
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
address | string | ✓ | The address to check balance for (20 bytes, hex-encoded with 0x prefix) |
blockNumber | string | ✓ | Block number in hex, or 'latest', 'earliest', 'pending' |
Returns
Type:
string The balance in wei (hex-encoded). Divide by 10^18 to get OKRW amount.
Errors
| Code | Name | Description |
|---|---|---|
-32602 | Invalid params | Invalid address format or block number |
Examples
Get balance at latest block
Returns the current OKRW balance of the address
curl -X POST https://rpc-testnet.maroo.io \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_getBalance",
"params": ["0x742d35Cc6634C0532925a3b844Bc454e4438f44e", "latest"],
"id": 1
}' Response
Result is 10 OKRW (10 * 10^18 wei in hex)
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x8AC7230489E80000"
}