Alkia IT Services
Professional Services | BlockChains
State-Sync for Bitcanna
Our state-sync RPC server for Bitcanna is: http://bitcanna.alkia.net:26657
​
Cosmovisor is recommended to manage your node. If you do not use Cosmovisor, you may need to customize the next instruction.
​
Copy our state_sync.sh and give it the necessary right (chmod 700 state_sync.sh).
This script grabs important state-sync information (such as block height and trust hash) from our server and update your config.toml file accordingly.
​
The code of state_sync.sh is:
​
#!/bin/bash SNAP_RPC="http://bitcanna.alkia.net: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)
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
​
Now run the script:
./state_sync.sh
​
Stop the node:
sudo service bcnad stop
​
Reset the node:
bcnad tendermint unsafe-reset-all --home $HOME/.bcna --keep-addr-book
​
Restart the node:
sudo service bnad start
​