makimaprjkt°
Ask or search…
K
Comment on page

State sync

With our state sync services you will be able to catch up latest chain block in matter of minutes
Network: Mainnet | Chain ID: bitcanna-1 | Version: v2.0.3
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 is generally much smaller than the blocks, and restoring it is much faster than replaying blocks, this can reduce the time to sync with the network from days to minutes.

Instruction

Our state-sync server setup

Our app.toml settings related to state-sync is as follows. This is for you information only. You do not need to follow the same setup on your node
# Prune Type
pruning = "custom"
# Prune Strategy
pruning-keep-every = 0
# State-Sync Snapshot Strategy
snapshot-interval = 2000
snapshot-keep-recent = 5
Our state-sync RPC server for BitCanna is :
https://rpc-bitcanna.sxlmnwb.xyz:443

Stop the service and reset the data

sudo systemctl stop bcnad
cp $HOME/.bcna/data/priv_validator_state.json $HOME/.bcna/priv_validator_state.json.backup
bcnad tendermint unsafe-reset-all --home $HOME/.bcna --keep-addr-book

Configure state sync information

SNAP_RPC="https://rpc-bitcanna.sxlmnwb.xyz:443"
STATESYNC_PEERS="1bde35502e913[email protected]:11356"
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/.bcna/config/config.toml
sed -i -e "s|^persistent_peers *=.*|persistent_peers = \"$STATESYNC_PEERS\"|" $HOME/.bcna/config/config.toml
mv $HOME/.bcna/priv_validator_state.json.backup $HOME/.bcna/data/priv_validator_state.json

Start service and check logs

sudo systemctl start bcnad && sudo journalctl -fu bcnad -o cat
Last modified 1mo ago