DevNet-4. Join to bitcanna-dev-4

Note: STATESYNC won't works because trusting is breaking (because we back in time on a snapshot) so you can jump directly to: https://hackmd.io/g7pENy73RFKkcCYIKFzZrw#Download-a-snapshot

StateSync for sync a new node

You can run a node in seconds using our StateSync script. Download and run it. You should wait until you see that block production is stabilized, then press CTLR + C

  1. Download
    ​​​​cd ~
    ​​​​wget https://raw.githubusercontent.com/BitCannaGlobal/cosmos-statesync_client/main/statesync_DEVNET_client_linux_new.sh
    
  2. Run it!
    ​​​​bash statesync_DEVNET_client_linux_existing.sh
    

StateSync for existising validators:

You need to perform some extra steps to save your config and keys (node & validator)

  1. Stop your current node (change cosmovisor by bcnad if applies)
    ​​​​sudo service cosmovisor stop
    
  2. Backup temporally your config and keys
    ​​​​cp -R .bcna/config/ ./config/
    
  3. Download the StateSync Script
    ​​​​cd ~
    ​​​​wget https://raw.githubusercontent.com/BitCannaGlobal/cosmos-statesync_client/main/statesync_DEVNET_client_linux_existing.sh
    
  4. Run it!
    ​​​​bash statesync_DEVNET_client_linux_existing.sh
    
  5. Restore your config and keys
    ​​​​cp -R  ./config/ .bcna/
    
  6. Run the daemon again (change cosmovisor by bcnad if applies)
    ​​​​sudo service cosmovisor start
    

Download a snapshot

  1. Stop your current node (change cosmovisor by bcnad if applies)
    ​​​​sudo service cosmovisor stop
    
  2. Delete data folder
    ​​​​cd $HOME/.bcna
    ​​​​rm -rf data    
    
  3. Download the snapshot (17GB)
    ​​​​wget http://144.91.127.5:80/devnet-backup.tar
    
  4. Extract it
    ​​​​tar xvf devnet-backup.tar
    ​​​​cd ~
    
  5. Start the daemon

If you are new in bitcanna-dev-4

  1. Download the binary (or compile it from the source).
cd ~
rm -f bcnad
wget -nc https://github.com/BitCannaGlobal/bcna/releases/download/v1.4.4-pre/bcna_linux_amd64.tar.gz
  1. Check the sha256sum.
sha256sum bcna_linux_amd64.tar.gz

It must return: abde24a797f6676498440878ff1ac38593b16b39161ea38e9dc935b146e566e5

  1. Verify that the version is 1.4.4-pre
rm -f ./bcnad
tar zxvf  bcna_linux_amd64.tar.gz
rm bcna_linux_amd64.tar.gz
chmod +x bcnad
./bcnad version

Set the chain-id param

    bcnad config chain-id bitcanna-dev-4
  1. Create a wallet:
    You may create a wallet with one or more keys (addresses) using bcnad; you can choose the name (we advice you use one word)
    bcnad keys add MyFirstAddress

      name: MyFirstAddress
      type: local
      address: bcna14shzreglay98us0hep44hhhuy7dm43snv38plr
      pubkey: bcnapub1addwnpepqvtpzyugupvcu773rzdcvhele6e22txy2zr235dn7uf8t2mlqcarcyx2gg9
      mnemonic: ""
      threshold: 0
      pubkeys: []


     Important write this mnemonic phrase in a safe place.
    It is the only way to recover your account if you ever forget your password.

    deposit daring slim glide spend dolphin expire shadow cluster weed orphan work 420 section client friend yellow west hamster torch settle island opinion gloom

Your address will look something similar like this: bcna14shzreglay98us0hep44hhhuy7dm43snv38plr

  1. 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-dev-4
    

    This will create a $HOME/.bcna folder

  2. Download the Genesis genesis.json file

    ​​​​cd $HOME
    ​​​​curl -s https://raw.githubusercontent.com/BitCannaGlobal/testnet-bcna-cosmos/main/instructions/bitcanna-dev-4/genesis.json > ~/.bcna/config/genesis.json
    

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

    ​​​​ sha256sum $HOME/.bcna/config/genesis.json
    ​​​​ <output> f667a9a89bc00a77548e29ff11c14c3f551b3b2faa809c3e3dd48af68a3a140b
    
  3. Add to config.toml file the server SEEDs:

    ​​​​sed -E -i 's/seeds = \".*\"/seeds = \"3fde4e73ef3fba3418dde89bffe0057508fc5706@144.91.127.5:26656\"/' $HOME/.bcna/config/config.toml
    ​​​​sed -E -i 's/persistent_peers = \".*\"/persistent_peers = \"d0de90dd8b40dfe231a65875069a31c534359c95@188.166.126.81:26656,4ccc6689a4d2590f6b60e34a3a3e70e0888bbcc0@144.91.89.66:26656\"/' $HOME/.bcna/config/config.toml
    
  4. 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
    
  5. Open the P2P port (26656 by default)

    sudo ufw allow 26656

  6. Delete data folder if exist

    ​​​​cd $HOME/.bcna
    ​​​​rm -rf data    
    
  7. Download the snapshot (17GB)

    ​​​​wget http://144.91.127.5:80/devnet-backup.tar.gz
    
  8. Extract it

    ​​​​tar xvf devnet-backup.tar.gz
    ​​​​cd ~
    
  9. Service creation
    Ensure that you 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.

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 sync: while 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 Web-wallet:
    ​​​​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 "https://rpc-testnet.bitcanna.io/status?"  | jq .result.sync_info.latest_block_height
    ​​​​#this output the public node last block synced
    
  2. To become Validator check the original guide:
    https://github.com/BitCannaGlobal/testnet-bcna-cosmos/blob/main/instructions/bitcanna-dev-4/README.md#step-2-become-a-validator
tags: "bitcanna", "devnet", "upgrade"
Select a repo