statesync

  • Network Type: Mainnet
  • Chain-id: bitcanna-1
  • Current Node version: v2.0.3
  • Setup

    This is the settings we use , you dont have to change anything

    • snapshot-interval= 2000
    • snapshot-keep-recent = 5

    Intruction

    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
    
    STATE_SYNC_RPC=https://rpc.bitcanna.indonode.net:443
    STATE_SYNC_PEER=9d8f4def69c13050f97990757b938343a53da0f5@rpc.bitcanna.indonode.net:27656
    LATEST_HEIGHT=$(curl -s $STATE_SYNC_RPC/block | jq -r .result.block.header.height)
    SYNC_BLOCK_HEIGHT=$(($LATEST_HEIGHT - 2000))
    SYNC_BLOCK_HASH=$(curl -s "$STATE_SYNC_RPC/block?height=$SYNC_BLOCK_HEIGHT" | jq -r .result.block_id.hash)
    
    sed -i \
      -e "s|^enable *=.*|enable = true|" \
      -e "s|^rpc_servers *=.*|rpc_servers = \"$STATE_SYNC_RPC,$STATE_SYNC_RPC\"|" \
      -e "s|^trust_height *=.*|trust_height = $SYNC_BLOCK_HEIGHT|" \
      -e "s|^trust_hash *=.*|trust_hash = \"$SYNC_BLOCK_HASH\"|" \
      -e "s|^persistent_peers *=.*|persistent_peers = \"$STATE_SYNC_PEER\"|" \
      $HOME/.bcna/config/config.toml
    
    mv $HOME/.bcna/priv_validator_state.json.backup $HOME/.bcna/data/priv_validator_state.json

    Restart Service

    sudo systemctl start bcnad && sudo journalctl -u bcnad -f --no-hostname -o cat

    Turn Off State-sync

    sed -i.bak -e "s|^enable *=.*|enable = false|" $HOME/.bcna/config/config.toml
    systemctl restart bcnad && journalctl -fu bcnad -o cat