Skip to main content

Accounts

Get Hedera acount information using Arkhia's Json-RPC Relay.

info

To configure your web3Provider, please refer to the Getting Started Docs:

eth_getBalance

Get HBAR balance of an Hedera account.

Parameters

  • Address: address to check for balance Required
  • Block: integer block number, or the string "latest", "earliest" or "pending", see the default block parameter

Returns

Hex string or Integer: Hedera balance of the given account

/*Remove the preceding 0's from the account number. For example, if your HEDERA_ACCOUNT_NUMBER is 0.0.442577, you should use 442577*/const address = web3Provider.utils.toHex(`<HEDERA_ACCOUNT_NUMBER>`);const paddedAddress = web3Provider.utils.padLeft(address, 40);web3Provider.eth.getBalance(paddedAddress)    .then((res)=> console.log(`-> Get Balance ${_addr} : ${res*Math.pow(10, -18)}`))    .catch(e => console.log(`-> Get Balance Error: ${e}`));