Raul
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Cosmovisor setup for `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](https://github.com/cosmos/cosmos-sdk/tree/master/cosmovisor). ## Step 1. Download Cosmovisor You can build Cosmovisor from the source or download it from our GitHub repository. Detailed instruction to understand how it works [here](https://github.com/cosmos/cosmos-sdk/tree/master/cosmovisor#cosmosvisor). The easy way is install with Go: `go install github.com/cosmos/cosmos-sdk/cosmovisor/cmd/cosmovisor@latest` Alternatives are: ### A) Download Cosmovisor 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 ``` ### B) Build from source 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](https://golangdocs.com/install-go-linux). 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/ ``` ## Step 2. Setup Cosmovisor > 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 1) Download & init the folders with the old genesis version BitCanna `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 ``` 2) Create new directory for next upgrades ``` 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](https://github.com/BitCannaGlobal/bcna/blob/main/README.md) 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](https://github.com/BitCannaGlobal/bcna/blob/main/README.md) 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](https://github.com/BitCannaGlobal/bcna/blob/main/README.md) 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 4) Setup the current version link for Cosmovisor. > 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) * If you want to sync from the scratch (from block 1) you should do: ``` ln -sfn -T ${HOME}/.bcna/cosmovisor/genesis ${HOME}/.bcna/cosmovisor/current ``` * If you are going to sync using **(advanced users)** a snapshot file, StateSync or other you should point to the last version (v1.4.2) ``` ln -sfn ${HOME}/.bcna/cosmovisor/upgrades/strangebuddheads ${HOME}/.bcna/cosmovisor/current ``` 5) To check if everything is OK, run: ``` 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 ``` 6. 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-dev-5 --overwrite ``` This will create a `$HOME/.bcna` folder 7. Download the Genesis `genesis.json` file ``` cd $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 ``` 8. Add to _config.toml_ file: server SEEDs: ``` sed -E -i 's/seeds = \".*\"/seeds = \"bfeb1b8802eaa9f4c12d8a0ac55c0df4777e3adc@144.91.89.66:26656\"/' $HOME/.bcna/config/config.toml ``` 9. 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 ``` 10. Open the P2P port (26656 by default) ``` sudo ufw allow 26656 ``` 11) Create a systemd service for Cosmovisor. Simply copy and paste everything to create the service unit. ``` 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 ``` 12) Change **bcnad** service for `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 ``` 13) Check the logs to see if everything is OK. (ctrl + C to stop). ``` sudo journalctl -u cosmovisor -f ``` > You can speed up the syncing using a StateSync Server or a snapshot file. ## Step 3. Finish the installation 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: 1) Add variables to the end of the **.profile** file. ``` 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" ``` 2) Reload the config of the **.profile** file. ``` source $HOME/.profile ``` 3) Now let's try Cosmovisor. * Show Cosmovisor version: `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 ``` * Show BitCanna version: `bcnad version` Must show the same version as above * Show Cosmovisor sync info and status: `cosmovisor run status` ## Reminder In the future, you must use the `cosmovisor` command instead of the **bcnad** command if you want to perform service related commands. For example: * Start the service: `sudo service cosmovisor start` * Stop the service: `sudo service cosmovisor stop` * Restart the service: `sudo service cosmovisor restart` * Check the logs: `sudo journalctl -u cosmovisor -f` ###### tags: `cosmovisor`, `bitcanna`

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully