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?
Ethereum Stack Exchange is a question and answer site for users of Ethereum, the decentralized application platform and smart contract enabled blockchain. It only takes a minute to sign up.Sign up to join this community
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 | --------------------------------------------------
.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.
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
admin.importChain('blockchain_backup'), so you can try with them as well, but the first example should be faster.