How to Upgrade Your Cosmos Full Node to Mainnet

Updated: 15.03.2019

In a previous article, we went from setting up your Go development environment, in order to install the Cosmos Network SDK, to joining the gaia-13k testnet. The Tendermint team has finally launched the mainnet cosmoshub-1 (source). This how-to guide is a step-by-step guide to upgrade to from the latest testnet to mainnet.

About This Guide

  • Commands start with $:
$ this is a command do not copy the dollar sign!
  • Comments start with #:
# this is a comment make sure you read them!
  • Sample outputs start with an arrow:
➜ this is an example command line output useful for comparing
Planet Earth

Requirements

I will assume that you have all the required tools and have successfully downloaded and installed gaia before. If not, make sure you follow the Requirements section in this article.

Installing the Latest Cosmos SDK Release

  1. Let’s pull the latest release (source). At the time of writing, this is v0.33.0:
$ cd $GOPATH/src/github.com/cosmos
$ git pull
$ cd cosmos-sdk && git checkout v0.33.0
➜ Previous HEAD position was 906e9509 PENDING => CHANGELOG; linkify
HEAD is now at 7b4104ac Release v0.33.0

2. If you had installed the Cosmos SDK before, you might need to remove these files. Note that the Makefile changes quite frequently:

$ rm -r vendor
# run if applicable
$ rm vendor-deps
# run if applicable

3. Let’s install the dependencies and the latest release. On Mac, this might trigger prompts on allowing connections:

$ make vendor-deps 
# this takes a while
$ make all
# this takes a while

4. Let’s check the binaries:

$ gaiad version --long
➜ cosmos-sdk: 0.33.0
git commit: 7b4104aced52aa5b59a96c28b5ebeea7877fc4f0
vendor hash: 0341b356ad7168074391ca7507f40b050e667722
build tags: netgo ledger
go version go1.11.5 darwin/amd64
$ gaiacli version --long
➜ cosmos-sdk: 0.33.0
git commit: 7b4104aced52aa5b59a96c28b5ebeea7877fc4f0
vendor hash: 0341b356ad7168074391ca7507f40b050e667722
build tags: netgo ledger
go version go1.11.5 darwin/amd64

Running a Cosmos Full Node on Mainnet (Cosmoshub-1)

  1. Let’s re-setup the initial configuration for a full node. Change <moniker> for your prefered nickname:
$ gaiad init <moniker>

2. This might fail due to an existing genesis file (the path to the file should show up), in that case remove it:

$ rm $HOME/.gaiad/config/genesis.json
# check the path that is printed on your command line

3. Let’s pull the genesis file from cosmoshub-1 (source):

$ curl https://raw.githubusercontent.com/cosmos/launch/master/genesis.json > $HOME/.gaiad/config/genesis.json

4. Let’s add a persistent peer*. In the .gaiad/config/config.toml file, go to lines ~117–118 persistent_peers = "". Additionally, make sure you remove old peers that might be in sync with old chains:

persistent_peers = "89e4b72625c0a13d6f62e3cd9d40bfc444cbfa77@34.65.6.52:26656"
# this is one of public full nodes

*On mainnet, if you are a genesis validator, you might want to add seed peers, the peers that your node will connect to at the beginning but not in the future, which will be released by the Tendermint team before mainnet launch. Seed peers are used only once, whereas persistent_peers are peers to which your node continuously connects to. On mainnet, make sure you can trust the persistent peers before adding them to the config file.

5. Let’s remove the files from the previous testnet (old chain):

$ gaiad unsafe-reset-all

6. Let’s start your Cosmos mainnet node:

$ gaiad start --log_level="*:info"
Local Node Synching with Gaia-13K

Depending on when you joined cosmoshub-1 and your CPU, it might take a while until your local full node is synched. When synched, you will see less messages printed on the command line. If you are planning to run a full node on mainnet, make sure you join as soon as possible after launch.

Follow us on Medium and Twitter to stay updated on the newest articles! 🌌