State Sync

State Sync allows a new node to join the network by fetching a snapshot of the application state at a recent height instead of fetching and replaying all historical blocks. Since the application state

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

peers="c17c0cbf05e98656fee5f60fad469fc528f6d6de@65.109.25.113:11656,7f7041ab4af1dc5abf917357da3bfdc0bddda5cf@148.113.8.66:26656,641daf5ce170f5f972b0ed641da11ef78c665cc2@65.109.104.70:21066,8df4439ba57a82895245a4b1f49d1e31752c81ad@217.76.50.181:12056,43e9da043318a4ea0141259c17fcb06ecff816af@141.94.73.39:43656,ca328c8c75dbbc9d753ed50a52dfcb02af829a29@85.207.33.76:26656,5a7566aa030f7e5e7114dc9764f944b2b1324bcd@65.109.23.114:11656,33acbad5e87d62df89a498b27f180d3e020ff9f0@65.108.235.238:26656,9a6ecd59ecf02a97edb663ce73fb643d07ec087d@162.19.19.41:26656,59b72c3ef197ee18371a7bf2de5be0065e516843@62.171.148.127:26656,baad62018cd8df43c1de5f9cadfa1323ceea8fbd@162.19.89.43:26656,a535a5e0aa1f4bce4bda25ba80f30af16a84eec7@65.108.108.123:26601,1eecce4c8d741979f955c83a2333ad2ade6cae89@65.108.103.17:26665,d46a5874ad57437936941a1c547800d7d5d21d38@93.115.25.18:56056,a2c831a155e616973df49695878282fb7db3f6ee@57.128.117.103:26656,6cabdecd60b320c9481df4e63678623026283fab@136.243.94.113:26656,e3bd52521309b0958da511188ae863fcf613548b@5.75.182.123:11656,a95320e4abc5f2eaa4183ce41b0c3f180b8bcc4d@138.201.85.176:20156,98ac1de6a0ab481f2d7e6a23a8ab183ba739eece@31.7.196.15:26656,7bb64cb482c0c6869df808a2c0ee7b6c3216079e@94.130.35.35:17656"
SNAP_RPC="https://celestia-testnet-rpc.suntzu.dev:443"

sed -i.bak -e "s/^persistent_peers *=.*/persistent_peers = \"$peers\"/" $HOME/.celestia-app/config/config.toml 

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 && 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/.celestia-app/config/config.toml

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

sudo systemctl restart celestia-appd && sudo journalctl -u celestia-appd -f

Last updated