How can I get a geth node to download the blockchain quickly?
EDIT: Latest Geth now defaults to cache=1024, so if you have more RAM you can try increase the cache.
--fastbut you probably also need
--cache=1024. Without it, you are running with the default which is
A 50% speed increase is possible just by increasing the cache.
If you are starting from the beginning, use:
geth --fast --cache=1024
If you already have some of the blockchain, use:
Depending on your RAM, you can also try with higher values, like
If you are using the geth client, there are some things you can do to speed up the time it takes to download the Ethereum blockchain. If you choose to use the --fast flag to perform an Ethereum fast sync, you will not retain past transaction data.
You cannot use this flag after performing all or part of a normal sync operation, meaning you should not have any portion of the Ethereum blockchain downloaded before using this command. See this Ethereum Stack.Exchange answer for more information.
Below are some flags to use when you want to sync your client more quickly.
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.
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.
Is there any update on how long the command `geth --fast --cache=1024` should take and how much space it should take up for Sept '17? Its been running for about 18 hours on my mac and has already taken up 20GB
from latest geth documentation: --cache value Megabytes of memory allocated to internal caching (default: 1024)
Since Geth version 1.6.0, use of --fast flag has become deprecated, you should now use --syncmode=fast
@BarneyChambers, blockwala, and others: Thank you. This has also been converted to a wiki to make it easier for anyone to update.
geth removedb can be used to nuke the database. It shouldn't affect the keystore, but make a backup of the data directory first anyway
In my case, -fast appears to have no consequences and geth complains: I0508 13:29:49.476026 30960 handler.go:92] blockchain not empty, fast sync disabled
There are 2 ways using
geth, that i am aware of
1. sync with the
--fastyou can start with
geth --fastwhich Enables fast syncing through state downloads
importcommand in geth to do this, you need an already synced blockchain from geth and it has to be exported with
geth export filename, which can be imported to
geth import filename
To synchronize geth the fastest way, i recommand to use geth 1.4.6. Older versions are way slower.
Spoiler: HDD synch is very slow.
There are two modes for synchronization:
- geth --fast --cache 1024 --jitvm: this method is very fast on powerful computer (25min on my system i7 quad core 16Go, SSD and Gbit/s bandwidth). It uses 4.5GB on disk
- geth --cache 1024 --jitvm: this method is slower (3h on my system i7 quad core 16Go, SSD and Gbit/s bandwidth). It uses 21GB on disk
Tip 1: If you have already a geth synchronized on a computer, you could backup the chaindata directory and copy it for another computer. I check on OS X, Linux and Windows (all in 64bits version).
Tip 2: The export/import method works. The import duration is very long because it checks all transactions.
Tip 3: If you have enough RAM and no SSD, use your RAM as ramdisk and select your ramdisk with the --datadir option. You need 4.2GB for a fast synch. When the synch is completed, copy the directory chaindata on its original place:
- ~/.ethereum on linux
- ~/Library/Ethereum on os x
- %APPDATA%\Ethereum on Windows
I have made many benchmarks on different versions for this question: How much faster is it to sync with --jitvm?
Note 1: if you use a HDD, it seems that the synchronization is slower. The fast method was 4h on my system.
Note 2: RAMDiskCreator on OS X is a freeware to create a RAM Disk.
jitvm and cache options have a minor impact on my bench
in Geth 1.7.3, `--fast` is deprecated and `--jitvm` is removed. Do we need alternative flags?
3. sync on a fast machine and copy chaindata directory to your slow machine The chaindata is portable across architectures. So, sync, stop the node cleanly, transfer the chaindata directory (replacing your old one), and start the node on another machine. To minimize risk, use identical versions of geth on both machines. (I did this for x86_64 -> armv7h successfully with Geth 1.4.5, others did too.)