Headers-First Synchronization Coming Soon to Bitcoin Core

Advertisement

Software gearsBitcoin developer Pieter Wuille posted a request for review and testing of a large change that he’s been working on for Bitcoin Core: headers-first synchronization.

The change has been in the works for about a year and will, hopefully, be released in 0.10 within the next month or two. It affects the way the best chain is discovered, downloaded and verified.

This mode of operation has been known for years, but it took a long time to implement.

The code works by replacing the single-peer blocks download by a single-peer headers download (which typically takes seconds/minutes) and verification, and simultaneously fetching blocks along the best known headers chain from all peers that are known to have the relevant blocks. Downloading is constrained to a moving window to avoid unbounded unordering of blocks on disk (which would interfere with pruning later).

At the protocol level, it increases the minimally supported version for peers to 31800 (corresponding to bitcoin v3.18, released in December 2010) as earlier versions did not support the getheaders P2P message.

The code is available as a github pull request or in a package, where you can also find binaries to test with.

Advantages

  • Parallel block downloading (much faster sync on typical network connections).
  • No more stalled downloads.
  • Much more robust against unresponsive or slow peers.
  • Removes a class of DoS attacks related to peers feeding you low-difficulty valid large blocks on a side branch.
  • Reduces the need for checkpoints in the code.
  • No orphan blocks stored in memory anymore (reducing memory usage during sync).
  • A major step towards an SPV mode using the reference codebase.

See the related discussion on Reddit and Bitcointalk.

Images from Shutterstock.

Get Exclusive Crypto Analysis by Professional Traders and Investors on Hacked.com. Sign up now and get the first month for free. Click here.

Advertisement