StateSync Configuration
Run the following commands on your server to configure StateSync for The JayNetwork.
1. Stop Service and Backup
sudo systemctl stop jaynd
cp $HOME/.jaynd/data/priv_validator_state.json $HOME/.jaynd/priv_validator_state.json.backup
2. Reset Chain Data
# CometBFT
jaynd comet unsafe-reset-all --home $HOME/.jaynd --keep-addr-book
# Tendermint (legacy)
# jaynd tendermint unsafe-reset-all --home $HOME/.jaynd --keep-addr-book
3. Configure StateSync
SNAP_RPC="https://jay-rpc.codeblocklabs.com"
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=$LATEST_HEIGHT"
echo "BLOCK_HEIGHT=$BLOCK_HEIGHT"
echo "TRUST_HASH=$TRUST_HASH"
4. Apply StateSync Settings
SNAP_RPC="https://jay-rpc.codeblocklabs.com"
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)
sed -i.bak "/\[statesync\]/,/^enable =/ s/=.*/= true/" \
-e "/^rpc_servers =/ s|=.*|= \"$SNAP_RPC,$SNAP_RPC\"|" \
-e "/^trust_height =/ s|=.*|= $BLOCK_HEIGHT/" \
-e "/^trust_hash =/ s|=.*|= \"$TRUST_HASH\"/" $HOME/.jaynd/config/config.toml
5. Restart Service
sudo systemctl restart jaynd
sudo journalctl -u jaynd -f -o cat
After restarting, check the logs to confirm the node is syncing via StateSync. You should see logs indicating state sync is in progress.
CodeBlockLabs