Error message - trying to check my balance

julius_nageljulius_nagel Hamburg, GermanyMember Posts: 9
Hi.

I keep getting the message "syntax error near unexpected token `eth.getBalance' ", when trying to check my balance.

I use the call "web3.fromWei(eth.getBalance(eth.coinbase), "ether")" on my Macbook terminal.

Any advice on what Im doing wrong? Thanks a lot (sorry if this is a noob question ;) )

Comments

  • daboozdabooz Member Posts: 17
    I just tried it and it works for me. Is coinbase set within the eth object? If you try just "eth" you should see the coinbase attribute's value displayed. If it's not set, I think miner.setEtherbase(
    ) will set it for you. Also, if you just start mining; miner.start() it will choose the first address in eth.accounts and assign it as the coinbase.....I think. I'm new to this myself.
  • julius_nageljulius_nagel Hamburg, GermanyMember Posts: 9
    No, unfortunately its still not working
  • julius_nageljulius_nagel Hamburg, GermanyMember Posts: 9
    I am also getting this:


    I0825 19:39:10.153662 9396 downloader.go:254] Synchronisation failed: hash fetching canceled (requested)
    I0825 19:39:16.058245 9396 chain_manager.go:778] Bad block #116525 (ec46ee8db536b9bfe6c0721c9d98e231c9b4731acf60ae6e74f41645ad0354ac)
    I0825 19:39:16.058288 9396 chain_manager.go:779] gas used error (2625335 / 2625969)
  • julius_nageljulius_nagel Hamburg, GermanyMember Posts: 9
  • StephanTualStephanTual London, EnglandMember, Moderator Posts: 1,282 mod
    Hi Julius, to check the balance of all your accounts at the same time, you can paste the following in the console:
    function cab() { 
    	var i =0; 
    	eth.accounts.forEach( function(e){
        		console.log("  eth.accounts["+i+"]: " +  e + " \tbalance: " + web3.fromWei(eth.getBalance(e), "ether") + " ether"); 
    	i++; 
    	})
    };
    
    Then invoke the function by typing cab(), also at the console.

    I hope this helps! Let us know how you get on.
  • julius_nageljulius_nagel Hamburg, GermanyMember Posts: 9
    That worked, thanks a lot Stephan
Sign In or Register to comment.