# Installing und & Using Cosmovisor

Note

This guide is for fresh full node installations. For existing nodes migrating to cosmovisor, please see the Migrations documentation.

Installing and configuring cosmovisor makes managing and maintaining und updates & upgrades much simpler.

This guide will cover installing and configuring und to run with Cosmovisor, and a full sync from genesis allowing you to run a full node.

# Contents

# 1. Download the genesis version of und, initialise & configure

First, download the und version for genesis:

mkdir -p $HOME/tmp && cd $HOME/tmp
wget https://github.com/unification-com/mainchain/releases/download/1.5.1/und_v1.5.1_linux_x86_64.tar.gz
tar -zxvf und_v1.5.1_linux_x86_64.tar.gz

Initialise the node

./und init [NODE_MONIKER]

Download genesis.json

IMPORTANT

Please ensure you download the correct genesis for the network you would like to join! Remember to change the output directory in the command below if you are using something other than the default $HOME/.und_mainchain directory!

To spin up your new node, download the latest genesis.json for the network you would like to join:

    Get the seed nodes

    IMPORTANT

    Please ensure you get the correct seed node information for the network you would like to join! Remember to change the directory if you are using something other than the default $HOME/.und_mainchain directory! For this guide, we are using /mnt/disks/data/.und_mainchain for the node's home directory.

    Your node will need to know at least one seed node in order to join the network and begin P2P communication with other nodes in the network. The latest seed information will always be available at each network's respective Github repo:

    Go to the repo for the network you are connecting to and copy one or more of the seed nodes (you only need the id@address:port)

    Edit your node configuration file using nano:

    nano /path/to/.und_mainchain/config/config.toml
    

    Hit Ctrl+W, type [p2p] (including the square brackets) and hit return - this will take you to the [p2p] section of the config file, which begins with:

    ##### peer to peer configuration options #####
    [p2p]
    

    Find the seeds = "" variable about 12 lines below, and add the seed node information between the double quotes (comma separated, no spaces if more than one). For example:

    seeds = "node_id@ip:port"
    

    Set gas-prices

    It is good practice to set the minimum-gas-prices value in $HOME/.und_mainchain/config/app.toml, in order to protect your full node from spam transactions. This should be set as a decimal value in nund, and the recommended value is currently 25.0nund. This means your node will ignore any Txs with a gas price below this value. To do so, open up $HOME/.und_mainchain/config/app.toml in a text editor, and set minimum-gas-prices

    nano $HOME/.und_mainchain/config/app.toml
    

    Change:

    minimum-gas-prices = ""
    

    To, for example:

    minimum-gas-prices = "25.0nund"
    

    Hit Ctrl+X followed by y and then return to save the file and exit nano.

    # 2. Install & Configure Cosmovisor

    Next, install cosmovisor

    mkdir $HOME/tmp && cd $HOME/tmp
    wget https://github.com/cosmos/cosmos-sdk/releases/download/cosmovisor%2Fv1.5.0/cosmovisor-v1.5.0-linux-amd64.tar.gz
    tar -zxvf cosmovisor-v1.5.0-linux-amd64.tar.gz
    sudo mv cosmovisor /usr/local/bin/cosmovisor
    

    The latest version of cosmovisor is v1.5.0

    # 2.1 Set up cosmovisor directory structure

    Create the directory structure for the und binaries and updates

    # 2.1.1 und v1.5.1: genesis:

    mkdir -p $HOME/tmp && cd $HOME/tmp
    wget https://github.com/unification-com/mainchain/releases/download/1.5.1/und_v1.5.1_linux_x86_64.tar.gz
    tar -zxvf und_v1.5.1_linux_x86_64.tar.gz
    mkdir -p $HOME/.und_mainchain/cosmovisor/genesis/bin
    mv und $HOME/.und_mainchain/cosmovisor/genesis/bin
    $HOME/.und_mainchain/cosmovisor/genesis/bin/und version --log_level=""

    Check the version output is 1.5.1.

    # 2.1.2 und v1.6.x: 1-init_ibc update

    Important

    Upgrade plan names for und v1.6.x:
    MainNet: 1-init_ibc
    TestNet: 1-ibc

    The upgrade plan name determines the directory path that und v1.6.x will be installed in!

    Install the 1-init_ibc update:

      Check the version output is 1.6.3.

      # 2.1.3 und v1.7.x: 2-grog update

      Install the 2-grog update:

      mkdir -p $HOME/tmp && cd $HOME/tmp
      wget https://github.com/unification-com/mainchain/releases/download/v1.7.0/und_v1.7.0_linux_x86_64.tar.gz
      tar -zxvf und_v1.7.0_linux_x86_64.tar.gz
      mkdir -p $HOME/.und_mainchain/cosmovisor/upgrades/2-grog/bin
      mv und $HOME/.und_mainchain/cosmovisor/upgrades/2-grog/bin
      $HOME/.und_mainchain/cosmovisor/upgrades/2-grog/bin/und version --log_level=""

      Check the version output is 1.7.0.

      # 2.1.4 und v1.8.x: 3-keyleth update

      Install the 3-keyleth update:

      mkdir -p $HOME/tmp && cd $HOME/tmp
      wget https://github.com/unification-com/mainchain/releases/download/v1.8.2/und_v1.8.2_linux_x86_64.tar.gz
      tar -zxvf und_v1.8.2_linux_x86_64.tar.gz
      mkdir -p $HOME/.und_mainchain/cosmovisor/upgrades/3-keyleth/bin
      mv und $HOME/.und_mainchain/cosmovisor/upgrades/3-keyleth/bin
      $HOME/.und_mainchain/cosmovisor/upgrades/3-keyleth/bin/und version --log_level=""

      Check the version output is 1.8.2.

      # 2.1.5 und v1.9.x: 4-percival update

      Install the 4-percival update:

      mkdir -p $HOME/tmp && cd $HOME/tmp
      wget https://github.com/unification-com/mainchain/releases/download/v1.9.0/und_v1.9.0_linux_x86_64.tar.gz
      tar -zxvf und_v1.9.0_linux_x86_64.tar.gz
      mkdir -p $HOME/.und_mainchain/cosmovisor/upgrades/4-percival/bin
      mv und $HOME/.und_mainchain/cosmovisor/upgrades/4-percival/bin
      $HOME/.und_mainchain/cosmovisor/upgrades/4-percival/bin/und version --log_level=""

      Check the version output is 1.9.0.

      # 2.1.6 und v1.10.x: 5-pike update

      Install the 5-pike update:

      mkdir -p $HOME/tmp && cd $HOME/tmp
      wget https://github.com/unification-com/mainchain/releases/download/v1.10.1/und_v1.10.1_linux_x86_64.tar.gz
      tar -zxvf und_v1.10.1_linux_x86_64.tar.gz
      mkdir -p $HOME/.und_mainchain/cosmovisor/upgrades/5-pike/bin
      mv und $HOME/.und_mainchain/cosmovisor/upgrades/5-pike/bin
      $HOME/.und_mainchain/cosmovisor/upgrades/5-pike/bin/und version --log_level=""

      Check the version output is 1.10.1.

      # 2.2 Create cosmovisor environment file

      Create an environment variable file which will load into the systemd service, modifying /FULL/PATH/TO/ as required:

      tee $HOME/.und_mainchain/cosmovisor/UND_COSMOVISOR_ENV > /dev/null <<EOF
      DAEMON_NAME=und
      DAEMON_HOME=/FULL/PATH/TO/.und_mainchain
      DAEMON_RESTART_AFTER_UPGRADE=true
      DAEMON_RESTART_DELAY=5s
      EOF
      

      # 3. Set up the systemd service

      Create a systemd service file, replacing USERNAME as required:

      sudo tee /etc/systemd/system/und.service > /dev/null <<EOF
      [Unit] 
      Description=Unification Mainchain Node 
       
      [Service] 
      User=USERNAME 
      Group=USERNAME 
      WorkingDirectory=/home/USERNAME 
      EnvironmentFile=/home/USERNAME/.und_mainchain/cosmovisor/UND_COSMOVISOR_ENV
      ExecStart=/usr/local/bin/cosmovisor run start
      Restart=on-failure
      RestartSec=10s
      LimitNOFILE=4096 
       
      [Install] 
      WantedBy=default.target
      EOF
      

      Reload systemd:

      sudo systemctl daemon-reload
      

      # 4. Start the systemd service

      Start the und as a background service:

      sudo systemctl start und
      sudo journalctl -u und -f
      

      # 5. Become a Validator

      Should you wish, and once your node is fully synced, you can become a validator