How do I restore a node from a snapshot?

Restoring a node from a snapshot allows the node avoid resyncing from genesis by resyncing from the last known validated block saved in the snapshot.

Assuming you have access to a previously saved snapshot, the steps are as follows:

Install lz4

sudo apt install lz4

Download the snapshot

Assuming the snapshot is available at some online location, use wget to retrieve the snapshot file.

wget https://<location of snapshot>

Alternatively, copy the file to the local node server using whatever other preferred means.

Stop the node

systemctl stop mantrachaind

Reset the node

This will erase your node database. If you are already running validator, be sure you backed up your priv_validator_key.json prior to running the the command. The command does not wipe the file. However, you should keep a backup of this file in a safe location.

WARNING: If you use this snapshot on a validator node during a chain halt, make sure you back up priv_validator_state.json and then replace it after the snapshot is extracted but before you start the node process. This is very important in order to avoid double-signing.


cp $HOME/.mantrachain/data/priv_validator_state.json /some/safe/location


mantrachaind tendermint unsafe-reset-all --home $HOME/.mantrachain --keep-addr-book

Extract the snapshot

lz4 -c -d mantrachain_XXXXXXX.lz4 | tar -x -C $HOME/.mantrachain

IMPORTANT: If you run a validator node and the chain is in halt, it is time to replace the priv_validator_state.json file that you have backed up.

cp /some/safe/location/priv_validator_state.json $HOME/.mantrachain/config/priv_validator_key.json

Start the node

systemctl start mantrachaind

Verify the node is running

journalctl -xefu mantrachaind

If everything is good you can delete the snapshot file to free up space.

Last updated