I have used --gcmode=archive
to download all the state tries and eth.syncing
returns false
meaning my node is in sync. When I execute eth.getBalance
for blocks closer to the current block I obtain the correct value but for older blocks I get "Error: missing trie node"
. Is there any other way of obtaining balance of an account in all the blocks from the genesis block?
You must have launched with --syncmode fast --gcmode archive
. If you did not say any --syncmode
, then it was fast
.
The fast
mode means that it downloads a full state at a recent block, say n
. Then it computes all new states, for blocks n + m
from this full state. archive
means that it will not discard old states, like n
, n+1
as it advances. But it still does not have any state prior to n
.
Which means that:
- you can query
.getBalance(me, n)
andme, n + m
. - you can not query
.getBalance(me, 0)
tome, n - 1
.
If you want to have all states, including prior to the time you launched it, you have to delete your chain data and restart it with -syncmode full --gcmode archive
.
I hope you have a good SSD...
-
Thanks for your answer. Actually I followed the documentation here - blog.ethereum.org/2018/02/14/geth-1-8-iceberg%C2%B9 .. It says that - Trie pruning is enabled on all --syncmode variations (including --syncmode=full). If you are running an archive node where you would like to retain all historical data, you should disable pruning via --gcmode=archive. Anyways I will try with --syncmode full as well. – Sandy... Jul 8 '18 at 15:18
-
Yes, pruning means "removing what exists". What you need is to disable pruning, plus a way to recreate the missing ones -> syncmode – Xavier Leprêtre B9lab Jul 9 '18 at 10:33
--syncmode
did you launch it? – Xavier Leprêtre B9lab Jul 6 '18 at 16:50