3

I am trying to get the skey, vkey and address of the first payment address in a wallet I created in cardano-wallet. I need them because I would like to make transactions with cardano-cli on the same wallet. I am working on the testnet.

With cardano-wallet I created the wallet using

cardano-wallet wallet create from-recovery-phrase "test"

I entered my mnemonic phrase, let the second factor empty and set a passphrase. Everything seems fine and I can have a list of addresses

   {
        "derivation_path": [
            "1852H",
            "1815H",
            "0H",
            "0",
            "0"
        ],
        "id": "addr_test1qzwk908vw9lkpvuth4ch9xlmqxk593xtg7060ve775ja300ur5hrj7gda3wde08v8wx9k8dnf0n9ng0hh4ktmr3hjhts7yurnm",
        "state": "used"
    },
...

So the first address is addr_test1qzwk908vw9lkpvuth4ch9xlmqxk593xtg7060ve775ja300ur5hrj7gda3wde08v8wx9k8dnf0n9ng0hh4ktmr3hjhts7yurnm

I thought I could find the same address by doing:

cardano-wallet key from-recovery-phrase Shelley < phrase.prv > test.xsk
cat test.xsk | cardano-wallet key child 1852H/1815H/0H/0/0 > test.prv
cat test.prv | cardano-wallet key public --with-chain-code > test.pub
cat test.pub | cardano-address address payment --network-tag testnet > test.addr

But I got this address: addr_test1vzwk908vw9lkpvuth4ch9xlmqxk593xtg7060ve775ja30gg6szrd

I tried with cardano-address I got the same address.

I also try this with cardano-cli:

cardano-cli key convert-cardano-address-key --shelley-payment-key --signing-key-file test.prv --out-file test.skey
cardano-cli key verification-key --signing-key-file keys/test1.skey --verification-key-file test.vkey
cardano-cli address build --payment-verification-key-file test.vkey --out-file test.addr --testnet-magic 1097911063

And I also got addr_test1vzwk908vw9lkpvuth4ch9xlmqxk593xtg7060ve775ja30gg6szrd

When I tried to make a transaction from my wallet to this address, it's seems to be a valid derivative address because all utxo appears when I am checking with

cardano-wallet wallet utxo-snapshot

But I don't understand why I don't have the same address with the same derivative path. I also checked with yoroi and nami wallet and addr_test1qzwk908vw9lkpvuth4ch9xlmqxk593xtg7060ve775ja300ur5hrj7gda3wde08v8wx9k8dnf0n9ng0hh4ktmr3hjhts7yurnm is the usual address for them

Can someone tell me what I am missing ? Thank you

1 Answer 1

7

You are missing the stake key. You obtain the stake key pair like this:

cat rootkey.prv | cardano-address key child 1852H/1815H/0H/2/0 > stake.prv
cardano-cli key convert-cardano-address-key --signing-key-file stake.prv --shelley-stake-key --out-file stake.skey
cardano-cli key verification-key --signing-key-file stake.skey --verification-key-file Ext_ShelleyStake.vkey
cardano-cli key non-extended-key --extended-verification-key-file Ext_ShelleyStake.vkey --verification-key-file stake.vkey

And then you can build your address with the stake included (from the keys obtained with the cardano-cli version you posted):

cardano-cli address build --payment-verification-key-file test.vkey --stake-verification-key-file stake.vkey --out-file test.addr --testnet-magic 1097911063

And you use the same stake key pair for all addresses derived from the master key.

1
  • thank you, that's exactly what I was missing ! Dec 27, 2021 at 6:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.