Comment on page
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:
sudo apt install lz4
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.
systemctl stop mantrachaind
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 uppriv_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.
backup
cp $HOME/.mantrachain/data/priv_validator_state.json /some/safe/location
reset
mantrachaind tendermint unsafe-reset-all --home $HOME/.mantrachain --keep-addr-book
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 thepriv_validator_state.json
file that you have backed up.
cp /some/safe/location/priv_validator_state.json $HOME/.mantrachain/config/priv_validator_key.json
systemctl start mantrachaind
journalctl -xefu mantrachaind
If everything is good you can delete the snapshot file to free up space.