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 = "2000"
snapshot-keep-recent = "3"
RPC servers:
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:
    LATEST_HEIGHT=$(curl -s $STATE_SYNC_RPC/block | jq -r .result.block.header.height)
    SYNC_BLOCK_HASH=$(curl -s "$STATE_SYNC_RPC/block?height=$SYNC_BLOCK_HEIGHT" | jq -r .result.block_id.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\"|" \
    sed -i -e "s|^trust_height *=.*|trust_height = $SYNC_BLOCK_HEIGHT|" \
    sed -i -e "s|^trust_hash *=.*|trust_hash = \"$SYNC_BLOCK_HASH\"|" \
  • Restart node:
    sudo systemctl restart bcnad
    journalctl -fu bcnad -o cat
    Some also use this :
    systemctl --user restart bcnad
    journalctl --user -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
    sed -i -e "s/^persistent_peers *=.*/persistent_peers = \"$PEERS\"/" $HOME/.bcna/config/config.toml
  • Restart your node
  • Troubleshooting

    1. Post failed: ...: context deadline exceeded

  • If you see logs like this
    error="post failed: Post "": context deadline exceeded"
  • Most likely: the rpc server is responding to too many requests. You can wait because the node will still apply statesync and verify the hash.