🔌State Sync Guide

State Sync allows to sync a node state by fetching a snapshot of the network state at a recent height, instead of fetching and replaying all historical blocks.

Step 1: Stop existing service and reset database

sudo systemctl stop firmachaind
firmachaind tendermint unsafe-reset-all --keep-addr-book

Step 2: Fill variables with data for State Sync

RPC="https://firmachain-rpc.anyvalid.com:26617"
RECENT_HEIGHT=$(curl -s $RPC/block | jq -r .result.block.header.height)
TRUST_HEIGHT=$((RECENT_HEIGHT - 1000))
TRUST_HASH=$(curl -s "$RPC/block?height=$TRUST_HEIGHT" | jq -r .result.block_id.hash)
PEER="e1b6bf686b1da507a36eb982aebbf9a0a372d3af@5.9.87.205:26616"

Step 3: Add variable values to config.toml

sed -i.bak -E "s|^(enable[[:space:]]+=[[:space:]]+).*$|\1true| ; \
s|^(rpc_servers[[:space:]]+=[[:space:]]+).*$|\1\"$RPC,$RPC\"| ; \
s|^(trust_height[[:space:]]+=[[:space:]]+).*$|\1$TRUST_HEIGHT| ; \
s|^(trust_hash[[:space:]]+=[[:space:]]+).*$|\1\"$TRUST_HASH\"|" $HOME/.firmachain/config/config.toml
sed -i.bak -e "s/^persistent_peers *=.*/persistent_peers = \"$PEER\"/" $HOME/.firmachain/config/config.toml

Step 4: Start service and open journal

sudo systemctl restart firmachaind
sudo journalctl -u firmachaind -f -o cat

Last updated