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?
Asked
Active
Viewed 1,166 times
5
-
@eth you might want to read up on the official api, you can find out the balance at any block you specify :) https://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. – May 02 '16 at 06:23
-
@abc it seems you created two accounts. – q9f May 02 '16 at 21:00
2 Answers
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.
Péter Szilágyi
- 10,436
- 39
- 42
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.
niksmac
- 9,673
- 2
- 40
- 72