Skip to content

Latest commit

 

History

History
166 lines (135 loc) · 6.81 KB

2.2.snapshot.md

File metadata and controls

166 lines (135 loc) · 6.81 KB

Sync using a snapshot file

This is a fast way to sync a node with bitcanna-1 chain. A snapshot is nothing more than someone sharing a copy of his/her blockchain's data folder in a compressed file.

Our current authorized providers are:

(make sure to include them in your delegations ;)!)

The fastest way to sync a peer is using State Sync and is described here as an alternative.

For this step, its necesary that you have followed this manual previously in order to install the bcnad binary.

  1. Ensure your installed binary is the lastest release:

    bcnad version
    

    Output should be: v1.6.3

    If you are using Cosmovisor,

    cosmovisor run version
    

    Output should be: cosmovisor run version 11:11AM INF running app args=["version"] module=cosmovisor path=/home/raul/.bcna/cosmovisor/upgrades/grow-vigorous-fix/bin/bcnad --> v1.6.3

  2. If you are a new user, you should Initialize the folders: change Moniker by your validator name (use quotes for two or more separated words "Royal Queen Seeds")

    bcnad init Moniker --chain-id bitcanna-1 --overwrite
    

    This will create a $HOME/.bcna folder

  3. Download the Genesis genesis.json file

    cd $HOME
    curl -s https://raw.githubusercontent.com/BitCannaGlobal/bcna/main/genesis.json > ~/.bcna/config/genesis.json
    

    Ensure you have the correct file. Run the SHA256SUM test:

     sha256sum $HOME/.bcna/config/genesis.json
     <output> cd7449a199e71c400778f894abb00874badda572ac5443b7ec48bb0aad052f29
    
  4. Add to config.toml file: server SEEDs:

    sed -E -i 's/seeds = \".*\"/seeds = \"[email protected]:26656,[email protected]:26656\"/' $HOME/.bcna/config/config.toml
    
  5. You can set the minimum gas prices for transactions to be accepted into your node’s mempool. This sets a lower bound on gas prices, preventing spam.

    sed -E -i 's/minimum-gas-prices = \".*\"/minimum-gas-prices = \"0.001ubcna\"/' $HOME/.bcna/config/app.toml
    
  6. Open the P2P port (26656 by default)

    sudo ufw allow 26656
    
  7. Download the file with block-data from one of our current authorized service providers:

Our current authorized providers are (in alphabetical order):

You should download a compressed file, unpack it and start the daemon. Follow the instructions at the webpages of the snapshot providers.

This is the folder's tree (without Cosmosvisor installation). You should decompress it at .bcna/data/

.bcna
├── config
└── data
    ├── application.db
    ├── blockstore.db
    ├── cs.wal
    ├── evidence.db
    ├── snapshots
    │   └── metadata.db
    ├── state.db
    └── tx_index.db

17 directories
  1. If you have downloaded and decompressed the data-block you can run a first time to see if bcnad continues to sync:

    bcnad start --log_level info

    3:31PM INF Committed state appHash=77D16BED3F109A4A05A971C92602029569E049DFC1DC128CFF5CCAE3158F4B1B height=3886 module=state txs=0
    3:31PM INF Indexed block height=3886 module=txindex
    3:31PM INF minted coins from module account amount=1034628bcna from=mint module=x/bank
    3:31PM INF Executed block height=3887 invalidTxs=0 module=state validTxs=0
    3:31PM INF commit synced commit=436F6D6D697449447B5B38332031333820373720313731203135362032333220313431203435203137332037372031352031363020373120393720393520352031393020313836203733203131342034322031313620313230203536203338203230203337203437203231392032353220343920385D3A4632467D
    3:31PM INF Committed state appHash=538A4DAB9CE88D2DAD4D0FA047615F05BEBA49722A7478382614252FDBFC3108 height=3887 module=state txs=0
    
  2. Service creation Ensure that you've stopped the previous test with CTRL+C. With all configurations ready, you can start your blockchain node with a single command (bcnad start). In this tutorial, however, you will find a simple way to set up systemd to run the node daemon with auto-restart.

At this point you can create a simple BCNA service file, or you can configure Cosmovisor, Cosmovisor works like an upgrade "supervisor" that checks and applies the correct version of the software. As a result you can setup Cosmovisor as a replacement of the bcnad daemon/command line utility and let Cosmovisor handle future upgrades.

So the next step is (one of the following)

  • Skip Cosmovisor and continue with simple system service creation
  • Go to Cosmovisor guide and skip this step and the following steps of this guide.

Setup bcnad systemd service (copy and paste all to create the file service):

    cd $HOME
    echo "[Unit]
    Description=BitCanna Node
    After=network-online.target
    [Service]
    User=${USER}
    ExecStart=$(which bcnad) start
    Restart=always
    RestartSec=3
    LimitNOFILE=4096
    [Install]
    WantedBy=multi-user.target
    " >bcnad.service

Enable and activate the BCNAD service.

    sudo mv bcnad.service /lib/systemd/system/
    sudo systemctl enable bcnad.service && sudo systemctl start bcnad.service

Check the logs to see if it is working: sudo journalctl -u bcnad -f

  1. Check the synchronisation: If catching_up = true the node is syncing. Also you can compare your current block with the last synced block of another node, or at our Explorer:
    curl -s localhost:26657/status  | jq .result.sync_info.catching_up
    #true output is syncing - false is synced
    
    curl -s localhost:26657/status | jq .result.sync_info.latest_block_height
    #this output is your last block synced
    
    curl -s "http://seed1.bitcanna.io:26657/status?"  | jq .result.sync_info.latest_block_height
    #this output the public node last block synced
    
tags: doc github