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?

Edit:

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

up vote 58 down vote accepted
+100

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.

  • 6
    Why not make --fast the default? – Aakil Fernandes Feb 8 '16 at 19:46
  • 3
    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 Feb 13 '16 at 3:53
  • 6
    @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. – Jeffrey W. Apr 21 '16 at 8:42
  • 3
    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. – Vesa May 17 '16 at 3:20
  • 2
    Synching from scratch is fine, you are not vulnerable – Jeffrey W. May 17 '16 at 6:46

As --fast is often the only thing associated with a fast sync, don't forget --cache too.

From the Homestead Guide:

Below are some flags to use when you want to sync your client more quickly.

--fast

This flag enables fast syncing through state downloads rather than downloading the full block data. This will also reduce the size of your blockchain dramatically. NOTE: --fast can only be run if you are syncing your blockchain from scratch and only the first time you download the blockchain for security reasons. See this Reddit post for more information.

--cache=1024

Megabytes of memory allocated to internal caching (min 16MB / database forced). Default is 16MB, so increasing this to 256, 512, 1024 (1GB), or 2048 (2GB) depending on how much RAM your computer has should make a difference.

protected by Afri May 15 '17 at 9:07

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.