How to import a Daedalus wallet into Yoroi as a watch-only wallet?

I’m using Yoroi Android wallet app. It has a feature to import (“restore wallet”/“read-only wallet”) a wallet as a watch-only (or read-only) wallet. It does so by scanning QR code that corresponds to the wallet master public key.

This feature worked well when I imported another Yoroi wallet. However, it failed to do so for a Daedalus wallet. Taking a closer look, I can quickly see that Daedalus public key starts with “acct” prefix, while Yoroi public key is just a plain hex string.

Does anybody know how to perform such an import?

1 Like

If Yoroi won’t read the QR code that Daedalus generates for the public key with the acct prefix, then you can use a Bech32 decoding utility to extract the hex string that Yoroi needs and then create a QR code manually from that. Use an offline Bech32 decoder and an offline QR code generator, not online ones.

Bech32 decoder complains about the string is too long. Here is an example of such public key. Are you sure it is in bech32 format?

acct_xvk1d2j42tjmp5v3n744jxzznvlt4ef4n65cd33tzc5y7nk4h8tyk7hrtvz8nz5mq3razm6rrltkqmrnkyy6vfqq2yj05evjau7w40q5ulsnuruz5

It is, but you need to use lenient decoding, not strict decoding. For the example you posted, the hex string is 6aa5552e5b0d1919fab5918429b3ebae5359ea986c62b16284f4ed5b9d64b7ae35b04798a9b0447d16f431fd7606c73b109a624005124fa6592ef3ceabc14e7e.

1 Like

Thanks, @bwbush Can you recommend a stand-alone such decoder? Earlier I was using an online decoder which does not seem to have this linient mode.

I’ve been using a command-line tool that I wrote because I couldn’t find a convenient tool for this. It takes some effort to install the tool, however.

An easier method is to install cardano-wallet and use the cardano-wallet key inspect command:

$ cardano-wallet key inspect
acct_xvk1d2j42tjmp5v3n744jxzznvlt4ef4n65cd33tzc5y7nk4h8tyk7hrtvz8nz5mq3razm6rrltkqmrnkyy6vfqq2yj05evjau7w40q5ulsnuruz5

This responds with:

{
    "chain_code": "35b04798a9b0447d16f431fd7606c73b109a624005124fa6592ef3ceabc14e7e",
    "key_type": "public",
    "extended_key": "6aa5552e5b0d1919fab5918429b3ebae5359ea986c62b16284f4ed5b9d64b7ae"
}

The hex string for the public key is just the extended key followed by the chain code.

3 Likes

Thanks, @bwbush It worked. And even better, cardano-wallet comes with a bech32 program.

I have successfully imported Daedalus wallet into Yoroi as a watch-only/read-only wallet. For other peoples’ benefit, I write down the detailed steps as follows.

  • Download cardano-wallet package and unzip it on Linux,
  • Obtain wallet public key from Daedalus, which starts from “acct_” prefix
  • extract hex format public key by running “echo <daedalus pub key> | ./bech32”
  • create a JSON string with the following format. Replace the public key part with the one obtained in the previous step:

{“publicKeyHex”:“6aa5552e5b0d1919fab5918429b3ebae5359ea986c62b16284f4ed5b9d64b7ae35b04798a9b0447d16f431fd7606c73b109a624005124fa6592ef3ceabc14e7e”,
“path”:[2147485500,2147485463,2147483648]}

  • Paste the above string in a QR generator, e.g., https://www.qr-code-generator.com/
  • Open Yoroi mobile app, select “restore wallet”/“read-only wallet” and scan the above QR code. Done!
3 Likes

Just use ccwallet.io and import your PublicKey from your Daedalus wallet there for a ReadOnly Wallet.

3 Likes

First of all, thank you @bwbush and @Jun_Sun for the valuable information provided here. I’m a long-term Linux user (I’ve been pulling my hair out with Linux since 1995 :sweat_smile:), but I’m a complete noob about Cardano, its environment and everything else about it – apps and utilities included. Your insights helped me a lot.

I followed the steps above, but ended up doing some changes along the way that I’d like to share, here, so maybe others (mostly Linux users) that are experiencing the same difficulties that I was experiencing may benefit from it.

I’d also like to express my appreciation for @ATADA’s suggestion about using ccwallet: it’s definitely a handy tool. However, because I particularly don’t like using web browser applications (e.g. websites running applets, web browser extensions etc.), I decided to adopt the same approach of adding my “Daedalus wallet” to my “Android Yoroi wallet” app as a watch-only (i.e. read-only) wallet.

