Returns the account balance of the specified address on the chain.
transfer:
web3.eth.getBalance(addressHexString [, defaultBlock] [, callback])
parameter:
addressHexString
: String - The address to check the balance from.defaultBlock
: Number|String - (optional) If this value is not set, theweb3.eth.defaultBlock
set block will be used, otherwise the specified block will be used.callback
: Funciton - (optional) callback function to support asynchronous execution.
return value:String
- A BigNumber instance containing the current balance of the given address in wei.
Example:
var balance = web3.eth.getBalance("0x407d73d8a49eeb85d32cf465507dd71d507100c1");
console.log(balance); // instanceof BigNumber
console.log(balance.toString(10)); // '1000000000000'
console.log(balance.toNumber()); // 1000000000000
Tutorial recommendation: