geth --gcmode

本文探讨了在Geth中使用--gcmode=archive选项的意义,解释了归档模式如何保存智能合约的所有状态变化及账户余额历史,对比了其他同步模式下状态修剪的限制。归档模式确保了所有历史数据的保留,允许用户通过提供特定区块号调用web3.eth.call来访问过去的状态。

What is `--gcmode=archive` in geth

Ask Question

1

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?

 

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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值