Well, here are the changes that I made:

  1. Instead of downloading the cardano wallet tarball (i.e. compressed package) from here, which was released back in 2020-07-28, I downloaded this one, released for 64-bit Linux on 2021-09-17. The corresponding 64-bit Windows ZIP package is this and the corresponding 64-bit macOS tarball is this.

    On 64-bit Linux, the command below (which requires both wget and tar in order to work) makes the shell (i.e. Bash) automatically access your personal (i.e. home) folder/directory, then the shell downloads that 64-bit Linux tarball released on 2021-09-17, extracts its contents to a folder, deletes the tarball, renames such folder to adatools and then accesses such adatools folder/directory:

    cd ; wget https://hydra.iohk.io/build/7662582/download/1/cardano-wallet-v2021-09-09-linux64.tar.gz -O ./adatools.tgz ; tar -xvf ./adatools.tgz ; rm ./adatools.tgz ; mv ./cardano-wallet-v2021-09-09-linux64 ./adatools; cd ./adatools
    

    If the command above worked, your shell is now connected to the adatools folder in your personal (a.k.a. home) directory.

  2. After starting Daedalus, I selected my wallet, then clicked on :gear: More, then on Settings, then at Wallet public key I clicked on :eye: (the Reveal button), provided the wallet’s password and then clicked on the :white_large_square: Show QR code button. After doing it, I not only copied the public key but also the code of the Derivation path, because it’s also required to generate the “Yoroi QR code key” correctly. E.g. if the derivation path is shown as M/2147'/2136'/0', then its corresponding code is 2147,2136,0.

  3. Suppose that my wallet’s public key is indeed acct_xvk1d2j42tjmp5v3n744jxzznvlt4ef4n65cd33tzc5y7nk4h8tyk7hrtvz8nz5mq3razm6rrltkqmrnkyy6vfqq2yj05evjau7w40q5ulsnuruz5. Instead of running:

    echo acct_xvk1d2j42tjmp5v3n744jxzznvlt4ef4n65cd33tzc5y7nk4h8tyk7hrtvz8nz5mq3razm6rrltkqmrnkyy6vfqq2yj05evjau7w40q5ulsnuruz5 | ./bech32
    

    …I ran the command in this (equivalent) format (it produces/outputs the same result):

    ./bech32 <<< acct_xvk1d2j42tjmp5v3n744jxzznvlt4ef4n65cd33tzc5y7nk4h8tyk7hrtvz8nz5mq3razm6rrltkqmrnkyy6vfqq2yj05evjau7w40q5ulsnuruz5
    
  4. Because the output of the previous bech32 command was 6aa5552e5b0d1919fab5918429b3ebae5359ea986c62b16284f4ed5b9d64b7ae35b04798a9b0447d16f431fd7606c73b109a624005124fa6592ef3ceabc14e7e and the code of the derivation path in this example is 2147,2136,0, the final string to be used when generating the corresponding QR code for the Yoroi wallet app is this:

    {\"publicKeyHex\":\"6aa5552e5b0d1919fab5918429b3ebae5359ea986c62b16284f4ed5b9d64b7ae35b04798a9b0447d16f431fd7606c73b109a624005124fa6592ef3ceabc14e7e\",\"path\":[2147,2136,0]}
    

    It’s extremely important to add the character \ before each instance (occurrence) of the " character, because the \ character “tells” (instructs) the shell (i.e. Bash) not to parse (i.e. “interpret”) any of those " characters as “comment” characters (notice how " and " look different: they also cause the shell to behave differently with each one of them). Hence, using \ is very important to guarantee that the Yoroi QR code will be generated correctly, otherwise the Yoroi app will reply that the QR code that it’s read is incorrect.

    For easy of use, you may store the above string in a temporary environment variable such as e.g. keypath:

    keypath={\"publicKeyHex\":\"6aa5552e5b0d1919fab5918429b3ebae5359ea986c62b16284f4ed5b9d64b7ae35b04798a9b0447d16f431fd7606c73b109a624005124fa6592ef3ceabc14e7e\",\"path\":[2147,2136,0]}
    

    If the command above worked, then the output of the echo $keypath command must be that previous string without the \ characters, i.e.:

    {"publicKeyHex":"6aa5552e5b0d1919fab5918429b3ebae5359ea986c62b16284f4ed5b9d64b7ae35b04798a9b0447d16f431fd7606c73b109a624005124fa6592ef3ceabc14e7e","path":[2147,2136,0]}
    
  5. After the above string was created and stored in that temporary variable, I installed a Linux utility called qrencode. On Debian and Debian-based Linux distros (i.e. Ubuntu, Linux Mint etc.), you install it by issuing the command sudo apt install qrencode. On Arch and Arch-based distros (e.g. Manjaro), a command such as sudo pamac -S qrencode installs it. Other Linux distros use other package managers, so maybe sudo yum install qrencode, sudo dnf install qrencode etc. may be necessary.

  6. Once qrencode was installed, all I had to do was to run the command below, which uses the keypath variable (which contains the string stored in it) in order to create the Yoroi QR code into the image file qrcode.png:

    qrencode $keypath -o qrcode.png
    

    …and then the qrcode.png image file was created into the adatools directory.

  7. Moreover, a command such as:

    firefox qrcode.png
    

    …or:

    xdg-open qrcode.png
    

    …or:

    x-www-browser qrcode.png
    

    …or anything for that matter shows the QR Code on the screen.

  8. Once the QR Code is visible on the screen, all you have to do is :one: open the Yoroi app for Android (or iOS), :two: tap ADD WALLET (SHELLEY-ERA), :three: tap RESTORE WALLET, then :four: tap READ-ONLY WALLET and then :five: use the Yoroi app to read the QR Code that is visible on the screen.

  9. Finally, edit the wallet’s name and then tap the SAVE button. Done. :raised_hands:t2:

1 Like

Thanks for Yuri’s inspiration. I created a web page that simply does all the steps for you. Please try it out and let me know what you think.

https://junsun.net/misc/yoroi-import/

3 Likes

@Jun_Sun Thanks a lot for that! I created a new wallet in Daedalus, just for testing, and I can confirm that your web page works as expected: it indeed created a QR Code which in turn was successfully imported into Yoroi. :clap:t2: :clap:t2: :clap:t2:

OK. The tool page got a facelift and a permanent home.

http://cardano.netspectrum.com/yoroi

Enjoy!

1 Like

What a great tool! Thank you for making that!

1 Like