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

  • One of the answers to this question suggested using Geth's --fast flag to help quickly synchronise the block data.

    How does the flag work, and how does using it speed up the synchronisation? Are we syncing less data, or are we in some way performing fewer checks on its integrity or source?


    As of Geth version 1.6.0, the --fast flag has become --syncmode=fast (though --fast is also still usable for now).

  • paulmorriss

    paulmorriss Correct answer

    5 years ago

    There's a lot of detail on this PR on github. Here's a quote:

    Instead of processing the entire block-chain one link at a time, and replay all transactions that ever happened in history, fast syncing downloads the transaction receipts along the blocks, and pulls an entire recent state database.

    Why not make --fast the default?

    Because then you lose the state with it. The receipts only say that these actions happened, they don't actually show the results of the executions.

    @VoR0220 loosing state isn't actual the problem. The problem is that when we'd enable `--fast` for *any point in time* we'd open ourself up to attacks where an attacker has an infinite time window in which they can attack the victim in accepting a valid header but with an invalid state. This problem exist also with catching up from scratch, but due to some randomisation we can easily battle this.

    So @JeffreyW. are you saying we should not be using geth --fast for security reasons? I am syncing geth with it right now and I would need to know if I am becoming vulnerable to hackings by doing so.

    Synching from scratch is fine, you are not vulnerable

License under CC-BY-SA with attribution

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