eth_getBalance
Returns the balance of the account of a given address.
Parameters
DATA
, 20 Bytes - address to check for balance.QUANTITY|TAG
- integer block number, or the string"latest"
,"earliest"
or"pending"
, see the default block parameter.
Returns
QUANTITY
- hex value of the current ETH balance for the given address, measured in wei.
Request
Result
Converting eth_getBalance response into ETH
To convert the hex string response, measured in Wei to a decimal value measured in ETH we need to complete two steps:
Convert the hex response into decimal (Wei)
Convert the Wei decimal into ETH decimal (10^18 wei = 1 eth)
Depending on what library or language you are using, there are several options here.
Last updated