What is Geth's "light" sync, and why is it so fast?

  • This question is in a similar vein to the past questions about geth --fast and parity --warp.

    There was a recent question where the OP wanted to do as little syncing as possible, and one of the answers suggested the following:

    Try geth --light, available since v1.5.2 . Syncs in minutes if not seconds.

    How is this possible? What is it actually syncing?

    I just tested the retrieval of events from historical blocks using `geth --light` and the results are a bit unstable - if the historical data has not been synced, the results do not appear. Once the historical data has been synced, the events get presented like a full node `geth`. See the recent question link.

  • I'll take my shot. Experts, please correct me.

    • "Full" Sync: Gets the block headers, the block bodies, and validates every element from genesis block.

    • Fast Sync: Gets the block headers, the block bodies, it processes no transactions until current block - 64(*). Then it gets a snapshot state and goes like a full synchronization.

    • Light Sync: Gets only the current state. To verify elements, it needs to ask to full (archive) nodes for the corresponding tree leaves.

    EDIT (*) in newer version of geth it's -64

    fsMinFullBlocks        = 64              // Number of blocks to retrieve fully even in fast sync

    This is little bit related question - I hope your expertise can clear my misunderstand here. I want to build a map of transactions between Ethereum accounts to build a wallet. Does "fast" leave something information out or is the resulting chain data the same as with full sync?

    @MikkoOhtamaa If you have another question, please ask it by clicking the Ask Question button. This thread is about the _light_ mode.

    @MikkoOhtamaa in _fast_ you get the latests state, transaction and receipt tries. But you "lose" old history due to the fact that your node did not perform the validations (i.e. running those transactions to have that information available). For example, you will know your account A has E ether, but if it was due to an old tx, you won't know _why_ you have those ethers.

    When a tree leaves, where does it go? :)

    So, if I use the light version, can I make a token & deploy contracts using that?

    @remedcu Andy Gray says "Yes" here (in the comments)

License under CC-BY-SA with attribution

Content dated before 7/24/2021 11:53 AM