To all you smart people out there I have a question about using addresses from a wallet in cardano-cli that I have been struggling with and that I think will be helpful to others as I have found a few answers that are not clear or do not solve this issue:
This is all on testnet:
Summary
I would like to manage my addresses in a wallet like Daedalus but I would like to also use the cardano-cli on these addresses especially for my stake pool.
I believe that it’s not possible to add addresses created using the cardano-cli to Daedalus or Yoroi but it is possible to generate the keys using cardano-address using the recovery phrase and then to use cardano-cli to generate the signing key.
I have managed to use cardano-address to generate the payment address and it matches with my 0/0 address in Daedalus. I have created the signing key but when I try and submit a transaction I get the error MissingVKeyWitnessesUTXOW so I know I am missing a step.
Steps taken
Generate a root private key (testnet-root.xsk)
./cardano-address key from-recovery-phrase Shelley < phrase-testnet.prv > testnet-root.xsk
Generate a payment verification key (testnet-addr.xvk)
./cardano-address key child 1852H/1815H/0H/0/0 < testnet-root.xsk | ./cardano-address key public --with-chain-code > testnet-addr.xvk
Generate a payment address from a payment key (testnet-payment.addr)
./cardano-address address payment --network-tag testnet < testnet-addr.xvk > testnet-payment.addr
Stake key
./cardano-address key child 1852H/1815H/0H/2/0 < testnet-root.xsk | ./cardano-address key public --with-chain-code > testnet-stake.xvk
Delegate payment address (Note this address matches the address in Daedalus )
./cardano-address address delegation $(cat testnet-stake.xvk) < testnet-payment.addr > payment-delegated.addr
Now I use the caredano-cli to generate the signing key. This is where I think I am going wrong
cardano-cli key convert-cardano-address-key --shelley-payment-key --signing-key-file /var/cardano/local/testnet-root.xsk --out-file /var/cardano/local/testnet-address.skey
Error:
So now when I create my transaction using
payment-delegated.addr - (Source account address)
testnet-address.skey - (Key to sign the transaction)
I get the following error
Command failed: transaction submit Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraMary (ApplyTxError [UtxowFailure (MissingVKeyWitnessesUTXOW (WitHashes (fromList [KeyHash "86a340294178774a3f7420e46fe08739d8669e9a465982aa8edc9c77"]))),UtxowFailure (UtxoFailure (OutsideValidityIntervalUTxO (ValidityInterval {invalidBefore = SNothing, invalidHereafter = SJust (SlotNo 30696916)}) (SlotNo 30760233)))])
tomdx
1 July 2021 10:33
#2
You would probably want to us a HW wallet (i.e. Ledger) for that. You can connect your Ledger to a variety of Cardano clients and can also use cardano-hw-cli to manage your pool.
1 Like
One needs to generate the signing key from the child private key 1852H/1815H/0H/0/0
, not from the root private key.
Here is one recipe that shows creating the signing key for the child.
2 Likes
Thanks to tomdx and bwbush I have managed to find the solution:
Instead of using cardano-address I used cardano-wallet
The issue from my examples above was that I was signing my transaction with the seed/root key and not the payment address signing key.
Image taken from cardanians.io
So here are the steps:
Install cardano-wallet Releases · input-output-hk/cardano-wallet · GitHub
Generate the ROOT private key from the recovery phrase
cat phrase-testnet.prv | ~/cardano-wallet/cardano-wallet key from-recovery-phrase Shelley > tn.root.prv
Generate the private and public Payment keys using the root private key for the first address
~/cardano-wallet/cardano-wallet key child 1852H/1815H/0H/0/0 < tn.root.prv > tn.payment-0.prv
~/cardano-wallet/cardano-wallet key public --without-chain-code < tn.payment-0.prv > tn.payment-0.pub
(The missing part) Generate the signing key for the payment address
~/cardano-wallet/cardano-cli key convert-cardano-address-key --shelley-payment-key \
--signing-key-file tn.payment-0.prv \
--out-file tn.payment-0.skey
The remainder of the keys can be created by incrementing the last digit of the deviation path. E.g 1852H/1815H/0H/0/0 and 1852H/1815H/0H/1/0
Generate the stake keys. The process is similar to above
~/cardano-wallet/cardano-wallet key child 1852H/1815H/0H/2/0 < tn.root.prv > tn.stake.prv
~/cardano-wallet/cardano-wallet key public --without-chain-code < tn.stake.prv > tn.stake.pub
~/cardano-wallet/cardano-cli key convert-cardano-address-key --shelley-payment-key \
--signing-key-file tn.stake.prv \
--out-file tn.stake.skey
~/cardano-wallet/cardano-cli key verification-key --signing-key-file tn.stake.skey \
--verification-key-file tn.stake.vkey
Generate the addresses by computing the payment key and the stake key
cardano-cli address build --testnet-magic 1097911063 \
--payment-verification-key $(cat tn.payment-0.pub) \
--stake-verification-key $(cat tn.stake.pub) \
--out-file /var/cardano/local/tn.payment-0.address
If you cat this address tn.payment-0.address it should match your address in your wallet.
Now you can generate your payment using:
Source payment address: tn.payment-0.address
Source payment signing key: tn.payment-0.skey
My advice, figure this all out on testnet.
4 Likes
I tried the steps and it works fine on testnet but i get an error when I try it on mainnet. I’m not sure what’s causing it.
Command failed: transaction submit Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraAlonzo (ApplyTxError [UtxowFailure (WrappedShelleyEraFailure (MissingVKeyWitnessesUTXOW (WitHashes (fromList [KeyHash "5661833137566b97ad56cf6f492533343949b40d6eb4fb9dcd9caaa61"]))))])
I got it working using the skey file using the same wallet address generated by the steps above. I’m wondering how to use a different address from the same wallet?
bwbush
26 November 2021 16:13
#7
The payment keys in the wallet are generated by the series 1852H/1815H/0H/0/0
, 1852H/1815H/0H/0/1
, 1852H/1815H/0H/0/2
, … The change keys in the wallet are generated by the series 1852H/1815H/0H/1/0
, 1852H/1815H/0H/1/1
, 1852H/1815H/0H/1/2
, …
Thanks, this works! The script on coincashews does not work any more.