๐Ÿ“ฅ State Syns

State Sync allows you not to synchronize the entire blockchain database and quickly synchronize the node.

Stop the service and reset the data

sudo systemctl stop celestia-appd
cp $HOME/.celestia-app/data/priv_validator_state.json $HOME/.celestia-app/priv_validator_state.json.backup
celestia-appd tendermint unsafe-reset-all --home $HOME/.celestia-app

Get height and hash

SNAP_RPC=https://celestia-mainnet-rpc.validexis.com:443
LATEST_HEIGHT=$(curl -s $SNAP_RPC/block | jq -r .result.block.header.height)
BLOCK_HEIGHT=$((LATEST_HEIGHT - 1000))
TRUST_HASH=$(curl -s "$SNAP_RPC/block?height=$BLOCK_HEIGHT" | jq -r .result.block_id.hash)
echo $LATEST_HEIGHT $BLOCK_HEIGHT $TRUST_HASH

Download addrbook

wget -O $HOME/.celestia-app/config/addrbook.json https://mainnets1.validexis.com/celestia/addrbook.json

Adding the variables to config.toml

sed -E -i.bak \
  -e "s|^(enable[[:space:]]*=[[:space:]]*).*$|\1true|" \
  -e "s|^(rpc_servers[[:space:]]*=[[:space:]]*).*$|\1\"$SNAP_RPC,$SNAP_RPC\"|" \
  -e "s|^(trust_height[[:space:]]*=[[:space:]]*).*$|\1$BLOCK_HEIGHT|" \
  -e "s|^(trust_hash[[:space:]]*=[[:space:]]*).*$|\1\"$TRUST_HASH\"|" \
  -e "s|^(seeds[[:space:]]*=[[:space:]]*).*$|\1\"\"|" \
  $HOME/.celestia-app/config/config.toml

mv $HOME/.celestia-app/priv_validator_state.json.backup $HOME/.celestia-app/data/priv_validator_state.json

Restart the service and check the log

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

Last updated