Cosmos-sdk: invalid Bech32 prefix; expected cosmos, got cosmosaccaddr

Created on 31 Oct 2018  路  13Comments  路  Source: cosmos/cosmos-sdk

Summary of Bug

Cannot run gaiad to join testnet.

panic: invalid Bech32 prefix; expected cosmos, got cosmosaccaddr

gaiad version
0.25.0-0-g7c5c14f2

Steps to Reproduce

After installation and init Gaiad and seeds.

gaiad start

Then received error

Developer-MacBook-Pro:~ developer$ gaiad start
I[11-01|08:51:42.553] Starting ABCI with Tendermint                module=main 
I[11-01|08:51:42.569] Starting multiAppConn                        module=proxy impl=multiAppConn
I[11-01|08:51:42.569] Starting localClient                         module=abci-client connection=query impl=localClient
I[11-01|08:51:42.569] Starting localClient                         module=abci-client connection=mempool impl=localClient
I[11-01|08:51:42.569] Starting localClient                         module=abci-client connection=consensus impl=localClient
I[11-01|08:51:42.569] ABCI Handshake                               module=consensus appHeight=0 appHash=
I[11-01|08:51:42.569] ABCI Replay Blocks                           module=consensus appHeight=0 storeHeight=0 stateHeight=0
panic: invalid Bech32 prefix; expected cosmos, got cosmosaccaddr

goroutine 1 [running]:
github.com/cosmos/cosmos-sdk/cmd/gaia/app.(*GaiaApp).initChainer(0xc000c51000, 0x4db1fa0, 0xc0008ca930, 0xc0000c5940, 0xb, 0x75bcd15, 0xed30dbd80, 0x0, 0xc000c268d0, 0x9, ...)
    /Users/developer/Desktop/Projects/Github/cosmos/tmpgopath/src/github.com/cosmos/cosmos-sdk/cmd/gaia/app/app.go:228 +0x104d
github.com/cosmos/cosmos-sdk/cmd/gaia/app.(*GaiaApp).initChainer-fm(0x4db1fa0, 0xc0008ca930, 0xc0000c5940, 0xb, 0x75bcd15, 0xed30dbd80, 0x0, 0xc000c268d0, 0x9, 0xc0008ca3f0, ...)
    /Users/developer/Desktop/Projects/Github/cosmos/tmpgopath/src/github.com/cosmos/cosmos-sdk/cmd/gaia/app/app.go:161 +0xb6
github.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).InitChain(0xc000b16780, 0x75bcd15, 0xed30dbd80, 0x0, 0xc000c268d0, 0x9, 0xc0008ca3f0, 0xc00092d000, 0x6a, 0x6a, ...)

For Admin Use

  • [ ] Not duplicate issue
  • [ ] Appropriate labels applied
  • [ ] Appropriate contributors tagged
  • [ ] Contributor assigned/self-assigned
CLI bug

Most helpful comment

Ah our bad! Whats going on here is we changed the default bech32 prefix string. We forgot to make the keybase auto-upgrade (we kinda all forgot about it since its been 2 months since last release and our development keybase's had all already changed)

We should make an auto-conversion script in the keybase.Get functionality, should be relatively simple.
I think we need this for game of stakes anyway, since we had people already submit their addresses, and latest release was v0.24 at the time.

EDIT: Just tested going from v0.24 to v0.25 and it did auto-convert. Not sure whats going on here, I couldn't replicate.

All 13 comments

Ah our bad! Whats going on here is we changed the default bech32 prefix string. We forgot to make the keybase auto-upgrade (we kinda all forgot about it since its been 2 months since last release and our development keybase's had all already changed)

We should make an auto-conversion script in the keybase.Get functionality, should be relatively simple.
I think we need this for game of stakes anyway, since we had people already submit their addresses, and latest release was v0.24 at the time.

EDIT: Just tested going from v0.24 to v0.25 and it did auto-convert. Not sure whats going on here, I couldn't replicate.

hi @ValarDragon I did a fresh install of cosmos-sdk on 0.25.0-0-g7c5c14f2
so maybe it can convert from 0.24 to 0.25 but not for fresh install?

There is no need for auto-conversion here.

I've got the exact same issue. If I try to build the latest release from scratch and start the net client, I get the error from above. I had to reverse back to version v0.24.2.

Just to clarify, you're running the latest build/version off of the old pre-existing chain (v0.24.x based)?

@alexanderbez
I followed the docs and successfully built the latest release of Cosmos-SDK (v0.25.0), but alas, I couldn't make it work. gaiad start panicked with message: panic: invalid Bech32 prefix; expected cosmos, got cosmosaccaddr

A guy in Cosmos-sdk riot channel said he couldn't run the latest version, but was able to run the Testnet (Gaia-8001) using Cosmos-SDK v0.24.2-50675b80 on master branch. So I build that version (had to update deps as mentioned in
https://github.com/cosmos/cosmos-sdk/issues/265) and finally made it work - the syncing process started.

Ok, so the latest master worked for you on the existing chain but the latest develop didn't?

Running 0.25.0-0-0-g7c5c14f and having this same panic error on 8001

Ahhh ok, to clarify. You are using 8001 (v0.24.x) genesis state on the v0.25 code. Indeed, this will not work in GoS (v0.26.x) as the Bech32 prefixes have been updated.

So yes, afaik, when we launch GoS, if we want to import any state from 8001, we'll need to convert the addresses in the genesis file. However, if we're starting from a clean slate (nothing from 8001), then we don't need to do anything.

/cc @ValarDragon @zmanian

Ok, so I tried:

  1. Clean install (no previous 8001 (v0.24.x) genesis state) => Compile 0.25.0-0-0-g7c5c14f and gaiad start which gives: panic: invalid Bech32 prefix; expected cosmos, got cosmosaccaddr.

  2. Compile v0.24.2- 1c38c70 and update to 0.25.0-0-0-g7c5c14f which gives same error and it seems to be the scenario that you've just described in above post.

  3. Add and update github.com/brejski/hid (https://github.com/cosmos/cosmos-sdk/issues/2253) and get same error.

@bneiluj please double check your setup and make sure you are indeed using a clean state. I am able to successfully start new chains on tag v0.25.0.

  1. git checkout v0.25.0
  2. make get_vendor_deps install build-linux
  3. make localnet-start
  4. docker logs -f gaiadnode0 and verify logs

I'd like to close this issue and open another on a strategy of GoS genesis state.

Thanks @alexanderbez, I got it working by reverting to v0.24.x

Closing this as it'll not be needed for GoS.

Was this page helpful?
0 / 5 - 0 ratings