Get account balance
Methods
Method
Type
Description
//Create the account balance query
AccountBalanceQuery query = new AccountBalanceQuery()
.setAccountId(accountId);
//Sign with client operator private key and submit the query to a Hedera network
AccountBalance accountBalance = query.execute(client);
//Print the balance of hbars
System.out.println("The hbar account balance for this account is " +accountBalance.hbars);
//v2.0.0//Create the account balance query
const query = new AccountBalanceQuery()
.setAccountId(accountId);
//Submit the query to a Hedera network
const accountBalance = await query.execute(client);
//Print the balance of hbars
console.log("The hbar account balance for this account is " +accountBalance.hbars);
//v2.0.7Last updated