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

Add key child --path command for CLI key derivation #1353

Closed
1 task done
Anviking opened this issue Feb 17, 2020 · 4 comments
Closed
1 task done

Add key child --path command for CLI key derivation #1353

Anviking opened this issue Feb 17, 2020 · 4 comments
Assignees

Comments

@Anviking
Copy link
Collaborator

Anviking commented Feb 17, 2020

Context

ADP-81

The groundwork for CLI key derivation is being established in #1316.

Decision

Implement command for deriving child keys, according to the example:

  $ key child --path 44'/1815'/0'/0 5bd164a28...1ae275939
  0d0a62eef...6f2aee621

Acceptance Criteria

  • We must be able to derive keys using hard derivation.
  • We must support soft derivation on relevant paths.

Development

QA

@KtorZ
Copy link
Member

KtorZ commented Feb 18, 2020

We may (?) support soft derivation.

We must, on relevant paths.

@Anviking
Copy link
Collaborator Author

@KtorZ

How will we know whether to use DerivationScheme1 or DerivationScheme2?

It seems Byron / Random keys are using derivation scheme 1, but Icarus (and Shelley) is using scheme 2.

Do we have to take a --type KEY-TYPE cli option?

https://github.com/input-output-hk/cardano-wallet/blob/master/lib/core/src/Cardano/Wallet/Primitive/AddressDerivation/Icarus.hs#L325

https://github.com/input-output-hk/cardano-wallet/blob/master/lib/core/src/Cardano/Wallet/Primitive/AddressDerivation/Byron.hs#L326

@KtorZ
Copy link
Member

KtorZ commented Feb 20, 2020

It seems Byron / Random keys are using derivation scheme 1, but Icarus (and Shelley) is using scheme 2.

Yes.

Do we have to take a --type KEY-TYPE cli option?

No, rather a --byron flag, if present, use derivation scheme 1, if not, use derivation scheme 2.

iohk-bors bot added a commit that referenced this issue Mar 3, 2020
1370: Add cli `key child` command r=Anviking a=Anviking

# Issue Number

#1353 

# Overview

- [x] Preparatory addition of CLI `DerivationIndex` and `DerivationPath` types
- [x] Make `mapKey` xprv to hex transformation bidirectional
- [x] Add `key child --path` command to cli
- [x] Confirming that we can derive an actual wallet address key using `key child` as a manual golden test.

# Comments
- [ ] Not here: Parsing hexadecimal indexes e.g `0x8000073c` (could be neat 🤷‍♂ )

Manual example. Note that `to-pub` is not functionality of `cardano-wallet` — yet.
```bash
$ cardano-wallet-jormungandr key child --path "2147485500/2147485463/0'/0/0" 588102383ed9ecc5c44e1bfa18d1cf8ef19a7cf806a20bb4cbbe4e511666cf48d6fd7bec908e4c6ced5f0c4f0798b1b619d6b61e6110492b5ebb430f570488f074a9fc9a22f0a61b2ab9b1f1a990e3f8dd6fbed4ad474371095c74db3d9c743a | to-pub
eb806fca3bfda11ae14dee52c5ad6564e68e7531c1a1d498a76172898d2841cb3d9078e802011f1580465c80e7040f1e4d8e24f978d23f01c1d2cf18fcf741a7

# Address comes from an actual empty wallet:
$ jcli address info addr1sn4cqm728076zxhpfhh993ddv4jwdrn4x8q6r4yc5ash9zvd9pqukyh6fnkrsrsz4w9jvu8hyre20xm7m78jf4kww4h2n5maytuhtflrax9duz
discrimination: testing
public key: ed25519_pk1awqxlj3mlks34c2daefvttt9vnnguaf3cxsafx98v9egnrfgg89s4y7wfm
group key:  ed25519_pk1ztayempcpcp2hzexwrmjpu48ndldlrey6m882m4f6d7j97t45l3s5h5gl4
```

<!-- Additional comments or screenshots to attach if any -->

<!-- 
Don't forget to:

 ✓ Self-review your changes to make sure nothing unexpected slipped through
 ✓ Assign yourself to the PR
 ✓ Assign one or several reviewer(s)
 ✓ Once created, link this PR to its corresponding ticket
 ✓ Assign the PR to a corresponding milestone
 ✓ Acknowledge any changes required to the Wiki
-->


Co-authored-by: Johannes Lund <johannes.lund@iohk.io>
iohk-bors bot added a commit that referenced this issue Mar 3, 2020
1370: Add cli `key child` command r=Anviking a=Anviking

# Issue Number

#1353 

# Overview

- [x] Preparatory addition of CLI `DerivationIndex` and `DerivationPath` types
- [x] Make `mapKey` xprv to hex transformation bidirectional
- [x] Add `key child --path` command to cli
- [x] Confirming that we can derive an actual wallet address key using `key child` as a manual golden test.

