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

Convert a dRep extended vkey to a non-extended one: #358

Closed
CarlosLopezDeLara opened this issue Oct 9, 2023 · 8 comments · Fixed by #377 or IntersectMBO/cardano-api#320
Closed
Assignees
Labels
conway-feature enhancement New feature or request

Comments

@CarlosLopezDeLara
Copy link
Contributor

cardano-cli conway key non-extended-key --extended-verification-key-file test.drep.vkey --verification-key-file /dev/stdout

Command failed: key non-extended-key  Error: Invalid key.

Originally posted by @gitmachtl in #352 (comment)

@smelc
Copy link
Contributor

smelc commented Oct 12, 2023

@CarlosLopezDeLara> in this case, the original extended drep key should be created as follows right?

cabal run cardano-cli -- conway governance drep key-gen \
--verification-key-file drep.vkey \
--signing-key-file drep.skey

@gitmachtl
Copy link
Contributor

gitmachtl commented Oct 12, 2023

@smelc no need for cardano-cli to generate extended drep keys. they are coming into play if derived from the new path 1852'/1815'/acc'/3/idx'. typically from 3rd party tools like cardano-signer, spo-scripts, cardano-address, cardano-hw-cli.

https://github.com/Ryun1/CIPs/blob/conway-keys/CIP-conway-keys/README.md
cardano-foundation/CIPs#509

@CarlosLopezDeLara
Copy link
Contributor Author

CarlosLopezDeLara commented Oct 12, 2023

@smelc, as @gitmachtl rightly pointed out, extended keys typically come from Hierarchical deterministic (HD) key generation tools, so the cli doesn't generete them, just supports them.

In this case we want to be able to convert from extended to non-extended keys.

Additionaly, in #352 there is the need of support the use of extended keys directly on cli without having to convert them first.

@smelc
Copy link
Contributor

smelc commented Oct 13, 2023

@gitmachtl, @CarlosLopezDeLara> OK I see, thanks for the explanations 👍

As a first step, for this very specific issue, could one of you provide me with an example extended key (in your example Carlos the test.drep.vkey file)? Just so that I see if I can reproduce the issue locally, which will help me navigate what I need to do.

@gitmachtl
Copy link
Contributor

@smelc you can simply copy the test key below and paste it into a textfile:

{
  "type": "DRepExtendedVerificationKey_ed25519_bip32",
  "description": "Delegate Representative Verification Key",
  "cborHex": "5840b0cd9e6e3e274f4f38f55ef274af123cf4600ac0c58294399b7e076175262553dde8b75f847f2b7e61a8748627292a06d739c8ba8e78ac83e666030d1093fb3e"
}

i have uploaded you the same file here if needed

@smelc
Copy link
Contributor

smelc commented Oct 16, 2023

Investigating this this morning. The offending code starts with the parser at Cardano/CLI/Legacy/Run/Key.hs#L53 then goes on with Cardano/CLI/EraBased/Run/Key.hs#L138. Finally it calls Cardano/CLI/Types/Key.hs#L251 at which point it goes to code in cardano-api.

@smelc
Copy link
Contributor

smelc commented Oct 16, 2023

Going into cardano-api, we find our friend deserializeAnyVerificationKey in cardano-api/internal/Cardano/Api/DeserialiseAnyOf.hs#L299 and finally we find in cardano-api/internal/Cardano/Api/Keys/Shelley.hs#L1493 that there is no Extended version of DRepKey, which is likely the crux of the problem.

I know need to figure out how it's formally defined, so that I can add the corresponding code.

@gitmachtl
Copy link
Contributor

@Ryun1 @CarlosLopezDeLara i think we had this in a pr from you. also its in the cip-conway-keys: https://github.com/Ryun1/CIPs/blob/conway-keys/CIP-conway-keys/README.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conway-feature enhancement New feature or request
Projects
None yet
3 participants