0

I start geth without setting gcmode=archive at the beginning. But when i realized that if i want to get all the internal transactions in ethereum blockchain, geth has synced at the blockheight of 9300000. I restart geth adding gcmode=archive. But i could only get internal transaction after that with debug.traceTransaction. Is restarting geth from genesis with syncmode=full and gcmode=archive the only way to get internal transaction with debug.traceTransaction in the old block?

Can I avoid synchronizing from blockheight 0? Will setting gcmode=archive begin to get old block state after syncing the highest block?

0

gcmode=archive only collects block data forward from the point at which it was enabled. There's no way for it to go backwards.

When you do a fast sync, you download the block data for every block (this includes block headers, transactions, and transaction receipts). Once you get to recent blocks, you start downloading the state trie data for those blocks; this can be verified against the state trie root stored in the block header, so nobody can send you bad information. Once you're synced, your node has all of the block data, and state data for recent blocks.

Then you start acting as a peer for other nodes, sending them block data and recent state (though in practice you might have been sending peers data before you had everything yourself). Obviously, you can only send peers information you have; if a peer asks you for six month old state data, you can't send it to them if you just synced in the last week yourself.

So you can't start a node based on the state six months ago - you wouldn't be able to reliably find peers who could serve that state to you. Your options are to start a node based on the current state, or process every block yourself to build up the complete history. You can get the state of the genesis block and process each successive block to get the full state at any point in time, but there's no way to skip around. If you don't have the state for block 4,999,999 you can't process block 5,000,000.

| improve this answer | |

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.