web3.eth.getBalance

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, the web3.eth.defaultBlockset 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:

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324605383&siteId=291194637