April 25, 2022

Installing the Cosmic Node

Hello, today we will talk about installing the Cosmic node.

Stated requirements for the server today are as follows: 4vCPUs, 8GB RAM and 200GB Disk space

Do not forget that the start will be at 4-26-2022 17:45 UTC, if you installed it earlier, then restart the node. sudo systemctl restart cohod

After connecting to the server, through the terminal, update it:

sudo apt-get update && sudo apt upgrade -y

Next, install the necessary packages:

sudo apt install make clang pkg-config libssl-dev build-essential git gcc chrony curl jq ncdu bsdmainutils htop net-tools lsof fail2ban -y

Install GO version 1.18.1 and check the version after installation:

cd $HOME wget -O go1.18.1.linux-amd64.tar.gz https://golang.org/dl/go1.18.1.linux-amd64.tar.gz rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.18.1.linux-amd64.tar.gz && rm go1.18.1.linux-amd64.tar.gz echo 'export GOROOT=/usr/local/go' >> $HOME/.bash_profile echo 'export GOPATH=$HOME/go' >> $HOME/.bash_profile echo 'export GO111MODULE=on' >> $HOME/.bash_profile echo 'export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin' >> $HOME/.bash_profile && . $HOME/.bash_profile go version

Download and move starport:

curl https://get.starport.network/starport | bash sudo mv starport /usr/local/bin/

Download the executable file and install starport (installation time is about 5 minutes):

git clone https://github.com/cosmic-horizon/coho.git cd ~/coho starport chain build

We set the variables for our convenience (we leave COSMIC_CHAIN unchanged, enter our values into the rest of the variables):

COSMIC_CHAIN="darkenergy-1" COSMIC_MONIKER="YOUR_MONIKER_NAME" COSMIC_WALLET="YOUR_WALLET_NAME"

Adding variables to bash_profile

echo 'export COSMIC_CHAIN='${COSMIC_CHAIN} >> $HOME/.bash_profile echo 'export COSMIC_MONIKER='${COSMIC_MONIKER} >> $HOME/.bash_profile echo 'export COSMIC_WALLET='${COSMIC_WALLET} >> $HOME/.bash_profile source $HOME/.bash_profile

We initialize the node:

cohod init $COSMIC_MONIKER --chain-id $COSMIC_CHAIN

Download Genesis:

wget -O $HOME/.coho/config/genesis.json https://raw.githubusercontent.com/cosmic-horizon/testnets/main/darkenergy-1/genesis.json

We set and prescribe seeds

seeds="[email protected]:26657" sed -i.bak -e "s/^seeds *=.*/seeds = \"$seeds\"/" $HOME/.coho/config/config.toml

We create a service

tee $HOME/cohod.service > /dev/null <<EOF [Unit] Description=coho After=network.target [Service] Type=simple User=$USER ExecStart=$(which cohod) start Restart=on-failure RestartSec=10 LimitNOFILE=65535 [Install] WantedBy=multi-user.target EOF

Move the service to the working folder

sudo mv $HOME/cohod.service /etc/systemd/system/

We start the service and look at the logs

sudo systemctl daemon-reload sudo systemctl enable cohod sudo systemctl restart cohod journalctl -u cohod -f -o cat

Or we look at the status and wait until it is synchronized

curl -s localhost:26657/status

After you see "catching_up": false the node has been synced

Let's make a wallet! Don't forget to save the mnemonic!!! it will also ask you to enter a password to access the wallet. SAVE or REMEMBER (If the wallet already exists and you just need to restore it, use this command cohod keys add $COSMIC_WALLET --recover and enter the mnemonic)

cohod keys add $COSMIC_WALLET

Add the wallet address to the variable (for confirmation, you need the password entered earlier)

COSMIC_ADDR=$(cohod keys show $COSMIC_WALLET -a)

Adding variable to bash_profile

echo 'export COSMIC_ADDR='${COSMIC_ADDR} >> $HOME/.bash_profile source $HOME/.bash_profile

Balance check

cohod query bank balances $COSMIC_ADDR

After synchronization, we create a validator, you can leave the commission or set your own (in the --amount line, enter the amount that we want to delegate with numbers, leave the letters ucoho), we also enter the previously entered password (do not forget that the wallet from which you will delegate must have funds):

cohod tx staking create-validator --yes \ --amount 1000000ucoho \ --moniker $COSMIC_MONIKER \ --commission-rate "0.10" \ --commission-max-rate "0.20" \ --commission-max-change-rate "0.01" \ --min-self-delegation "1" \ --pubkey "$(cohod tendermint show-validator)" \ --from $COSMIC_WALLET \ --chain-id $COSMIC_CHAIN

We write the address of the validator into a variable (the same password will need to be entered)

COSMIC_VALOPER=$(cohod keys show $COSMIC_WALLET --bech val -a)

Adding variable to bash_profile

echo 'export COSMIC_VALOPER='${COSMIC_VALOPER} >> $HOME/.bash_profile source $HOME/.bash_profile

Checking the status of the validator:

cohod query staking validator $COSMIC_VALOPER

Now how to delegate funds to the validator:

cohod tx staking delegate $COSMIC_VALOPER [delegation sum in digits (square brackets removed) ]ucoho --from $COSMIC_WALLET --chain-id $COSMIC_CHAIN

Well, if suddenly your node got into jail, then the output is:

cohod tx slashing unjail --from $COSMIC_WALLET --chain-id $COSMIC_CHAIN

Thank you very much for your attention and time

Sincerely, MMS_Team