bitcanna-dev-5
Cosmovisor
is a small process manager for Cosmos SDK application binaries that monitors the governance module for incoming chain upgrade proposals. If it sees a proposal that gets approved, it stops the current binary, switch from the old binary to the new one, and finally restarts the node with the new binary.
This guide will explain how to install Cosmovisor and prepare for a future chain update. A full guide about Cosmovisor can be found here.
You can build Cosmovisor from the source or download it from our GitHub repository. Detailed instruction to understand how it works here.
The easy way is install with Go:
go install github.com/cosmos/cosmos-sdk/cosmovisor/cmd/cosmovisor@latest
Alternatives are:
To download Cosmovisor without having to compile it yourself, run the following command:
cd ~
wget https://github.com/cosmos/cosmos-sdk/releases/download/cosmovisor%2Fv1.3.0/cosmovisor-v1.3.0-linux-amd64.tar.gz
Check sha256 sum
sha256sum cosmovisor-v1.3.0-linux-amd64.tar.gz
It must return: 34d7c9fbaa03f49b8278e13768d0fd82e28101dfa9625e25379c36a86d558826
Unzip the file, give it the correct permissions and move it to your machine's PATH
tar -xf cosmovisor-v1.3.0-linux-amd64.tar.gz
rm cosmovisor-v1.3.0-linux-amd64.tar.gz
chmod +x cosmovisor
sudo mv cosmovisor /usr/local/bin
To compile Cosmovisor from the source, you need to have go
installed on your system. A full guide to install go
can be found here.
Try this to install Cosmovisor from the source by pulling the cosmos-sdk repository, switch to the correct version and build it:
git clone https://github.com/cosmos/cosmos-sdk.git
cd cosmos-sdk
git checkout cosmovisor/v1.3.0
make cosmovisor
The previous action builds Cosmovisor in the /cosmovisor
directory, now let's move it to the system's PATH:
sudo mv cosmovisor/cosmovisor /usr/local/bin
You can delete the cosmos-sdk
folder
cd .. && rm -rf cosmos-sdk/
Version v1.2/3 includes a new command that will create the required folder structure for you, so it will avoid you some extra steps
v1.2
binary.cd ~
rm -f bcnad #delete the binary if exist to avoid version mixings
wget https://github.com/BitCannaGlobal/bcna/releases/download/v1.4.2/bcna_linux_amd64.tar.gz
tar zxvf bcna_linux_amd64.tar.gz
rm bcna_linux_amd64.tar.gz
chmod +x bcnad
./bcnad version
#Set the necessaries VARs to start Cosmovisor (later you can add to .profile)
export DAEMON_NAME=bcnad
export DAEMON_RESTART_AFTER_UPGRADE=true
export DAEMON_HOME=${HOME}/.bcna
export DAEMON_RESTART_DELAY=30s
export UNSAFE_SKIP_BACKUP=true
export DAEMON_LOG_BUFFER_SIZE=512
#add this to continue to use bcnad for commands, this is optional
PATH="${HOME}/.bcna/cosmovisor/current/bin:$PATH"
#start the initial configuration
cosmovisor init ./bcnad
It should show something like:
11:46AM INF checking on the genesis/bin directory module=cosmovisor
11:46AM INF creating directory (and any parents): "/Users/test/.bcna/cosmovisor/genesis/bin" module=cosmovisor
11:46AM INF checking on the genesis/bin executable module=cosmovisor
11:46AM INF copying executable into place: "/Users/test/.bcna/cosmovisor/genesis/bin/bcnad" module=cosmovisor
11:46AM INF making sure "/Users/test/.bcna/cosmovisor/genesis/bin/bcnad" is executable module=cosmovisor
11:46AM INF checking on the current symlink and creating it if needed module=cosmovisor
11:46AM INF the current symlink points to: "/Users/t/.bcna/cosmovisor/genesis/bin/bcnad" module=cosmovisor
mkdir -p ${HOME}/.bcna/cosmovisor/upgrades/ruderalis/bin
mkdir -p ${HOME}/.bcna/cosmovisor/upgrades/strangebuddheads/bin/
mkdir -p ${HOME}/.bcna/cosmovisor/upgrades/trichomemonster-ica/bin/
3a) Download & copy the next version v.1.3.1
to the upgrades folder.
This guide shows how to download the binary. If you want to build the binary from the source, detailed instructions can be found in the README of our GitHub.
cd ~
rm -f bcnad
wget -nc https://github.com/BitCannaGlobal/bcna/releases/download/v.1.3.1/bcnad
Check the sha256sum.
sha256sum ./bcnad
It must return: ad6784e945135454efc436d22a7661db36bc6a396e7d9cdb7572c4d8d5ccef3f
Verify that the version is:.1.3.1
chmod +x bcnad
./bcnad version
Move the newly built binary to the upgrades directory.
mv ./bcnad ${HOME}/.bcna/cosmovisor/upgrades/ruderalis/bin/
If you build the binary from the code source move it to the same folder
3b) Download & copy the last version v.1.4.2
to the upgrades folder.
This guide shows how to download the binary. If you want to build the binary from the source, detailed instructions can be found in the README of our GitHub.
cd ~
rm bcna_linux_amd64.tar.gz #delete old file if exist
wget -nc https://github.com/BitCannaGlobal/bcna/releases/download/v1.4.2/bcna_linux_amd64.tar.gz
Check the sha256sum.
sha256sum bcna_linux_amd64.tar.gz
It must return: 903c63b9f668bf5208566955648279bdf0c15e73aab415d5ea5efc09ec1fc890
Extract and verify that the version is:1.4.2
rm -f ./bcnad #delete old file if exist
tar zxvf bcna_linux_amd64.tar.gz
rm bcna_linux_amd64.tar.gz
chmod +x bcnad
./bcnad version
Move the newly built binary to the upgrades directory.
mv ./bcnad ${HOME}/.bcna/cosmovisor/upgrades/strangebuddheads/bin/
3c) Download & copy the last version v.1.5.0
to the upgrades folder.
This guide shows how to download the binary. If you want to build the binary from the source, detailed instructions can be found in the README of our GitHub.
cd ~
rm bcna_linux_amd64.tar.gz #delete old file if exist
wget -nc https://github.com/BitCannaGlobal/bcna/releases/download/v1.5.1/bcna_linux_amd64.tar.gz
Check the sha256sum.
sha256sum bcna_linux_amd64.tar.gz
It must return: 61cc23efd818184370ec3f43cd9c9ba731978874d54e370b3b4f8c6f724a75ec
Extract and verify that the version is:1.5.1
rm -f ./bcnad #delete old file if exist
tar zxvf bcna_linux_amd64.tar.gz
rm bcna_linux_amd64.tar.gz
chmod +x bcnad
./bcnad version
Move the newly built binary to the upgrades directory.
mv ./bcnad ${HOME}/.bcna/cosmovisor/upgrades/trichomemonster-ica/bin/
If you build the binary from the code source move it to the same folder
Very important decision now. Depending on your choice you should sync the chain using a snapshot file/service or sync from the scratch (very slow process but the only to get the whole original chain by yourself)
ln -sfn -T ${HOME}/.bcna/cosmovisor/genesis ${HOME}/.bcna/cosmovisor/current
ln -sfn ${HOME}/.bcna/cosmovisor/upgrades/strangebuddheads ${HOME}/.bcna/cosmovisor/current
ls .bcna/cosmovisor/ -lh
The output should look like this:
total 8.0K
lrwxrwxrwx 1 user user 35 Jan 14 20:16 current -> /home/user/.bcna/cosmovisor/upgrades/strangebuddheads
drwxrwxr-x 3 user user 4.0K Jan 14 20:09 genesis
drwxrwxr-x 4 user user 4.0K Jan 14 20:15 upgrades
bcnad init Moniker --chain-id bitcanna-dev-5 --overwrite
This will create a `$HOME/.bcna` folder
genesis.json
filecd $HOME
curl -s https://raw.githubusercontent.com/BitCannaGlobal/testnet-bcna-cosmos/main/instructions/bitcanna-dev-5/genesis.json
Ensure you have the correct file. Run the SHA256SUM test:
sha256sum $HOME/.bcna/config/genesis.json
<output> 2c4aeec0d2b416478de0d6bd5f32954f18235ae1991e9f1b685946963e3ca425
sed -E -i 's/seeds = \".*\"/seeds = \"bfeb1b8802eaa9f4c12d8a0ac55c0df4777e3adc@144.91.89.66:26656\"/' $HOME/.bcna/config/config.toml
sed -E -i 's/minimum-gas-prices = \".*\"/minimum-gas-prices = \"0.001ubcna\"/' $HOME/.bcna/config/app.toml
sudo ufw allow 26656
echo "[Unit]
Description=Cosmovisor BitCanna Service
After=network-online.target
[Service]
User=${USER}
Environment=DAEMON_NAME=bcnad
Environment=DAEMON_RESTART_AFTER_UPGRADE=true
Environment=DAEMON_HOME=${HOME}/.bcna
Environment=UNSAFE_SKIP_BACKUP=true
Environment=DAEMON_RESTART_DELAY=30s
Environment=DAEMON_LOG_BUFFER_SIZE=512
#Optional export DAEMON_DATA_BACKUP_DIR=${HOME}/your_chain_backup_folder
ExecStart=$(which cosmovisor) run start
Restart=always
RestartSec=3
LimitNOFILE=4096
[Install]
WantedBy=multi-user.target
" >cosmovisor.service
cosmovisor
service. You can avoid the 3rd line if it is a clean installation and bcnad
service doesn't exist.sudo mv cosmovisor.service /lib/systemd/system/
sudo systemctl daemon-reload
sudo systemctl stop bcnad.service && sudo systemctl disable bcnad.service
sudo systemctl enable cosmovisor.service && sudo systemctl start cosmovisor.service
sudo journalctl -u cosmovisor -f
You can speed up the syncing using a StateSync Server or a snapshot file.
If everything is right Cosmovisor will take control of the binaries. Instead of bcnad you must use cosmosvisor run
in your commands, for example: cosmovisor run status
To do this, make the following changes:
nano $HOME/.profile
Add to the end of the file:
export DAEMON_NAME=bcnad
export DAEMON_RESTART_AFTER_UPGRADE=true
export DAEMON_HOME=${HOME}/.bcna
export UNSAFE_SKIP_BACKUP=false
export DAEMON_LOG_BUFFER_SIZE=512
export DAEMON_RESTART_DELAY=30s
#add this to continue to use bcnad for commands, this is optional
PATH="${HOME}/.bcna/cosmovisor/current/bin:$PATH"
source $HOME/.profile
cosmovisor run version
Will be v.1.4.2
before the upgrade and v1.5.1
after the upgrade cosmovisor run version
12:14PM INF running app args=["version"] module=cosmovisor path=/home/testnet/.bcna/cosmovisor/genesis/bin/bcnad
12:14PM ERR failed to read error="lstat /home/testnet/.bcna/cosmovisor/current/upgrade-info.json: no such file or directory" filename=/home/testnet/.bcna/cosmovisor/current/upgrade-info.json module=cosmovisor
1.2
bcnad version
Must show the same version as abovecosmovisor run status
In the future, you must use the cosmovisor
command instead of the bcnad command if you want to perform service related commands.
For example:
sudo service cosmovisor start
sudo service cosmovisor stop
sudo service cosmovisor restart
sudo journalctl -u cosmovisor -f
cosmovisor
, bitcanna