How to download the entire BTC blockchain in 24h

I recently wanted to set up a Bitcoin Full Node and therefore checked beforehand how big the blockchain actually is: over 420 GB.

Since this is a considerable size, I researched the fastest way to get the blockchain on my PC and in fact I didn't find a single piece of information that was relatively new. Even the official Bitcoin documentation still mentions around 200 GB and that it could take several weeks depending on the device.

Then I found another website that offers full node dumps to speed up the process:
https://blockchair.com/dumps#nodes
The problem: The download is limited to 100 kbit/s, so the download takes more than a month.

I imagine there are enough other people asking the same question, which is why I'm writing this post.

Since I couldn't find any useful NEW info on the internet, and the blockchain dumps I found take too long to download, I took it into my own hands and played around with bitcoind's parameters.

My setup:
OS: Fedora Linux 36
CPU: AMD Ryzen 7 2700X
Memory: 32GB
External Disk: Samsung Portable SSD T7 (1 TB)
Bandwidth: max. 50 MBit/s (mobile internet)

My goal:
To download the entire blockchain to the external SSD including creation of all available indices for development purposes (you don't need them to just run a full node).

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

Of course, the command and the resulting performance only refers to my setup. You'll definitely need to adjust the -dbcache parameter if you don't have 32GB of RAM available. The -dbcache parameter is set in MB and can be between 4 and 16384.
After downloading the blockchain, you can set the parameter back to the default value by simply removing the parameter.
Furthermore, you will definitely get even better performance if you remove the index parameters - if you don't need them for any development purposes, feel free to remove the parameters from the command.

Finally, an explanation of my used parameters for completeness:
-datadir=<dir>
Specify data directory. This specifies the whole ".bitcoin" data directory, so if you e.g just want to have the "blocks" subdir on a different location, you have to use -blocksdir. There are a few more dirs to set if you want, just look in the --help of bitcoind

-blockfilterindex=<type>
Maintain an index of compact filters by block (default: 0, values: basic). If <type> is not supplied or if <type> = 1, indexes for all known types are enabled. Only set this for development purposes - it's not needed if you just want to run a full node.

-txindex
Maintain a full transaction index, used by the getrawtransaction rpc call (default: 0). Only set this for development purposes - it's not needed if you just want to run a full node.

-coinstatsindex
Maintain coinstats index used by the gettxoutsetinfo RPC (default: 0). Only set this for development purposes - it's not needed if you just want to run a full node.

-dbcache=<n>
Maximum database cache size <n> MiB (4 to 16384, default: 450). In addition, unused mempool memory is shared for this cache (see -maxmempool).

-daemon
Run in the background as a daemon and accept commands (default: 0). If you run it as a daemon, you can check the progress in the debug.log in the .bitcoind dir.

I hope I can help some searchers with this post. If you managed to get even more performance with further tweaks, please write in the comments, I would be very interested to know!



Submitted August 24, 2022 at 01:18PM by ohdonpier https://ift.tt/zJpv6Hi

Comments

Popular posts from this blog

Coinmarketcap are listing BCH sites as BTC

15 years of BTC Power Law