若是你但願立刻開始學習以太坊DApp開發,能夠訪問匯智網提供的出色的在線互動教程:web
可使用JavaScript API來獲取以太坊帳戶餘額,例如在JavaScript代碼中:學習
web3.fromWei(web3.eth.getBalance(web3.eth.coinbase));
若是你在geth控制檯裏,能夠將web3.eth
使用其eth
別名代替:ui
> web3.fromWei(eth.getBalance(eth.coinbase));
在合約中更簡單,Solidity爲每一個address
對象都提供了一個balance
屬性,它返回以wei
爲單位的帳戶餘額。例如:3d
contract ownerbalancereturner { address owner; function ownerbalancereturner() public { owner = msg.sender; } function getOwnerBalance() constant returns (uint) { return owner.balance; } }