State Sync

Chain ID: swisstronik_1291-1

Stop the service and reset the data

Copy

sudo service swisstronik stop
cp $HOME/.swisstronik/data/priv_validator_state.json $HOME/.swisstronik/priv_validator_state.json.backup
swisstronikd tendermint unsafe-reset-all --keep-addr-book --home $HOME/.swisstronik

Get and configure the state sync information

Copy

#!/bin/bash

# check this one for changes
SNAP_RPC="https://rpc.testnet.swisstronik.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)

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\"|" $HOME/.swisstronik/config/config.toml

Grant user the privilege to execute script and then run the script:

Copy

chmod 700 state_sync.sh
./state_sync.sh

Restart the node:

Copy

sudo service swisstronikd start

If everything goes well, your node should start syncing within 10 minutes.

Last updated