21

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?

7 Answers 7

13

geth saves its internal states for the main network in the chaindata directory. You can find it in the directory:

  • ~/.ethereum on linux
  • ~/Library/Ethereum on OS X
  • ~/AppData/Roaming/Ethereum

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:

  • i uses chaindata archives only between my computers.
  • import is very slow, check all and saves all states.
  • geth --fast is faster and saves only current states.
9

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.

1
  • Has anyone else tried this? Just simple copy/paste the files? Commented Apr 25, 2016 at 4:58
4

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.

2
  • i was enthusiastically that there is an import function - only to be now depressed that i will take forever. Why is there even a import-function in gods name?!
    – Gewure
    Commented Jun 30, 2017 at 17:11
  • "i would definitely try to just copy the chaindata as it should work too and should save a lot of time" - I had the same problem when tried to start my node quickly. I have tried to download chaindata folder from somewhere and continue to sync but no one shares it via the Internet. After understanding this problem I decided to create my own solution and help others to start their Geth node quickly. And now anyone can download geth chaindata folder here: chaindata.club Commented Jan 3, 2021 at 0:20
3

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.

1

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

1

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.

0

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.

Export and Import the Ethereum Blockchain:

– 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.

from cryptomining-blog.com

5
  • 2
    OP already tried geth import, but the question is about what the difference is between that and simply copying the .ethereum/chaindata folder
    – MrChico
    Commented Feb 23, 2016 at 18:16
  • @MrChico, I've added both options in the answer. There is no change whether its copied or imported, by design.
    – niksmac
    Commented Feb 24, 2016 at 4:03
  • this does not make any difference in my case. downloading takes forever - importing takes forever.^^
    – Gewure
    Commented Jun 30, 2017 at 17:12
  • @Gewure depends on the machine configuration, it will take some time.
    – niksmac
    Commented Jul 1, 2017 at 1:41
  • @niksmac true dat. I was much better off copying the chaindata. else it would took 48 hours..
    – Gewure
    Commented Jul 2, 2017 at 21:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.