6

I'm trying to use cardano-cli to control the addresses controlled by my Yoroi wallet, so I thought the first thing to do is to import the keys and addresses. I did this:

$ # Type the seed phrase for the Yoroi wallet into a file phrase.txt.
$ cat phrase.txt | cardano-address key from-recovery-phrase Shelley > root.prv
$ cat root.prv | cardano-address key child 1852H/1815H/0H/0/0 | cardano-address key public --with-chain-code  | cardano-address address payment --network-tag mainnet

The output is "addr1v..." but in the Yoroi the 0th address is "addr1q...", so they are very different. What am I missing? My ultimate goal is to get the addresses and keys I need to build and sign transactions using cardano-cli, and I'm stuck at even getting the right addresses using cardano-address.

Following the instructions from the cardano-addresses README.md, I was able to generate a "delegated payment address" that matches the 0th address I see in Yoroi. However, cardano-cli transaction sign requires a --signing-key-file, which is normally generated using cardano-cli address key-gen, and I don't know how to get a cardano-cli-style signing key file from the stuff I can get from cardano-address.

I believe cardano-wallet can be used to make payment transactions, but AFAICT only cardano-cli can be used to mint tokens; I don't see anything about minting tokens in the help for cardano-wallet.

6
  • Have you checked in Yoroi if the output address "addr1v" is one of your public addresses? Every wallet has many addresses. – eddex May 28 at 5:57
  • IDK how to give Yoroi an address to check whether it is mine, but I have generated a total of 4 addresses in Yoroi and they all start with addr1q and not addr1v. Additionally, I believe the last '0' in 852H/1815H/0H/0/0 is the address index. I suspect the 1q vs 1v has some special significance related to the nature of the address. I suspect that there is some knowledge about different types of addresses, what they are used for, what kinds of prefixes they have and how they relate to one another that I have yet to understand. – Joshua Chia May 28 at 7:24
  • 1
    addr1v[...] are payment addresses, addr1q[...] are delegated payment addresses: github.com/input-output-hk/cardano-addresses#command-line – eddex May 28 at 8:30
  • @eddex You raised a good point. What I was missing is the cardano-address address delegation, which requires the stake verification key to be generated first. – Joshua Chia May 28 at 9:18
  • 1
    I will once I figure out how to generate all the address-related files needed for using cardano-cli to build and sign a transaction. For example, cardano-cli sign requires a --signing-key-file and I need to figure out how to generate that. – Joshua Chia May 28 at 10:55
1

You can use cardano-cli to convert an extended signing key to a Shelley-format key (which is what you need in order to sign a transaction).

cardano-cli key convert-cardano-address-key --shelley-payment-key --signing-key-file address.xsk --out-file address.skey

I believe this is the missing piece of information you are after. The steps needed to get address.xsk are the same as those needed to derive the extended verification keys. The answer to this question covers that.

Later edit : Here are all the steps for getting a signing key usable with cardano-cli from a seed phrase

./cardano-address key from-recovery-phrase Shelley < phrase.prv > root.xsk

# Derive the address signing key
./cardano-address key child 1852H/1815H/0H/0/2 < root.xsk > address.xsk

# Convert the extended signing key to a Shelley-format key
cardano-cli key convert-cardano-address-key --shelley-payment-key --signing-key-file address.xsk --out-file address.skey

In my case the address holding funds had this derivation path 1852H/1815H/0H/0/2. In Yoroi you can see the derivation path for an address when you click the ✓ Verify address button. You can derive any path you need following the steps above.

2
  • Is the address.xsk actually the output file from cardano-address key from-recovery-phrase Shelley < phrase.prv > root.xsk? The only .xsk file I can see from the instructions in the README.md is the root.xsk from that command. Does that mean I can't use cardano-cli to control multiple addresses generated from the root.xsk? – Joshua Chia Jun 2 at 10:39
  • No, that is the root signing key. You said you managed to reach the same address as the ones you see in yoroi, so I assumed you derived both the account and the address keys (so a full derivation 1852H/1815H/0H/0/0). You convert an extended address signing key with the command above. I'll edit my answer with a full example once I reach my PC – clownprince Jun 2 at 10:50
0

You can use Daedalus to restore your wallet on the machine and that should create a wallet file with the addresses you need. Daedalus also contains cardano-cli as its built on cardano-node.

I did not try launching cardano-node / cardano-cli from a Daedalus install though, there may be additional wrinkles to solve.

0

You have to use some of the other tools in the cardano wallet suite. Get the cardano-wallet from GitHub. Here is an example for how to extract keys and make signing key files.

Basically you need to extract the keys from the seed phrase, and then convert them to CBOR hex, and then create the signing key file which is just a JSON format file.

0

Cardano cli offers some functions for that

$ cardano-address key from-recovery-phrase Shelley < phrase.prv > root.xsk
root_xsk1hqzfzrgskgnpwskxxrv5khs7ess82ecy8za9l5ef7e0afd2849p3zryje8chk39nxtva0sww5me3pzkej4rvd5cae3q3v8eu7556n6pdrp4fdu8nsglynpmcppxxvfdyzdz5gfq3fefjepxhvqspmuyvmvqg8983

https://github.com/input-output-hk/cardano-addresses#command-line

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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