Stride Node State Sync

By otomatis | pramonoutomo | 9 Aug 2022


If you have not follow my tutorial on https://www.publish0x.com/pramonoutomo/stride-node-setup-xjromjm
i use Contabo and Vultr for most of my testnet (also for some mainnet nodes)

With fast synchronization, the node downloads all application data from genesis and validates it. With state synchronization, your node will download data related to the head or near the head of the chain and check the data. This results in significantly shorter network connection times. While state synchronization runs continuously in the background to provide nodes with fragmented data during bootstrapping.


First, we need to stop the stride services

sudo systemctl stop strided

Then doing a reset

strided tendermint unsafe-reset-all --home $HOME/.stride

Adding new SNAP

SEEDS=""; \
PEERS="[email protected]:26656,0f45eac9af97f4b60d12fcd9e14a114f0c085491@stride-library.poolparty.stridenet.co:26656"; \
sed -i.bak -e "s/^seeds *=.*/seeds = \"$SEEDS\"/; s/^persistent_peers *=.*/persistent_peers = \"$PEERS\"/" $HOME/.stride/config/config.toml
wget -O $HOME/.stride/config/addrbook.json "https://raw.githubusercontent.com/StakeTake/guidecosmos/main/stride/STRIDE-TESTNET-2/addrbook.json"
SNAP_RPC="http://stride.stake-take.com:26657"
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)

Check for latest height and your nodes height

echo $LATEST_HEIGHT $BLOCK_HEIGHT $TRUST_HASH

make sure latest height is more than your block height, so your nodes will reach (sync).

 

Edit some configuration on config.toml file

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/.stride/config/config.toml

 

Restart stride service

sudo systemctl restart strided

 

**if you need to check your nodes log, you can run:

journalctl -u strided -f -o cat

 


[update] Snapshot 144818 block 1.1gb


Stop stride service

sudo systemctl stop strided

Reset the file and folders needed

strided tendermint unsafe-reset-all --home $HOME/.stride

Pruning, download blocks data, remove the zip downloaded after unzip process

pruning="custom"
pruning_keep_recent="100"
pruning_keep_every="0"
pruning_interval="10"
sed -i -e "s/^pruning *=.*/pruning = \"$pruning\"/" $HOME/.stride/config/app.toml
sed -i -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \"$pruning_keep_recent\"/" $HOME/.stride/config/app.toml
sed -i -e "s/^pruning-keep-every *=.*/pruning-keep-every = \"$pruning_keep_every\"/" $HOME/.stride/config/app.toml
sed -i -e "s/^pruning-interval *=.*/pruning-interval = \"$pruning_interval\"/" $HOME/.stride/config/app.toml
cd
wget -O $HOME/.stride/config/addrbook.json "https://raw.githubusercontent.com/StakeTake/guidecosmos/main/stride/STRIDE-TESTNET-2/addrbook.json"
rm -rf ~/.stride/data; \
wget -O - http://144.76.224.246:8000/stride.tar.gz | tar xf -
mv $HOME/root/.stride/data $HOME/.stride
rm -rf $HOME/root

Restart Service

sudo systemctl restart strided

 

**if you need to check your nodes log, you can run:

journalctl -u strided -f -o cat

 

To check your block status

strided status 2>&1 | jq .SyncInfo

 

 

How do you rate this article?

2



pramonoutomo
pramonoutomo

Hey it's pram here, join my universe https://youtube.com/c/pramonoutomo and https://twitter.com/pramonoutomo also don't forget to check out my portofolio on https://pramonoutomo.com

Send a $0.01 microtip in crypto to the author, and earn yourself as you read!

20% to author / 80% to me.
We pay the tips from our rewards pool.