⛓️Sync
We take one node snapshot every day. We then delete all the previous snapshots to free up the space on the file server. The snapshot is designed for node opeartors to run an efficient node on Shentu
Download snapshot | Time: 00:00, 12:00 UTC | db: goleveldb | pruning: 100/0/50 | indexer: null
sudo systemctl stop shentud
cp $HOME/.shentud/data/priv_validator_state.json $HOME/.shentud/priv_validator_state.json.backup
sudo rm -rf $HOME/.shentud/data && sudo mkdir $HOME/.shentud/data
SNAP_NAME=$(curl -s https://snapshots.nodesphere.net/shentu/ | egrep -o ">shentu-2.*lz4" | tr -d ">" | sort -V | tail -n 1)
curl -o - -L https://snapshots.nodesphere.net/shentu/${SNAP_NAME} | lz4 -c -d - | tar -x -C $HOME/.shentud/data
mv $HOME/.shentud/priv_validator_state.json.backup $HOME/.shentud/data/priv_validator_state.json
sudo systemctl restart shentud && sudo journalctl -u shentud -fState Sync
If you don't want to wait for a long synchronization you can use:
sudo systemctl stop shentud
cp $HOME/.shentud/data/priv_validator_state.json $HOME/.shentud/priv_validator_state.json.backup
shentud tendermint unsafe-reset-all --home $HOME/.shentud
peers="[email protected]:14656"
SNAP_RPC="https://shentu-rpc.nodesphere.net:443"
sed -i.bak -e "s/^persistent_peers *=.*/persistent_peers = \"$peers\"/" $HOME/.shentud/config/config.toml
LATEST_HEIGHT=$(curl -s $SNAP_RPC/block | jq -r .result.block.header.height);
BLOCK_HEIGHT=$((LATEST_HEIGHT - 2000));
TRUST_HASH=$(curl -s "$SNAP_RPC/block?height=$BLOCK_HEIGHT" | jq -r .result.block_id.hash)
echo $LATEST_HEIGHT $BLOCK_HEIGHT $TRUST_HASH && sleep 2
sed -i.bak -E "s|^(enable[[:space:]]+=[[:space:]]+).*$|\1true| ;
s|^(rpc_servers[[:space:]]+=[[:space:]]+).*$|\1\"$SNAP_RPC,$SNAP_RPC\"| ;
s|^(trust_height[[:space:]]+=[[:space:]]+).*$|\1$BLOCK_HEIGHT| ;
s|^(trust_hash[[:space:]]+=[[:space:]]+).*$|\1\"$TRUST_HASH\"| ;
s|^(seeds[[:space:]]+=[[:space:]]+).*$|\1\"\"|" $HOME/.shentud/config/config.toml
mv $HOME/.shentud/priv_validator_state.json.backup $HOME/.shentud/data/priv_validator_state.json
sudo systemctl restart shentud && sudo journalctl -u shentud -fLast updated