vacuumlabs / cardano-hw-cli

Cardano CLI tool for hardware wallets
71 stars 24 forks source link

add support for exporting governance voting keys #143

Closed janmazak closed 1 year ago

janmazak commented 1 year ago

And use "hardware" in key description, as requested in https://github.com/vacuumlabs/cardano-hw-cli/issues/139.

gitmachtl commented 1 year ago

The voting public key is requested like a normal key, and the given path of 1694H/1815H/0H/0/0 will switch it to a governance key description for the write out, right?

EDIT: Just answered it to myself, tried it out 👍

gitmachtl commented 1 year ago

@janmazak @davidmisiak Some issues here, first is a thrown error using the --vote-public-key-file parameter:

cardano-hw-cli governance voting-registration-metadata \
     --testnet-magic 1 \
     --vote-public-key-file myVote.voting.vkey \ 
     --stake-signing-key-hw ledger-red.staking.hwsfile \
     --reward-address "addr_test1qzyh0zdfjmk997fkdrgcm4xmuhcqqd4qgphkmgm3shryrjhkjhp4qfyx33xada55u94c300knphrrgr577gdw5jpc39srpfmlp" \
     --nonce 1234 \
     --metadata-cbor-out-file /dev/stdout

Error: Invalid governance vote public key
cat myVote.voting.vkey
{
  "type": "PaymentVerificationKeyShelley_ed25519",
  "description": "Governance Verification Key",
  "cborHex": "5820cd6d71f11cbd2f63326e5a50d7141a9443bd0f16f4b02f3f2f4d40acc5f83294"
}

When i change the type to GovernanceVotingVerificationKey_ed25519 it passes. But, is this now an officiall keyType? Because cardano-cli does not like that type. Are we good breaking this? Shouldn't it be added to CIP-0062 too?

Also i noticed that cardano-hw-cli does not like extended public key currently like:

{
  "type": "GovernanceVotingVerificationKey_ed25519",
  "description": "Governance Verification Key",
  "cborHex": "5840423fa841abf9f7fa8dfa10dacdb6737b27fdb0d9bcd9b95d48cabb53047ab76973dd83b34cb41508cebc007b644129573d3076a82fbba7f7a5192a41047a47ee"
}

Second, is the following error when i change the vote public key to jcli format and using a ed25519 key, so it passed that step:

cardano-hw-cli governance voting-registration-metadata \
     --testnet-magic 1 \
     --vote-public-key-jcli myVote.voting.pkey \ 
     --stake-signing-key-hw ledger-red.staking.hwsfile \
     --reward-address "addr_test1qzyh0zdfjmk997fkdrgcm4xmuhcqqd4qgphkmgm3shryrjhkjhp4qfyx33xada55u94c300knphrrgr577gdw5jpc39srpfmlp" \
     --nonce 1234 \
     --metadata-cbor-out-file /dev/stdout

Error: args.rewardAddressSigningKeyData is not iterable

So something is missing the "optional" fact.


Providing extra rewards-address-signing-key-hw information does help:

cardano-hw-cli governance voting-registration-metadata \
     --testnet-magic 1 \
     --vote-public-key-jcli myVote.voting.pkey \ 
     --stake-signing-key-hw ledger-red.staking.hwsfile \
     --reward-address "addr_test1qzyh0zdfjmk997fkdrgcm4xmuhcqqd4qgphkmgm3shryrjhkjhp4qfyx33xada55u94c300knphrrgr577gdw5jpc39srpfmlp" \
     --nonce 1234 \
     --rewards-address-signing-key-hw ledger-red.payment.hwsfile \
     --metadata-cbor-out-file /dev/stdout

But it displays an "unusual" warning on the Ledger GUI, even if the rewards address belongs to the ledger itself.


Also, whats the difference between --vote-public-key-file and --vote-public-key-hw ?

gitmachtl commented 1 year ago

hi all, will we get a version to test over the holidays? thx.