Sync problems with Geth — How to set up Parity quickly
Lately, a lot of people have been having issues with Geth, especially concerning syncing problems which were taking a long time to complete. This article will talk about how to set up a Parity node as an alternative to get a working Ethereum node as quickly as possible.
Step 1 — Set up server
The first step consists of setting up a powerful server so that the sync takes as little time as possible. DigitalOcean provides very good options, but the most important thing is that they charge per hour. So, the idea is to spin a powerful server and install all the necessary software, sync the node, and then transfer all the files and database to a cheaper server.
Server setup:
- Ubuntu 16.04.3 x64
- High Memory — $0.446 per hour
- Choose a data center that you want
- No additional options necessary
- Add your ssh keys for access
- Finally, choose a host name
Step 2 — Install Software
The next step consists of installing the Parity code and also the Geth code to get access to the javascript console which is very handy. Note that the javascript console will then be connected to the Parity node to perform actions.
Install Parity and Geth
You can get all the information you need here but here is a simple breakdown:
$ bash <(curl https://get.parity.io -kL)
To install dependencies:
$ apt-get install openssl libssl-dev libudev-dev
Next install geth:
sudo apt-get install software-properties-common
sudo add-apt-repository -y ppa:ethereum/ethereum
sudo apt-get update
sudo apt-get install ethereum
Step 3 — Run Parity
Steps 3 consists of running Parity for the sync with the following command:
parity — cache-size 62000 — warp — jsonrpc-interface “your-server-ip-here” — jsonrpc-apis “all” — ipc-apis “web3,eth,personal,pubsub,net,parity,parity_pubsub,parity_accounts,traces,rpc,secretstore” — jsonrpc-port “your-json-rpc-port-here” — mode “active” — chain “mainnet” — min-peers 50 — max-peers 200
Some additional notes: you need to replace the IP with your server IP and the port that you want to use for the JSONRPC API. I have set the min-peers to 50. I saw that this increased the speed at which the initial sync took place. You will also see that the cache size has been set to 62k MB which should make full use of the server’s power.
Sync Results
In my results, I saw that the first 95% of the sync went very quickly (in less than 1 hour), but the next 200,000–400,000 blocks took more than 16 hours to complete. The rate was about 1000 blocks per minute, which is very slow when you have that many blocks to sync. However, the speed does change sometimes (for reasons I do not know yet). Of course, the results may differ in your case.
Step 4
Step 4 consists of setting up a less expensive server and use the existing database and files. First stop the parity sync on your server and then copy the contents of the following folder to your new server, at the same location.
~/.local/share/io.parity.ethereum/
You can use linux commands such as scp to copy a folder from one server to another:
scp -r /path/to/file username@a:/path/to/destination
This should rather quickly copy all the files to your new server, especially if you have set up your new server in the same location and same provider, that is, DigitalOcean.
The final step consists of running the parity node on your new server and deleting the first high-powered server. Remember to change your IP in the Parity start command on your new server.
I hope that this will help you in situations you need to set up a node quickly.