Skip to main content

State sync

info

State synchronization enables a new node to seamlessly integrate into the network by retrieving a snapshot of the application state at a recent height, rather than fetching and replaying all historical blocks. Given that the application state is typically more compact than the blocks themselves, and the restoration process is significantly quicker than block replay, this method can drastically diminish the network synchronization duration from days to mere minutes.

Instructions​

Stop the service and reset the data​

sudo systemctl stop axelard
cp $HOME/.axelar/data/priv_validator_state.json $HOME/.axelar/priv_validator_state.json.backup
axelard tendermint unsafe-reset-all --keep-addr-book --home $HOME/.axelar

Get and configure the state sync information​

STATE_SYNC_RPC=https://axelar-dojo-1-rpc.owlstake.com:443
STATE_SYNC_PEER=ade4d8bc8cbe014af6ebdf3cb7b1e9ad36f412c0@135.181.5.219:15156/
LATEST_HEIGHT=$(curl -s $STATE_SYNC_RPC/block | jq -r .result.block.header.height)
SYNC_BLOCK_HEIGHT=$(($LATEST_HEIGHT - 1000))
SYNC_BLOCK_HASH=$(curl -s "$STATE_SYNC_RPC/block?height=$SYNC_BLOCK_HEIGHT" | jq -r .result.block_id.hash)

sed -i \
-e "s|^enable *=.*|enable = true|" \
-e "s|^rpc_servers *=.*|rpc_servers = \"$STATE_SYNC_RPC,$STATE_SYNC_RPC\"|" \
-e "s|^trust_height *=.*|trust_height = $SYNC_BLOCK_HEIGHT|" \
-e "s|^trust_hash *=.*|trust_hash = \"$SYNC_BLOCK_HASH\"|" \
-e "s|^persistent_peers *=.*|persistent_peers = \"$STATE_SYNC_PEER\"|" \
$HOME/.axelar/config/config.toml

mv $HOME/.axelar/priv_validator_state.json.backup $HOME/.axelar/data/priv_validator_state.json

Restart the service and check the log​

sudo systemctl start axelard && sudo journalctl -u axelard -f --no-hostname -o cat