11

I have been running a geth node, mostly to see event logs fired by my contracts. I ran the node with syncmode=fast and finally the node is synced. I can successfully read the logs.

Now, I read here the option --gcmode=archive described as:

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.

What does the historical data mean here? Is it more than the normal logs that are created by events fired during transactions? What does it include and when should I use --gcmode=archive?

1 Answer 1

15

Archive mode means that all states of values in smart contracts as well as all balances of an account are stored.

e.g. if the value of a string in a contract changes from XYZ in block 6000000 to ABC in 6000001, you can recall that string's state from block 6000000 with web3.eth.call, providing the blocknumber (as hex value with 0x prefix) as one of the function parameters of this web3 function. This is only possible in archive sync, other syncmodes which prune the past states will have only the latest value available, to be called with the above mentioned function providing "latest" as the blocknumber parameter.

As far as I know, Parity even offers a sync mode where only a defined amount of past states are logged, limiting the size of the synced chain data.

4
  • 2
    So basically it's 'historical data' i.e. the past states of the EVM right?
    – DaveIdito
    Commented Aug 30, 2018 at 0:10
  • 2
    Yes, it's "everything that has ever been" so to say.
    – n1cK
    Commented Aug 30, 2018 at 9:32
  • Are events affected by the gcmode parameter? As far as I understand it, it only affects the states?
    – ivicaa
    Commented Jan 21, 2020 at 22:19
  • Is --gcmode=archive applicable in DAG file 30,000 blocks. In my case after 30,000 blocks, my node will rest and all the balances and contracts will reset too. Commented Aug 25, 2022 at 1:05

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.