24

My geth --fast sync is nearly complete, and the balance shows correctly on Etherscan.

I was running geth on linux and haven't synced in a while, so I deleted the chaindata and updated the wallet and started re-syncing with geth --fast. Even after what seemed like a full sync my balance showed 0. I can see the account has more than 0 ether on Etherscan.

I copied my keystore file to a Windows machine and tried Ethereum Wallet, same thing is happening. The last transaction was at about block 3800000, I am synced up to 235 blocks left and still have a 0 balance. The sync is also stuck, can't seem to get the last 235 blocks, but my balance should be showing the full amount right now.

Losing my mind right now, it's a lot of money. Even if my keystore was somehow corrupted, the wallet should still show the balance since that is public info. I also verified I'm on the main network.

2 Answers 2

25

geth --fast has an interesting effect: geth cannot provide any information about accounts or contracts until the sync is fully complete.

Try querying the balance again after eth.syncing returns false.


Why?

The "fast" sync looks nearly complete because the reported current block is based on the best header you have. But that doesn't give you any information about how much of the account state data you have downloaded.

geth can sync the blocks much faster than it can download the state. An excerpt from @karalabe's explanation why:

This trie data structure is an intricate interlink of hundreds of millions of tiny cryptographic proofs (trie nodes). To truly have a synchronized node, you need to download all the account data, as well as all the tiny cryptographic proofs to verify that noone in the network is trying to cheat you. This itself is already a crazy number of data items. The part where it gets even messier is that this data is constantly morphing: at every block (15s), about 1000 nodes are deleted from this trie and about 2000 new ones are added. This means your node needs to synchronize a dataset that is changing 200 times per second. The worst part is that while you are synchronizing, the network is moving forward, and state that you begun to download might disappear while you're downloading, so your node needs to constantly follow the network while trying to gather all the recent data. But until you actually do gather all the data, your local node is not usable since it cannot cryptographically prove anything about any accounts.

6
  • 3
    Yup, it had to finish syncing 100%. It's all there now, thanks!
    – user17499
    Commented Aug 18, 2017 at 21:36
  • Once it reaches 100%.. and a new block is mined, then it's out of sync again?
    – user22075
    Commented May 15, 2018 at 18:52
  • @quantumpotato no, it only has to complete the first time. But yes, technically, you're always looking at data that might be old, if you haven't received the latest block yet. But at least it won't be empty data.
    – carver
    Commented May 15, 2018 at 19:58
  • @carver I don't understand how syncing to say, block 1000 then getting new blocks and resyncing = geth stays readable. But if the block number is 2000 and increasing and you get up to 2000 and are still behind, you never reach "that first sync" ...
    – user22075
    Commented May 15, 2018 at 20:47
  • @quantumpotato the --fast sync at the beginning is a fundamentally different kind of syncing than the traditional incremental syncing. The how and why is too long to get into in a comment. A new question is probably the best way to get deep into it, if you want.
    – carver
    Commented May 16, 2018 at 16:00
0

the key is:

  1. make your memory big enough . e.g. 24GB. usually 32GB is enough. If momery leak and Geth got broken, the block chain data will be never synchronized correctly after Geth restart.

  2. remove old folder without hesitate.

my environment: ubuntu 16, memory 24GB. running a Geth node and a Bitcoind node. When I was using the server of 16GB memory, geth is in the hell of syncing ... When I increased the memory, it sync successfully in 6-8 hours.

2
  • Shit. I'm renting a server from Digital Ocean. I don't think it can handle this.
    – user22075
    Commented May 15, 2018 at 20:21
  • use google cloud. very handful
    – Siwei
    Commented May 16, 2018 at 2:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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