I'm trying to sync my RPi 2 with the blockchain.
geth import
runs quite slowly, as well as syncing from scratch.
What would be the problem in just copying the .ethereum/chaindata
folder from another fully synced ethereum node?
geth saves its internal states for the main network in the chaindata directory. You can find it in the directory:
It uses the LevelDB database. You can save this directory only if geth is stopped to prevent corruptions. The data is portable on Linux, Windows and MacOS X (i have checked). But you have to remember that it is not a safe way. Do not use a chaindata archives provided by anonymous. The transactions are not checked! When geth starts, it checks all the files are present. If a .ldb file misses, the chaindata directory is corrupted and you have to remove this directory!
geth import and export is safe but slow because all transactions are checked and the operation is the same as geth without the --fast flag. On my 3720qm, it is 5h and 19Go disk storage used. The only economy is the network download (1.5Go). It is faster to do a geth --fast!
On my intel 3720qm mac mini (1Gbit/s), some benchs geth 1.4:
__________________________________________________
| Operation | Disk Used | Time | Disk Written |
|-------------|-----------|------|---------------|
| geth | 19.Go | 5h00 | 1To |
| geth import | 19.Go | 4h50 | 1To |
| geth --fast | 3.7Go | 1h00 | 100Go |
--------------------------------------------------
On my intel 3720qm mac mini (1Gbit/s), some benchs geth 1.5 (in dev):
__________________________________________________
| Operation | Disk Used | Time | Disk Written |
|-------------|-----------|------|---------------|
| geth --fast | 3.8Go | 17m | 25Go |
| geth | 19Go | 2h | 100Go |
--------------------------------------------------
Conclusion:
Copying the .ethereum/chaindata
folder is a good idea. I've done that on my Rpi2 and everything worked fine. Also, if it's not fully synced on the original machine, the RPi2 will just start syncing from the last block in the copied chaindata folder, thus saving a lot of time.
Note that I never ran geth import blockchain_db
. There was no need. Copying the chaindata
folder was easy and it works.
I exported the full blockchain on 1.088.000 Blocks in 13 min. (1.00 GB) To import it on a Ubuntu 14.04 machine and not bad Hardware it tooks over 8 Hours! So import or fully synch from scratch is not a big difference in time. Starting the console after importing the Blockchain tooks again around 20 min.
It works, but next time i would definitely try to just copy the chaindata
as it should work too and should save a lot of time.
Do a fast sync, that's what it was designed to do :) Wiped your existing chaindata
and run with --fast
, possible try bumping the allotted cache a bit --cache 128
. It should make a world of a difference.
Export 9389279 block takes less than 1 hour.
I used command:
docker run -d --rm -v $PWD/full-ethereum-node:/root/.ethereum ethereum/client-go export /root/.ethereum/geth/chaindata/9389270.backup 0 9389270
But import whole 9389270.backup file is so slow, that it is equal to sync node from genesis block with the network.
The testing environment was: Intel I9 (10 cores), 64 GB RAM, and SSD
I have sync the Ethereum Geth node on my Raspberry PI 4B 8GB with 2TB SSD attached via USB 3.0. It took more than 3 months!
After that, I have created solution, that can help anyone to start an Ethereum Geth node quickly.
Just to download geth chaindata folder via HTTP and continue to sync your own node with defined --datadir
key with pre-downloaded folder.
If you are moving your Ethereum installation over to a different computer or want to have a copy on another system for solo mining for example, aside from a copy of the wallet file you may also want to make a copy of the blockchain, so that the geth client will not need to download the whole thing again from the network.
So here is how you can also export and then import the Ethereum blockchain should you need to do so.
– Run: geth export blockchain_backup
– Copy the blockchain_backup file to the new system
– On the new system run: geth import blockchain_backup
You can also export and import the blockchain data from a geth console mode, however it seems that when ran inside the console it is doing it much slower than the above method. The commands for the Javascript console are admin.exportChain('blockchain_backup')
and admin.importChain('blockchain_backup')
, so you can try with them as well, but the first example should be faster.