Skip to content

XION Statesync

bash
sudo systemctl stop xiond

cp ~/.xiond/data/priv_validator_state.json ~/.xiond/priv_validator_state.json.backup
xiond tendermint unsafe-reset-all --home ~/.xiond

seeds="4f0fd0c68f4141886f2a306e6c64cb191d71ef78@xion-mainnet-1.burnt.com:12656"
persistent_peers="22371d31b93490e1d79899446e73839e9fd4c004@xion-mainnet-1.burnt.com:42656,083eb4d9191e727e0fcce7a73e93863cc0f79fa5@xion-mainnet-1.burnt.com:43656,eb183c6f9c1c44d3c9198415b84e43d74fe84c58@xion-mainnet-1.burnt.com:44656"

sed -i -e "s|^seeds *=.*|seeds = \"$seeds\"|" $HOME/.xiond/config/config.toml
sed -i -e "s|^persistent_peers *=.*|persistent_peers = \"$persistent_peers\"|" $HOME/.xiond/config/config.toml

SNAP_RPC="https://rpc.mainnet.xion.p10node.com:443"
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\"\"|" ~/.xiond/config/config.toml

mv ~/.xiond/priv_validator_state.json.backup ~/.xiond/data/priv_validator_state.json

# restart service
sudo systemctl restart xiond
sudo journalctl -u xiond -f --no-hostname -o cat