Cosmos-sdk: Gaiacli generates the same address irrespective of the --account argument

Created on 29 Jan 2019  路  6Comments  路  Source: cosmos/cosmos-sdk

Summary of Bug

When recovering addresses, gaiacli seems to ignore the account argument.

This issue is related to #3345

Steps to Reproduce

Using the same mnemonic, run the following commands:

gaiacli keys add gaia0 --recover --account 0
gaiacli keys add gaia1 --recover --account 1
gaiacli keys add gaia152 --recover --account 152

In all cases, the same address and pubkey will be generated.


For Admin Use

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

Most helpful comment

I think giving the option to specify the full BIP44 path may be a bit dangerous - changing the first two fields could result in conflicts with other coins. Is there any reason a user would need to do that? Unless there is, I would vote to standardize on --account and --index` - and document those better.

All 6 comments

It looks like the --account flag isn't being respected in the gaiacli keys add implementation

yes, I would say that having both --account and --index is a bit confusing

https://github.com/cosmos/cosmos-sdk/blob/b8843fcd8095422a7cf4d788893d158759e561b8/client/keys/add.go#L75-L76

@gamarin2 @alessio FYI

Flags:
      --account uint32            Account number for HD derivation
      --bip44-path string         BIP44 path from which to derive a private key (default "44'/118'/0'/0/0")
      --index uint32              Index number for HD derivation

Now, the confusing part is that:

  • With Ledger:

    • USED: --account and --index ({44, 118, account, 0, index})

    • IGNORED: --bip44-path

  • Without Ledger:

    • IGNORED: --account and --index

    • USED: --bip44-path

This is very confusing and not clear in the docs or flag description.

Reference:
https://github.com/cosmos/cosmos-sdk/blob/24876aa47b57e931e1988e20c7dbbeab8b59372a/client/keys/add.go#L171-L190

I think giving the option to specify the full BIP44 path may be a bit dangerous - changing the first two fields could result in conflicts with other coins. Is there any reason a user would need to do that? Unless there is, I would vote to standardize on --account and --index` - and document those better.

I think giving the option to specify the full BIP44 path may be a bit dangerous

I very much agree to that

Closed by #3461

Was this page helpful?
0 / 5 - 0 ratings

Related issues

faboweb picture faboweb  路  3Comments

ValarDragon picture ValarDragon  路  3Comments

rigelrozanski picture rigelrozanski  路  3Comments

fedekunze picture fedekunze  路  3Comments

cwgoes picture cwgoes  路  3Comments