Snapshots

State sync (script)

Below you will find a script which will reset the node and setup state syncing

Important: if you’re doing a state sync on your validator node, backup your validator key!

By running this command on your server’s terminal, the latest version of the script is downloaded and run immediately (there are prompts which you need to confirm before anything is done):

bash <(wget -qO- https://raw.githubusercontent.com/ech-world/ech-state-syncer/main/state-sync.sh)

You can view the script source code by opening the above GitHub link in a browser, version history can be reviewed in GitHub repo

Import snapshot (script)

Below you will find a script which downloads and deploys the latest snapshot of Echelon node’s data folder

By running this command on your server’s terminal, the latest version of the script is downloaded and run immediately (there are prompts which you need to confirm before anything is done):

bash <(wget -qO- https://raw.githubusercontent.com/ech-world/ech-snapshot-importer/main/import-snapshot.sh)

You can view the script source code by opening the above GitHub link in a browser, version history can be reviewed in GitHub repo

Import snapshot (manually)

Alternatively you can just download the latest snapshot and deploy it manually (you can also download the script that was used above and open it in a text editor or browse for picking up needed steps and instructions)

To help your node connect to healthy peers quickly, it is also recommended to download an up-to-date address book

By running this command on your server’s terminal, the latest snapshot is downloaded:

wget https://ech.world/latest/ech-snapshot-height_4995030-date_2023-03-29.tar.gz

Address Book

To quickly connect to healthy peers, running the command below in your node’s .echelond/config folder, downloads an up-to-date address book (existing addrbook.json is overwritten so make a backup of it first if you want to retain it for safety)

wget https://ech.world/latest/addrbook.json -O addrbook.json

Disclaimer

Please notice that using the scripts is totally on your own responsibility. I’ve done my best to make them safe and reliable but it’s an MIT licensed release, I am not liable if something unexpected happens that you don’t like. Follow backup precautions when running the scripts


What the heck is a ‘snapshot’?

A snapshot is a saved state at a given time. When talking about blockchains, a snapshot usually means a backup of the node’s data folder. If you’re running a node, best case would be to make regular backups of the data folder because there’s always the possibility of database corruption and when it happens, you need a working state to revert back to.

If you don’t have any working backup, in case of a failure, your database will be essentially empty and you will need to sync your node from the first block to current height which might take a long time to finish.

ech.world saves a snapshot daily and the latest snapshot can be downloaded and taken into use by anyone.

Do I need a snapshot?

You might need a snapshot for example in these cases:

  • You want to start a new validator node
  • Your existing node fails temporarily or permanently and you need a node online as soon as possible

One thing to notice is that if you use a snapshot that doesn’t have indexing data included (ech.world snapshots are like this, to keep the file size reasonable), you or anyone querying your node doesn’t have the access to historical block data. It’s not mandatory to have this historical data to validate. But it’s good to keep this in mind if you’re planning on serving data endpoints to other people who might be running RPC queries against your node and would expect to have that historical data available.

If you’re only planning on validating and don’t care about the possibility to query historical block data from your node, then using a snapshot is totally fine and speeds up your setup process considerably. On the other hand if you do need that historical data, then you should not use a snapshot but instead sync your node from the first block onwards with indexing enabled (it is enabled by default).