Web3.js – How to Interpret Result of web3.eth.getBalance

truffleweb3js

I got following result from getBalance check:
truffle(default)> web3.eth.getBalance('xxxxxxxxxxxxxxx')

Can anyone explain what does it means and where the value of ether: BigNumber { s: 1, e: 0, c: [ 0 ] }?

Best Answer

You need to convert the BigNumber into a string to have a readable value

web3.eth.getBalance('xxxxxxxxxxxxxxx').toString()

the output value would be in wei.

You can use web3.fromWei(number, unit) to convert it in another unit (eg. ether). ref

Related Topic