5

getBalance() is not working after fast sync as it queries too far into history, is there a way to rebuild all the states without redownload of all the blocks?

  • @eth you might want to read up on the official api, you can find out the balance at any block you specify :) github.com/ethereum/wiki/wiki/JavaScript-API#web3ethgetbalance but it does not work far into history when --fast is used since early states are not constructed. – user1817 May 2 '16 at 6:23
  • @abc it seems you created two accounts. – Afr May 2 '16 at 21:00
6

The only way to have past intermediate state is to do full block imports without fast sync (i.e. act as an archive node). There's no way to generate your requested data without reprocessing all the blocks.

PS: You don't necessarily need to redownload the chain, you could export it with geth export chain.dat and then geth --datadir=somehwere-else import chain.dat. But in general sync time is limited currently by import/processing time, not download bandwidth, so it won't make much of a difference.

  • yes that works. thanks. was having problem syncing without --fast – user1817 May 2 '16 at 14:21
1

No, there is no way if have deleted the old chaindata folder.

And getBalance is supposed to work even the state is saved in the very first block.

However if you still have the old chain data folder you can replace it to get the old state.

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.