Upgrading `priv_validator.json`

Upgrading from gaia-6002 to gaia-7000

These instructions are for full nodes that have ran on previous testnets and would like to upgrade to the latest testnet.

Reset Data

First, remove the outdated files and reset the data.

rm $HOME/.gaiad/config/addrbook.json $HOME/.gaiad/config/genesis.json

Additionally there was a change in the format of the ~/.gaiad/config/priv_key.json in the latest release of Tendermint core (through go-amino).

To switch your key to the new format you will need to change three type fields from random strings to human readable names. The following fields need to be changed:

.pub_key.type        -> tendermint/PubKeyEd25519
.last_signature.type -> tendermint/SignatureEd25519
.priv_key.type       -> tendermint/PrivKeyEd25519

You will also need to quote the last_height and last_round fields.

Examples of new and old files are below:

OLD FORMAT ~/.gaiad/config/priv_validator.json

{
  "address": "3932BFD12BC9584ECCBE38F9CCFA97FA173CC873",
  "pub_key": {
    "type": "AC26791624DE60",
    "value": "wSTygw+OfryqInQu0xVS3rGTnSjBXjWC8jHY/TzgvSE="
  },
  "last_height": 519423,
  "last_round": 0,
  "last_step": 3,
  "last_signature": {
    "type": "6BF5903DA1DB28",
    "value": "Q4xlUcJVyRGHj7VB3kY2amy7v+hANPCY4NKHGj7EKVHAteJdPwAYnQeZjBXfxG5q1gbc/uKC8iDuf1iGjJqDDg=="
  },
  "last_signbytes": "7B2240636861696E5F6964223A22676169612D36303032222C224074797065223A22766F7465222C22626C6F636B5F
6964223A7B7D2C22686569676874223A3531393432332C22726F756E64223A302C2274696D657374616D70223A22323031382D30362D3237543
0373A33323A35312E3130395A222C2274797065223A327D",
  "priv_key": {
    "type": "954568A3288910",
    "value": "ATGo9d0Xxu4idtmDbQqgpnNSw1dPz6MVW+TlibVEZGTBJPKDD45+vKoidC7TFVLesZOdKMFeNYLyMdj9POC9IQ=="
  }
}

NEW FORMAT ~/.gaiad/config/priv_validator.json

{
  "address": "3932BFD12BC9584ECCBE38F9CCFA97FA173CC873",
  "pub_key": {
    "type": "tendermint/PubKeyEd25519",
    "value": "wSTygw+OfryqInQu0xVS3rGTnSjBXjWC8jHY/TzgvSE="
  },
  "last_height": "519423",
  "last_round": "0",
  "last_step": 3,
  "last_signature": {
    "type": "tendermint/SignatureEd25519",
    "value": "Q4xlUcJVyRGHj7VB3kY2amy7v+hANPCY4NKHGj7EKVHAteJdPwAYnQeZjBXfxG5q1gbc/uKC8iDuf1iGjJqDDg=="
  },
  "last_signbytes": "7B2240636861696E5F6964223A22676169612D36303032222C224074797065223A22766F7465222C22626C6F636B5F
6964223A7B7D2C22686569676874223A3531393432332C22726F756E64223A302C2274696D657374616D70223A22323031382D30362D3237543
0373A33323A35312E3130395A222C2274797065223A327D",
  "priv_key": {
    "type": "tendermint/PrivKeyEd25519",
    "value": "ATGo9d0Xxu4idtmDbQqgpnNSw1dPz6MVW+TlibVEZGTBJPKDD45+vKoidC7TFVLesZOdKMFeNYLyMdj9POC9IQ=="
  }
}

Next run the following command to reset your node:

gaiad unsafe_reset_all

Your node is now in a pristine state while keeping the original priv_validator.json and config.toml. If you had any sentry nodes or full nodes setup before, your node will still try to connect to them, but may fail if they haven’t also been upgraded.

WARNING: Make sure that every node has a unique priv_validator.json. Do not copy the priv_validator.json from an old node to multiple new nodes. Running two nodes with the same priv_validator.json will cause you to double sign.

Software Upgrade

Now it is time to upgrade the software:

cd $GOPATH/src/github.com/cosmos/cosmos-sdk
git fetch --all && git checkout v0.19.0
make update_tools && make get_vendor_deps && make install
Your full node has been cleanly upgraded!
4 Likes

Maybe few steps missings? have the error:
Error reading PrivValidator from /root/.gaiad/config/priv_validator.json: encoding/hex: invalid byte: U+0074 't'
more people on Riot chat have the same problem :grinning:

But that format is for gaia-7000
so is ok the error in gaia-6002 imo.
when gaia-7000 is ready, this format works for my understand.

if you see, you are in gaia-6002 today, not in 7000 yet.
:wink:

Yes, I think this guide is for something like beta gaia-7000 :sweat_smile:
I just want to try gaia-7000 anyway. :rofl:

1 Like

@wimel Hold on for a couple more days! We will be launching gaia-7000 early next week. Need to make sure we get all the fixes from gaia-6002 into gaiad and we are running a small internal testnet first. We will keep you updated here!

2 Likes

I don’t have a “last_signature” entry in my file. Is that because I wasn’t validating on 6002?

@chris-chainflow Yup! No need to worry about that one.

1 Like

this could be so complicated, we need to get some tools ^^

This is a one time migration that doesn’t affect any funds so I don’t think we will build tooling specifically for this.