Cosmos 3 Hub upgrade “Guide”

Cosmos Hub 2 is here today and is preparing for the next software upgrade to Cosmos Hub 3, this is one unofficial guide about how to upgrade if you are in the Hub 2 or if you want to start one node in the Cosmos Hub 3.

As $ATOM is a blockchain running millions of dollars and this situation of doing an upgrade in this way is a procedure that requires your attention, we will not add memes or Gif during the guide.

NOTE: Be sure you have a completely backed up state of your node before proceeding with this step. See Recovery for details on how to proceed.

The first thing you should know is that you must update if you want to continue in the last network update.

The second important thing is that you cannot update or run a node in Cosmos Hub-3 before block 2,902,000, or approx. 3PM UTC

Here we go.

We will start assuming that you are currently running a node in Cosmos Hub-2 and want to update live to Cosmos Hub 3 in the indicated block.

The following tests were performed and then transmitted in this guide, each personal configuration on the servers is different according to your operator, so take this guide as a reference and adapt it to your configuration if necessary. We are not responsible if after following this guide your node is broken or does not work anymore, it will not be our responsibility in any way if you decide to continue with this procedure described here without guarantees it is your own responsibility.

start

Creating the new genesis.json for Cosmos hub-3

First, you must be sure that you are currently in any of these two versions of Gaia “cosmos-sdk: 0.34.6 or 0.34.7”

“cosmos-sdk: 0.34.6 or 0.34.7” TO REPRODUCE THIS GUIDE BECAUSE WE DONT TEST IN OTHERS VERSION, IS YOUR CALL TEST OTHER VERSION.

gaiad version --long

cosmos-sdk: 0.34.9
git commit: ad3335b3b6ef958e65c302144803bd358fd45df0
vendor hash: 7e6cfc6e73d3aafb2d3952d2f90a14907bbb637bbc720cf1246761062d59cb24
build tags: netgo ledger
go version go1.12.4 linux/amd64

With this software is not recommended, we need

Creating the new genesis.json for Cosmos hub-3

First, you must be sure that you are currently in any of these two versions of Gaia “cosmos-sdk: 0.34.6+”

cosmos-sdk: 0.34.6 or 0.34.7

This software was tested for this guide and works.

Now we are going to install these versions, if you are in a higher or lower version you must follow these steps.
this step you only have to carry out in one of your nodes to export the new genesis.json file for the Cosmos hub-3, after generating it you have to pass it to your other servers but you don’t need to create it in each one.

cd cosmos-sdk
git pull
git checkout v0.34.6
GO111MODULE=on go mod tidy; make install
gaiad version
# v0.34.6
go version
# go1.12.4 linux/amd64

Remember official info and Instruction here

The following document describes the necessary steps involved that full-node operators must take in order to upgrade from cosmoshub-2 to cosmoshub-3. The Tendermint team will post an official updated genesis file, but it is recommended that validators execute the following instructions in order to verify the resulting genesis file.

There is a strong social consensus around proposal Cosmos Hub 3 Upgrade Proposal E on cosmoshub-2. This indicates that the upgrade procedure should be performed on December 11, 2019 at or around 14:27 UTC on block 2,902,000.

Tip: During the jump process you need to delete the database, but if the procedure gets to fail, you will need that database again to start again Cosmos hub2.

Backup the Cosmos Blockchain

In which block do it, is your call, I will only tell you that it must be in block 2,901,999 or earlier, but you are interested in being close to this block so as not to be disconnected from the network in case you have to go back to Cosmos Hub-2

First need to stop the cosmos software AkA gaia, after stop can start the backup process. It can be from a validator or full node.

Open the directory where is located the folder that contains the data to make the backup file.

cd .gaiad

Folder data, compress that directory

tar -czvf data.tar.gz data

Now you have the backup and the OG database on the same Dir.

data.tar.gz

Creating the genesis file for the Cosmos Hub-3

gaiad export --for-zero-height --height=2902000 > cosmoshub_2_genesis_export.json

Verify the SHA256

jq -S -c -M '' cosmoshub_2_genesis_export.json | shasum -a 256 
[PLACEHOLDER] cosmoshub_2_genesis_export.json

Now the genesis.json for the cosmos hub -3 can verify with others Validators on the Riot chat for Validators

Upgrade software to Cosmos Hub 3

This step now is for the upgrade to v2.0.3 of Gaia. The software for Cosmos Hub-3

First, this is the version of GOLAND requiered 1.13

Update GO to go1.13 before upgrade Cosmos Hub 3

#Remove old go / used yur PATH
sudo rm -rf /usr/local/go
#Download last go
wget https://dl.google.com/go/go1.13.linux-amd64.tar.gz
#Descompress
sudo tar -C /usr/local -xzf go1.13.linux-amd64.tar.gz
go version
#go version go1.13 linux/amd64

Install Cosmos gaiad to Cosmos Hub 3

git clone https://github.com/cosmos/gaia.git && cd gaia && git checkout v2.0.3; make install
$gaiad version --long
name: gaia
server_name: gaiad
client_name: gaiacli
version: 2.0.3
commit: 2f6783e298f25ff4e12cb84549777053ab88749a
build_tags: netgo,ledger
go: go version go1.13 linux/amd64

Migrate exported state from the current v0.34.6+ version to the new v2.0.3 version

gaiad migrate v0.36 cosmoshub_2_genesis_export.json — chain-id=cosmoshub-3 — genesis-time=[PLACEHOLDER]> genesis.json

NOTE: The migrate command takes an input genesis state and migrates it to a targeted version. Both v0.36 and v0.37 are compatible as far as state structure is concerned.

Genesis time should be computed relative to the blocktime of 2,902,000. The genesis time shall be the blocktime of 2,902,000 + 60 minutes with the subseconds truncated.

An example shell command(tested on OS X Mojave) to compute this values is:

curl https://stargate.cosmos.network:26657/block\?height\=2902000 | jq -r ‘.result[“block_meta”][“header”][“time”]’|xargs -0 date -v +60M -j -f “%Y-%m-%dT%H:%M:%S” +”%Y-%m-%dT%H:%M:%SZ”

Change the genesis to 125 max validators

Approved this on proposal 10

cat genesis.json | jq '.app_state["staking"]["params"]["max_validators"]=125' > tmp_genesis.json && mv tmp_genesis.json genesis.json

Verify the SHA256 of the final genesis.json

jq -S -c -M '' genesis.json | shasum -a 256
[PLACEHOLDER] genesis.json

Delete DB from Cosmos Hub-2 to go at Cosmos Hub-3

gaiad unsafe-reset-all

Move the genesis.json from Cosmos Hub-2

mkdir $HOME/genesis-hub-2
mv .gaiad/config/genesis.json $HOME/genesis-hub-2

Move the genesis.json from Cosmos Hub-3

mv genesis.json $HOME/.gaiad/config

Update config.toml

vi gaiad/config/config.toml
db_backend = "goleveldb"

Renamed gaiad.toml to app.toml

mv .gaiad/config/gaiad.toml .gaiad/config/app.toml

Here you can review your steps if you need or just start Cosmos Hub-3

gaiad start

This is a work of a community validator, remember to support us

melea Validators

Tips Cosmos address:

cosmos1zqgheeawp7cmqk27dgyctd80rd8ryhqsltfszt

Cosmos Validator:

melea-◮👁◭

Owner

cosmosvaloper1zqgheeawp7cmqk27dgyctd80rd8ryhqs6la9wc

https://meleatrust.com/cosmos-melea-trust-validator/

Good Luck!