[Ethereum] web3.eth.getBalance returns always zero

balancessynchronization

I have an ether account (whose details I prefer not to disclose here). I can confirm in etherchain.org that it has the correct amount of funds. I can also check that the funds were transferred in block 3639426

I am running geth on my linux desktop with the plain command

geth

i.e. no "-fast" or nothing enabled. At the moment:

 currentBlock: 3953293,
 highestBlock: 4161833,
 knownStates: 62693,
 pulledStates: 58536,
 startingBlock: 3914231

So, at this stage I should be able to check the balance of my account also from geth console using

web3.eth.getBalance("..")

.. right?

However, I get zero all the time.

Starting to feel cold sweat: I think I've been screwed.. just don't know how! Why I'm getting zero balance?

A Bonus question: what's the essence of "startingBlock" ?

** EDIT **

Phew.. using any account gives me a zero. So, is it so that the blockchain must be downloaded completely before checking account balances works .. ? I guess so.

** EDIT EDIT **

OK, it's finally synchronized & everything works as expected. .. I am using

Geth/v1.7.0-unstable-6ca59d98/linux-amd64/go1.8.3

I wonder if "-fast" is now the default..?

Best Answer

When doing a sync with geth --fast, you will not get any state information until the sync is fully complete. A slow sync will give you incremental state along the way, but take significantly longer.

Related Topic