bitcanna-icon

State sync Bitcanna

In addition to node snapshot, we also provide node state sync, node state sync is also suitable for developers or node operators to syncing.., restore or get block height for their nodes, also reducing the time required to sync nodes multiple times.

State Sync Info

snapshot-interval = "1000"
snapshot-keep-recent = "5"
RPC servers: https://bitcanna-rpc.genznodes.dev:443
Statesync node id : [email protected]:32656
check rpc

Instructions ( Please Read This )

- Before using it, you can check the rpc url first whether it's down or not
- Contact us if you need help
- Using a node state-sync usually takes about 10 minutes, depending on the weight of the node.
- For validator node make sure back up priv_validator_key.json , priv_validator_state.json. validator's security reason.
  • Stop node and Reset data:
    sudo systemctl stop bcnad 
    bcnad tendermint unsafe-reset-all --home $HOME/.bcna --keep-addr-book
  • Retrieve node height information and trusted hashes from rpc:
    STATE_SYNC_RPC="https://bitcanna-rpc.genznodes.dev:443"
    
    LATEST_HEIGHT=$(curl -s $STATE_SYNC_RPC/block | jq -r .result.block.header.height)
    SYNC_BLOCK_HEIGHT=$(($LATEST_HEIGHT - 1000))
    SYNC_BLOCK_HASH=$(curl -s "$STATE_SYNC_RPC/block?height=$SYNC_BLOCK_HEIGHT" | jq -r .result.block_id.hash)
    
    echo $LATEST_HEIGHT $SYNC_BLOCK_HEIGHT $SYNC_BLOCK_HASH
  • Add our state sync server id node to your config.toml:
    PEERS="[email protected]:32656"
    sed -i -e "s/^persistent_peers *=.*/persistent_peers = \"$PEERS\"/" $HOME/.bcna/config/config.toml
  • Enable state sync:
    sed -i  -e "s|^enable *=.*|enable = true|" $HOME/.bcna/config/config.toml
  • Set state sync in config.toml :
    sed -i -e "s|^rpc_servers *=.*|rpc_servers = \"$STATE_SYNC_RPC,$STATE_SYNC_RPC\"|" \
    $HOME/.bcna/config/config.toml
    sed -i -e "s|^trust_height *=.*|trust_height = $SYNC_BLOCK_HEIGHT|" \
    $HOME/.bcna/config/config.toml
    sed -i -e "s|^trust_hash *=.*|trust_hash = \"$SYNC_BLOCK_HASH\"|" \
    $HOME/.bcna/config/config.toml
  • Restart node:
    sudo systemctl restart bcnad
    sudo journalctl -fu bcnad -o cat
  • ++ Instructions

  • If your node already sync set false again in config.toml
    sed -i -e "s|^enable *=.*|enable = false|" $HOME/.bcna/config/config.toml
    
  • Remove our server peers use addrbook instead
    PEERS=""
    sed -i -e "s/^persistent_peers *=.*/persistent_peers = \"$PEERS\"/" $HOME/.bcna/config/config.toml
  • Restart your node
  • ../../../components/widgets/Navbar.jsx