I am running a lightmode geth daemon, and I want to check the balance of my daemon. I read this answer, which says that I cannot use the command that I am currently using, as it requires support for eth.coinbase

geth --exec "web3.fromWei(eth.getBalance(eth.coinbase), 'ether')" attach

Geth synced in lightmode doesn't support use of eth.coinbase. What command can I use? Do I have to run a --syncmode=fast or standard node instead?


If the first account is your addreess you can use

geth --exec "web3.fromWei(eth.getBalance(eth.accounts[0]), 'ether')" attach

For example you can ask for an arbitrary address replacing eth.coinbase with such address

geth --exec "web3.fromWei(eth.getBalance('0xFBb1b73C4f0BDa4f67dcA266ce6Ef42f520fBB98'), 'ether')" attach
  • Well damn, now I feel stupid. Thanks for your answer – Barney Chambers Jan 30 '19 at 7:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.