# Comments
- [ ] Not here: Parsing hexadecimal indexes e.g `0x8000073c` (could be neat 🤷‍♂ )

Manual example. Note that `to-pub` is not functionality of `cardano-wallet` — yet.
```bash
$ cardano-wallet-jormungandr key child --path "2147485500/2147485463/0'/0/0" 588102383ed9ecc5c44e1bfa18d1cf8ef19a7cf806a20bb4cbbe4e511666cf48d6fd7bec908e4c6ced5f0c4f0798b1b619d6b61e6110492b5ebb430f570488f074a9fc9a22f0a61b2ab9b1f1a990e3f8dd6fbed4ad474371095c74db3d9c743a | to-pub
eb806fca3bfda11ae14dee52c5ad6564e68e7531c1a1d498a76172898d2841cb3d9078e802011f1580465c80e7040f1e4d8e24f978d23f01c1d2cf18fcf741a7

# Address comes from an actual empty wallet:
$ jcli address info addr1sn4cqm728076zxhpfhh993ddv4jwdrn4x8q6r4yc5ash9zvd9pqukyh6fnkrsrsz4w9jvu8hyre20xm7m78jf4kww4h2n5maytuhtflrax9duz
discrimination: testing
public key: ed25519_pk1awqxlj3mlks34c2daefvttt9vnnguaf3cxsafx98v9egnrfgg89s4y7wfm
group key:  ed25519_pk1ztayempcpcp2hzexwrmjpu48ndldlrey6m882m4f6d7j97t45l3s5h5gl4
```

<!-- Additional comments or screenshots to attach if any -->

<!-- 
Don't forget to:

 ✓ Self-review your changes to make sure nothing unexpected slipped through
 ✓ Assign yourself to the PR
 ✓ Assign one or several reviewer(s)
 ✓ Once created, link this PR to its corresponding ticket
 ✓ Assign the PR to a corresponding milestone
 ✓ Acknowledge any changes required to the Wiki
-->


Co-authored-by: Johannes Lund <johannes.lund@iohk.io>
iohk-bors bot added a commit that referenced this issue Mar 3, 2020
1370: Add cli `key child` command r=Anviking a=Anviking

# Issue Number

#1353 

# Overview

- [x] Preparatory addition of CLI `DerivationIndex` and `DerivationPath` types
- [x] Make `mapKey` xprv to hex transformation bidirectional
- [x] Add `key child --path` command to cli
- [x] Confirming that we can derive an actual wallet address key using `key child` as a manual golden test.

# Comments
- [ ] Not here: Parsing hexadecimal indexes e.g `0x8000073c` (could be neat 🤷‍♂ )

Manual example. Note that `to-pub` is not functionality of `cardano-wallet` — yet.
```bash
$ cardano-wallet-jormungandr key child --path "2147485500/2147485463/0'/0/0" 588102383ed9ecc5c44e1bfa18d1cf8ef19a7cf806a20bb4cbbe4e511666cf48d6fd7bec908e4c6ced5f0c4f0798b1b619d6b61e6110492b5ebb430f570488f074a9fc9a22f0a61b2ab9b1f1a990e3f8dd6fbed4ad474371095c74db3d9c743a | to-pub
eb806fca3bfda11ae14dee52c5ad6564e68e7531c1a1d498a76172898d2841cb3d9078e802011f1580465c80e7040f1e4d8e24f978d23f01c1d2cf18fcf741a7

# Address comes from an actual empty wallet:
$ jcli address info addr1sn4cqm728076zxhpfhh993ddv4jwdrn4x8q6r4yc5ash9zvd9pqukyh6fnkrsrsz4w9jvu8hyre20xm7m78jf4kww4h2n5maytuhtflrax9duz
discrimination: testing
public key: ed25519_pk1awqxlj3mlks34c2daefvttt9vnnguaf3cxsafx98v9egnrfgg89s4y7wfm
group key:  ed25519_pk1ztayempcpcp2hzexwrmjpu48ndldlrey6m882m4f6d7j97t45l3s5h5gl4
```

<!-- Additional comments or screenshots to attach if any -->

<!-- 
Don't forget to:

 ✓ Self-review your changes to make sure nothing unexpected slipped through
 ✓ Assign yourself to the PR
 ✓ Assign one or several reviewer(s)
 ✓ Once created, link this PR to its corresponding ticket
 ✓ Assign the PR to a corresponding milestone
 ✓ Acknowledge any changes required to the Wiki
-->


Co-authored-by: Johannes Lund <johannes.lund@iohk.io>
@piotr-iohk
Copy link
Contributor

lgtm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants