Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for the full hd_path instead of just the coin type #1049

Closed
5 tasks done
greg-szabo opened this issue Jun 5, 2021 · 4 comments · Fixed by #1061
Closed
5 tasks done

Support for the full hd_path instead of just the coin type #1049

greg-szabo opened this issue Jun 5, 2021 · 4 comments · Fixed by #1061
Assignees
Labels
O: new-feature Objective: cause to add a new feature or support
Milestone

Comments

@greg-szabo
Copy link
Member

greg-szabo commented Jun 5, 2021

Crate

relayer-cli
relayer (possibly)

Background

https://learnmeabitcoin.com/technical/derivation-paths

Summary

The hermes keys restore -t option allows the user to tell hermes the coin type used in the wallet hardened derivation path. Although this is the most commonly overwritten section of the BIP44 HD path, in some cases other sections might be overwritten too. Hence we need hermes to support overwriting the full HD path.

Problem Definition

The crypto.com mainnet's hdpath is m/44'/394'/0'/0/1 and during a testnet run I noticed that hermes doesn't recover the correct key. Forcing the testnet to use m/44'/394'/0'/0/0 made hermes work.

We would like to relay on the crypto.com mainnet, hence we need to be able to set the hd path in hermes when recovering keys.

Proposal

Implement --hdpath or similar for hermes keys restore. I would be grateful to be able to pass the absolute HD path (starting with m), the same way gaiad accepts it.

Acceptance Criteria

hermes imports the correct key on the crypto.com testnet/mainnet.


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate milestone (priority) applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@greg-szabo greg-szabo added this to the 06.2021 milestone Jun 5, 2021
@greg-szabo
Copy link
Member Author

Note: crypto.com's hd path definitions: https://github.com/crypto-org-chain/chain-main/search?q=cointype

@ancazamfir
Copy link
Collaborator

Thanks Greg! Could you please specify the equivalent gaia command? Also a concrete example input for hermes keys restore --hdpath CLI and testnet information where we can test once we have the fix.

@romac romac self-assigned this Jun 7, 2021
@romac romac added the O: new-feature Objective: cause to add a new feature or support label Jun 7, 2021
@greg-szabo
Copy link
Member Author

The relevant gaiad command to create a key:

$ gaiad keys add mycustomkey --hd-path "44'/394'/0'/0/1" --keyring-backend test

- name: mycustomkey
  type: local
  address: cosmos1f6rdru2cepyf4k940kcnl3wkrelk3l7myj4jt6
  pubkey: cosmospub1addwnpepq0f4mmmjhjmq9ut5uy498unja3mng4yc40vwrdr3eks2wcygpseqk6ukp4v
  mnemonic: ""
  threshold: 0
  pubkeys: []


**Important** write this mnemonic phrase in a safe place.
It is the only way to recover your account if you ever forget your password.

poverty siren seven divert love wash awkward woman access keep term also easy easily guilt burden wide velvet firm boss donor deliver example health

The hermes keys restore (v0.4.0) command announces a different key:

$ hermes keys restore ibc-0 -t 394 -n mycustomkey -m "poverty siren seven divert love wash awkward woman access keep term also easy easily guilt burden wide velvet firm boss donor deliver example health"
Jun 07 09:09:59.842  INFO ibc_relayer_cli::commands: using default configuration from '/Users/greg/.hermes/config.toml'
Success: Restored key 'mycustomkey' (cosmos1xeck04nsy6fedkn4y4k8nd9msms0p4c0rw9548) on chain ibc-0

@greg-szabo
Copy link
Member Author

Note: if the account_index is set to 0 in gaiad, the same key as hermes is imported:

$ gaiad keys add mycustomkey --recover --hd-path "44'/394'/0'/0/0" --keyring-backend test
override the existing name mycustomkey [y/N]: y
> Enter your bip39 mnemonic
poverty siren seven divert love wash awkward woman access keep term also easy easily guilt burden wide velvet firm boss donor deliver example health

- name: mycustomkey
  type: local
  address: cosmos1xeck04nsy6fedkn4y4k8nd9msms0p4c0rw9548
  pubkey: cosmospub1addwnpepqtkgxep92nrfm5fez3v0n779vewfntl66nn9ca692z9ses98e8vludxxc86
  mnemonic: ""
  threshold: 0
  pubkeys: []

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O: new-feature Objective: cause to add a new feature or support
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants