Skip to content

Instantly share code, notes, and snippets.

@bensig
Created March 3, 2023 20:02
Show Gist options
  • Save bensig/d3dedd2ef960e1dfbe7960aa0043ff41 to your computer and use it in GitHub Desktop.
Save bensig/d3dedd2ef960e1dfbe7960aa0043ff41 to your computer and use it in GitHub Desktop.
Fast Sync Bitcoin Node - 3 Options

Option 1 - Use This Bitcoin Fast Sync Command

There is no torrent which would be faster than just using the Bitcoin network "hive" - which is huge. There may be a way to sync using local or low-latency nodes nearby, but any time you specify which nodes you sync from - it introduces risk.

Very good to have a fast CPU and lots of RAM, SSD is not as important as RAM.

With this command I was able to download the entire blockchain and create all indices in almost exactly 24 hours:

bitcoind --datadir=<path-to-external-ssd> -blockfilterindex=1 -txindex=1 -coinstatsindex=1 -dbcache=16384 -daemon If you have 32GB of RAM, you can use 32768 for dbcache

https://www.reddit.com/r/Bitcoin/comments/wwdrmu/how_to_download_the_entire_btc_blockchain_in_24h/

Option 2 - Copy data from a (trusted) node over rsync SSH - not as safe as option 1:

Another option is to copy the directories from another node that is synchronized with the index you need:

Make sure old data is removed:

sudo rm -rf ./bitcoin/blocks
sudo rm -rf ./bitcoin/chainstate
sudo rm -rf ./bitcoin/indexes

Copy the blocks and chainstate folders from your existing node to ~/.bitcoin/

For example (fill in with your own IP / FQDN and path for SSH):

sudo rsync -aP [email protected]:~/.bitcoin/blocks ~/.bitcoin/
sudo rsync -aP [email protected]:~/.bitcoin/chainstate ~/.bitcoin/
sudo rsync -aP [email protected]:~/.bitcoin/indexes ~/.bitcoin/

Option 3 - Copy data to and from a (trusted) node using an external SSD:

Copy fully sync'd node to external drive

sudo rsync ~/.bitcoin/blocks /mnt/externaldrive/.bitcoin/
sudo rsync ~/.bitcoin/chainstate /mnt/externaldrive/.bitcoin/
sudo rsync ~/.bitcoin/indexes /mnt/externaldrive/.bitcoin/

Copy from external drive to node

sudo rsync /mnt/externaldrive/.bitcoin/blocks ~/.bitcoin/
sudo rsync /mnt/externaldrive/.bitcoin/chainstate ~/.bitcoin/
sudo rsync /mnt/externaldrive/.bitcoin/indexes ~/.bitcoin/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment