16

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?

11

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

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.

  • Has anyone else tried this? Just simple copy/paste the files? – Jose Llausas Apr 25 '16 at 4:58
3

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.

  • 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 Jun 30 '17 at 17:11
2

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.

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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