Cardano-wallet: How can I restore wallet from secret.key file from daedalus 0.15.1

Created on 14 Dec 2020  ·  64Comments  ·  Source: input-output-hk/cardano-wallet

I got your contact from Nikola Glumac.

I understand that you're the right team to contact in terms of older cardano wallets.
Would you happen to be so kind and review the following subject?
https://github.com/input-output-hk/daedalus/issues/1234#issuecomment-734457593

Long story short:
There are plenty of users stuck on the 0.15.1 daedalus wallet
which suddenly stopped working and our ADA funds are stuck in it.

Your insight and help is much appreciated.

//BR, Chris

Most helpful comment

This worked like a charm, it gave me:

[
    {
        "name": "___name___",
        "encrypted_root_private_key": "___mykey___",
        "passphrase_hash": "___myhash___",
        "is_empty_passphrase": false
    }
]

Then I used Ikar, did the steps described in #2395 and voilà, I can see my old wallet syncing in the new Daedalus:

image

Thank you so much @piotr-iohk and @KtorZ - you saved my ADA savings and I learnt a lot from you! :)

All 64 comments

I am in a similar situation as skazichris. Looking forward to support from the dev team in restoring access to the stuck ADA coins. Re-enabling the import wallet feature to allow access through the secret.key file would be great.

Appreciate the help!

Questions for both of you @skazichris and @mkr-j:

  • What operating system are you on / familiar with?
  • What is your level of expertise in IT?

I'm in the same situation.

  • What operating system are you on / familiar with?

Linux, MacOS. Can use Windows if it's absolutely necessary :)

  • What is your level of expertise in IT?

Masters degree in computer science. Basic knowledge of Haskell. Good knowledge of Python, Go, C. For me personally, a good specification of secrets.key file format and a process how to obtain private keys or a wallet phrase from it could be enough.

@mprymek have a look at: https://github.com/input-output-hk/cardano-sl/pull/4278#issuecomment-600553878, there's a pre-compiled binary which should work on any GNU linux. This however requires that you still have access to the old wallet database AND the secret key file. The tool will extract all known encrypted keys from the keystore and spit them in a nicer JSON format.

There has been a few additions to the tools later that aren't in the pre-compiled version linked above but they are non-essential.

From there, the cardano-wallet gives you a way to import such credentials directly in the "byron-wallets" API (see the "random (xprv) tab in https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/postByronWallet). Fields are named identically in the API and in the tool output. From there, your wallet should restore itself and you should be able to operate it as normal provided that you still remember the encryption passphrase. If you do not, it's hopeless.

If you do not have access to the acid-state database that the old wallet was using at the time and only have the keystore file, then let me know. I'll spend some time documenting the CDDL specification corresponding to the keystore serialization format and/or update the extraction tool to make the acid-state database optional (it's really only used to link the encrypted key to a wallet name and wallet id).

Thanks a lot, @KtorZ. I think I have a backup of the acid-state db too but must find it and restore somewhere. And also recall the master password. Will take a while I'm afraid :)

Questions for both of you @skazichris and @mkr-j:

  • What operating system are you on / familiar with?
  • What is your level of expertise in IT?

I am on Windows. I've done some basic coding in the long past but generally am not too familiar with non-GUI operations. With some guidance, however, I'd be willing to attempt something a little more complex.

I do remember the encryption phase, but I do not see an acid-state database. My Daedalus version is 1.0.3769, wallet 0.8.2. Is the tool you referenced expected to work with this version of the wallet?

@KtorZ I have some findings, probably not very good for me...

@mprymek have a look at: input-output-hk/cardano-sl#4278 (comment), there's a pre-compiled binary which should work on any GNU linux.

Sidenote: It doesn't work on "any" Linux distribution. It's dynamically linked and at least librocksdb.so.5.8 is a little bit problematic. It's not available in Ubuntu 20.04. I found it's available in Ubuntu 18.04.

I can confirm it's working on Ubuntu 18.04:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.1 LTS
Release:    18.04
Codename:   bionic

$ ./export-wallets --mainnet   --wallet-db-path ./state-wallet-mainnet/wallet-db   --keyfile ./state-wallet-mainnet/secret.key
No wallet for id: Ae2tdPwUPEZKHDtF6psSMU99Z7HnMAgSs4T7wpbWAGdHrh1RGM8GhLd3BRq
No wallet for id: Ae2tdPwUPEZ42xY2TByWhGPQ7UST7VsopbX4KAhQRdd6o5KyS9ZJxiEMzLX
[
    {
        "encrypted_root_private_key": "f6e79f49b8999a39d7e970e42d0a91224ecacefc3aa1edb342f34eb8bc6c2fc63e743b862b312a6f92ba0161d4d53c3ee5a2bd8085476d9575765c49dceecbe54b34ec47daf9b7ebc6bdb706622616451c000e85ba81c7449ae436a8cbbf3aab98e5cc704977bd11bb0ba8d5b5571a705704cb9334d27a048532eab49a698c2d",
        "name": "亜哀うめるтУуФф",
        "passphrase_hash": "31347c387c317c5743413633702f6a487a5777575278756756344e316854793470646c6d4f76665177653863775a575472784f79773d3d7c796341722f61326f4f777a736e4e746f4e655049416e4f6b7978426549494a6b59623039574b564a7159493d"
    },
    {
        "encrypted_root_private_key": "38e8de9c583441213fe34eecc4e28265267466877ba4048e3ab1fa9956366947aefaf5ba9779db67eead7fc9cd1354b994a5d8d9cd40ab874bfeb1b33649280cd33651377731e0e59e0233425a55257782c5adaa768da0567f43c1c6c0c18766ed0a547bb34eb472c120b170a8640279832ddf18002887f03c15dea59705422d",
        "name": "WALLET 💜 💛 💚 💙",
        "passphrase_hash": null
    }
]

But i found the original Daedalus version I have a backup of, was probably older than 0.15.

Don't know if it's of any value, but anyways:

$ ls
 GPUCache         Logs          Secrets-1.0   config.json   tls
'Local Storage'   Preferences   Wallet-1.0    storage

$ cat Wallet-1.0/events.version
0.14.2

Export does not work (pre-0.15 had a different DB format?):

$ ../export-wallets-qa/export-wallets --mainnet --wallet-db-path Wallet-1.0/ --keyfile Secrets-1.0/secret.key
export-wallets: user error (There's no acid-state database matching the given path.)

$ ls Wallet-1.0/
Archive                     checkpoints-0000000071.log  events-0000057291.log  open
checkpoints-0000000070.log  checkpoints.version         events.version         open.lock

Just to add, it's probably something zendesk support should have heaps of tickets above, but we have tons of users reporting on telegramnover past few months who - do not seem to have read the warnings and have their funds locked due to missing 12 word seed.

Atleast for those that have the spending password available, it would be really helpful if there's a published way from IOG to use as a workaround (rather than someone from community passing a python/js code and asking them to run - as that involves trust, and potentially mote susceptible to scams on crypto social platforms). If only the part regarding secret.key to master key (unencrypted with spending password) is available as a method from IOG, we could easily ask users to import their wallets into Yoroi 🙂

Hello @KtorZ and @mprymek
I can confirm that unfortunately export-wallets-qa util doesn't works.

$ ls Secrets-1.0/
secret.key  secret.key.lock

$ ls Wallet-1.0/
Archive                     checkpoints-0000000009.log  events-0000002481.log  open
checkpoints-0000000008.log  checkpoints.version         events.version         open.lock

$ ./export-wallets --mainnet --wallet-db-path Wallet-1.0/ --keyfile Secrets-1.0/secret.key
export-wallets: user error (There's no acid-state database matching the given path.)

I'm trying to restore a wallet that was created with Daedalus 0.13.1

When using the utility I'm getting the error "user error (There's no acid-state database matching the given path.)"

I'm not %100 on what path or file I should be pointing this too. I have tried:
DB-1.0/
Wallet-1.0-acid/
Wallet-1.0-sqlite.sqlite3

@mprymek mentioned that this utility might not work with this db version. Does anyone have any more information on this?

Any help would be appreciated, thank you.

I am in the same predicament.. i had my wallet in Daedalus 0.13.1 and although i can get the script to work under ubuntu 18.04 with the test data in the gzip, it seems not work with my 0.13.1 data (same as @clovehitch)

I still have 0.13.1 installed on my windows PC (it runs, just can't connect).. is upgrading to 0.15.1 (after taking a VM snapshot) to upgrade the data structure an option? i had a search around everywhere for the old installer.. but had no luck..

to be honest, this thread is the best lead i have found on this problem, and i have been looking for months! Really appreciate the assistance being given! It's hard to wait for the official import to be re-enabled (had hoped it would have been in FC3 - but no)

same error here. There's no acid-state database matching the given path
events.version file shows 0.15.0.
need to import wallet using secret.key.
Please help

I have just checked some old Daedalus versions: 0.13.0, 0.13.1 and 0.15.1. From what I see, in all those versions the state directory looks as follows:

~/.local/share/Daedalus/mainnet$ ls -l
total 1036
drwxrwxr-x 7 piotr piotr   4096 sty 11 09:10 DB
-rw-r--r-- 1 piotr piotr 975704 sty 11 09:10 icon_large.png
-rw-r--r-- 1 piotr piotr   4800 sty 11 09:10 icon.png
drwxrwxr-x 3 piotr piotr   4096 sty 11 09:10 Logs
-rwxr-xr-x 1 piotr piotr    880 sty 11 09:10 namespaceHelper
drwxrwxr-x 2 piotr piotr   4096 sty 11 09:10 Secrets
drwxrwxr-x 4 piotr piotr   4096 sty 11 09:10 tls
drwxrwxr-x 3 piotr piotr   4096 sty 11 09:10 Wallet-acid
-rw-r--r-- 1 piotr piotr  45056 sty 11 09:10 Wallet-sqlite.sqlite3

Where:

~/.local/share/Daedalus/mainnet/Wallet-acid$ ls -l
total 16
drwxrwxr-x 2 piotr piotr 4096 sty 11 09:34 Archive
-rw-rw-r-- 1 piotr piotr  127 sty 11 09:34 checkpoints-0000000002.log
-rw-rw-r-- 1 piotr piotr    0 sty 11 09:34 checkpoints-0000000003.log
-rw-rw-r-- 1 piotr piotr    6 sty 11 09:33 checkpoints.version
-rw-rw-r-- 1 piotr piotr    0 sty 11 09:33 events-0000000000.log
-rw-rw-r-- 1 piotr piotr    6 sty 11 09:33 events.version
-rw-rw-r-- 1 piotr piotr    0 sty 11 09:33 open.lock

I am able to run the export-wallets tool on all three Daedalus versions like this:

$ ./export-wallets --wallet-db-path ~/.local/share/Daedalus/mainnet/Wallet \
                   --keyfile ~/.local/share/Daedalus/mainnet/Secrets/secret.key \
                   --mainnet
[]

It is a bit counter-intuitive but, I think, the "rule" would be: if you have those two items in your state directory: _Wallet-acid_ and _Wallet-sqlite.sqlite3_ you should point _--wallet-db-path_ to something like _/path/to/state-dir/Wallet_.

Please also note that Daedalus should not be running when you use export-wallets otherwise you'll get error:

export-wallets: StateIsLocked "/home/piotr/.local/share/Daedalus/mainnet/Wallet-acid/open.lock"

My Daedalus installation was on windows, would that make a difference?

My 0.13.1 directory structure looks like the following (its a copy, so date stamps are not original) :
10/01/2021 01:39 PM

.
10/01/2021 01:39 PM ..
10/01/2021 01:36 PM blob_storage
01/09/2020 12:05 PM 167 config.json
10/01/2021 01:39 PM DB-1.0
10/01/2021 01:39 PM GPUCache
10/01/2021 01:39 PM Local Storage
10/01/2021 01:39 PM Logs
01/09/2020 11:59 AM 533 Preferences
30/12/2018 01:31 PM 0 public.key
30/12/2018 01:31 PM 0 public.key.lock
10/01/2021 01:39 PM Secrets-1.0
10/01/2021 01:39 PM tls
10/01/2021 01:39 PM Wallet-1.0-acid
10/01/2021 01:39 PM Wallet-1.0-backup-2018-12-30T02_31_27
24/03/2019 09:28 PM 45,056 Wallet-1.0-sqlite.sqlite3
24/03/2019 09:04 PM webrtc_event_logs

The Wallet-1.0-acid directory contains :
10/01/2021 01:39 PM

.
10/01/2021 01:39 PM ..
10/01/2021 01:39 PM Archive
01/09/2020 12:04 PM 883,800 checkpoints-0000000737.log
01/09/2020 12:04 PM 0 checkpoints-0000000738.log
30/12/2018 01:31 PM 6 checkpoints.version
01/09/2020 12:04 PM 0 events-0001994441.log
30/12/2018 01:31 PM 6 events.version
30/12/2018 01:31 PM 0 open.lock

I have copied the files across onto a linux box now and trying to recover through there (as this is the only tool i have found so far).

I tried using "Wallet-1.0" in --wallet-db-path, with no luck.. i even tried renaming the wallet-1.0-acid and the sqlite3 file to exclude the 1.0 part trying to bring it inline with the example files but no luck there either..

Windows add/remove still shows 0.13.1 as the installed version (as does Daedalus.exe), the contents of my events.version file in Wallet-1.0-acid does show 0.15.0 though

Hi @khughes5, I just did the same, i.e. copied Daedalus (0.13.0) state dir from Windows to Linux:

My state directory looks as follows:

$ ls -l ~/Documents/daedalus-win/Daedalus/
total 84
drwxrwxr-x 3 piotr piotr  4096 sty 11 12:30  blob_storage
-rw-rw-r-- 1 piotr piotr    35 sty 11 12:19  config.json
drwxrwxr-x 7 piotr piotr  4096 sty 11 12:30  DB-1.0
drwxrwxr-x 2 piotr piotr  4096 sty 11 12:30  GPUCache
drwxrwxr-x 3 piotr piotr  4096 sty 11 12:30 'Local Storage'
-rw-rw-r-- 1 piotr piotr     0 sty 11 12:19  lockfile
drwxrwxr-x 3 piotr piotr  4096 sty 11 12:30  Logs
drwxrwxr-x 2 piotr piotr  4096 sty 11 12:30  Secrets-1.0
drwxrwxr-x 4 piotr piotr  4096 sty 11 12:30  tls
drwxrwxr-x 3 piotr piotr  4096 sty 11 12:33  Wallet-1.0-acid
-rw-rw-r-- 1 piotr piotr 45056 sty 11 12:19  Wallet-1.0-sqlite.sqlite3
drwxrwxr-x 2 piotr piotr  4096 sty 11 12:19  webrtc_event_logs

where:

$ ls -l ~/Documents/daedalus-win/Daedalus/Wallet-1.0-acid/
total 16
drwxrwxr-x 2 piotr piotr 4096 sty 11 12:40 Archive
-rw-rw-r-- 1 piotr piotr  127 sty 11 12:40 checkpoints-0000000004.log
-rw-rw-r-- 1 piotr piotr    0 sty 11 12:40 checkpoints-0000000005.log
-rw-rw-r-- 1 piotr piotr    6 sty 11 12:19 checkpoints.version
-rw-rw-r-- 1 piotr piotr    0 sty 11 12:29 events-0000000000.log
-rw-rw-r-- 1 piotr piotr    6 sty 11 12:19 events.version
-rw-rw-r-- 1 piotr piotr    0 sty 11 12:19 open.lock

With that I am able to run the tool like this:

$ ./export-wallets --mainnet \
--wallet-db-path ~/Documents/daedalus-win/Daedalus/Wallet-1.0 \
--keyfile ~/Documents/daedalus-win/Daedalus/Secrets-1.0/secret.key

[]

Is there any error you are seing?

@piotr-iohk - Thanks SO much!!!! i just got it to work! and thanks to @KtorZ for originally providing reference to the tools and @mprymek for the heads up on linux version

Before i was just copying a subset of files and Directories (Wallet-1.0-acid, Wallet-1.0-sqlite.sqlite3 and Secrets-1.0)..

This time i copied the whole Directory (c:\users\Name\AppData\Roaming\Daedalus) across into linux, dumped them in the user documents directory like you did and ran the tool as you specified.. it worked! I don't have a very good grasp on linux, so maybe i was screwing something else up before..

Now i am off to start looking at the whole API side, to try and see how to import the encrypted strings!!

PS for those following along (and like me have no linux exp), after a default install of Ubuntu 18.04 i had to run "sudo apt-get update" then "sudo apt-get install librocksdb5.8" to get the required library to be able to get the tool to run (you need an internet connection for that to work)

@khughes5 Did you figure out how to import the encrypted strings?

Unfortunately not yet (i am not a programmer).. and i don't even know if i am on the right track here.. but i was hoping to use my Daedalus flight 3.1.0 install on windows (which seems to run the cardano-node.exe on a random listening port), along with the method described in https://iohk.zendesk.com/hc/en-us/articles/900000672303-How-to-migrate-a-Byron-Legacy-wallet-to-cardano-wallet- with the payload replaced with that described in the random(from xprv) tab by KtorZ above..

the listening port number for cardano-wallet appears to be shown in FC3.1.0 under help/Deadalus Diagnostics.. but right now i am getting certificate errors when using curl against the port for a simple query (like https://localhost:64139/wallets) .. Even when i use the --cacert pointing to the \tlsclientclient.pem file, it displays the error "the certificate chain was issued by an authority that is not trusted".. not sure if we are able to run the api calls via the FC developer tools/console interface..

again not sure if i am totally missing the mark here.. very open to help from anyone in the thread about what to do with the extracted information from the tool :)

@khughes5 I have a tool that can be handy for your use case, but you'll need to have ruby installed on your system. For Windows Ruby+Devkit 2.7.2-1 (x64) from https://rubyinstaller.org/downloads/ should be OK.

The tool (https://github.com/piotr-iohk/ikar) is a lightweit web app over cardano-wallet and can be easily connected with underalying cardano-wallet of your Daedalus instance.

  1. To start the tool (once you have ruby on your system):
git clone https://github.com/piotr-iohk/ikar.git
cd ikar
bundle config set without 'development test'
bundle install
ruby app.rb
  1. Then point your browser to http://localhost:4444/ and click at "Discover" button. If you have Daedalus running you should get it on the list of discovered cardano-wallet servers, like this:

Screenshot from 2021-01-12 17-30-48

  1. Click "Connect"
  2. Then go to "Byron Wallets" -> "Create random (from xprv)"
  3. Paste the output of export-wallets command into the form like below and hit "Create"

Screenshot from 2021-01-12 17-33-46

  1. That's it. You should have your wallet now visible in Daedalus and once it is restored you should be able to migrate your funds to Shelley wallet from there.

Hope that helps!

@piotr-iohk I can't thank you enough!!! thanks so much, using your instructions (and install git for windows) i was able to easily import it into my Daedalus app, and transfer the ADA across to a new shelley wallet!!

That's a massive weight off my shoulders! and i can't thank you enough!!! I am sure i am not the first to be saved from everyones guidance and advice through this thread!!

I trying to rename "Wallet-1.0" to "Wallet-1.0-acid" but use "Wallet-1.0" in command line instead, so now the error "There's no acid-state database matching the given path." resolved:

./export-wallets --wallet-db-path /Wallet-1.0 --keyfile /Secrets-1.0/secret.key --mainnet

But now I get the error

export-wallets: Could not parse saved checkpoint due to the following error: Failed reading: safecopy: Cardano.Wallet.Kernel.DB.AcidState.DB: Cannot find getter associated with this version number: Version {unVersion = 2}
Empty call stack

CallStack (from HasCallStack):
  error, called at src/Data/Acid/Local.hs:329:7 in acid-state-0.15.0-KPx3nxg5ffCDH1G6VxHbSk:Data.Acid.Local

I used daedalus in 2018 last time and now I have only Secrets-1.0 and Wallet-1.0 folders backup. Also I remember decrypt pasword.
Anyone can help? Thanks guys.

export-wallets-c1815b7d.tar.gz

@devilus

I triggered a compilation during lunch of the latest version of the export tool linked earlier. That version makes the acid-state database optional (as it is only really used to extract wallet names and map them to keys in the keystore). So you could use that to extract keys from your keystore. If you've a single one there's no ambiguity, and if you have multiple ones, you'd have to figure out which one is which by restoring them all and looking at the transaction history.

@KtorZ

Which linux version do you use? I can't find librocksdb.so.6 package for ubuntu 18.

./export-wallets --keyfile /Secrets-1.0/secret.key --mainnet
./export-wallets: error while loading shared libraries: librocksdb.so.6: cannot open shared object file: No such file or directory

The binary isn't statically linked sorry. That'd take a bit more work to do for Haskell system dependencies are typically dynamically linked. You need rocksdb to run that one unfortunately. On aptitude, you get the necessary dependencies by installing librocksdb-dev

apt get install librocksdb-dev

@KtorZ
Thanks a lot :)

Ok now I have a restored key from secret key:

[
    {
        "encrypted_root_private_key": "_hash_string_",
        "is_passphrase_empty": false,
        "name": null,
        "id": "_id_string_",
        "passphrase_hash": "_hash_string_"
    }
]

Don't understand fully what I need to do now?

@devilus one option is to try with this -> https://github.com/input-output-hk/cardano-wallet/issues/2395#issuecomment-758784374.

(Probably you might want to change "name": null into something like "name": "My wallet")

@piotr-iohk
I trying your solution right now :)

I have a lastest 3.1.0 version Daedalus Mainnet installed and synced with fresh wallet. But after https connection to node only "Tools->Generate mnemonics" menu active. What I'm doing wrong?

Did you click at Discover button and Connected to your Daedalus?

Yes sure.

After click "Discover"
image

After click "Connect"
image

Ok, I've noticed this sometimes happening when you were already connected to different Daedalus instance and now trying to re-connect to another one. The only solution for now is to restart ikar (i.e. kill ruby process and start ruby app.rb again) and try to discover and connect again. If this doesn't help, you may try making a request to Daedalus' underlying cardano-wallet via curl (just replace <PORT>, <USER>, <xprv> and <pass> with your data):

curl -X POST https://localhost:<PORT>/v2/byron-wallets \ 
-d '{"encrypted_root_private_key":"<xprv>","name":"My Old Byron Wallet","passphrase_hash":"<pass>","style":"random"}' \ 
--cert /Users/<USER>/Library/Application Support/Daedalus Mainnet/tls/client/client.pem \
--cacert /Users/<USER>/Library/Application Support/Daedalus Mainnet/tls/client/ca.crt \ 
-H "Content-Type: application/json"

@piotr-iohk
Unfortunately doesn't work by curl. Where is my mistake?

curl -X POST http://localhost:4444/v2/byron-wallets --cert /Users/max/Library/Application\ Support/Daedalus\ Mainnet/tls/client/client.pem --cacert /Users/max/Library/Application\ Support/Daedalus\ Mainnet/tls/client/ca.crt -d '{"encrypted_root_private_key":"__KEY__","name":"My Old Byron Wallet","passphrase_hash":"__HASH__","style":"random"}' -H "Content-Type: application/json"

Response

<!DOCTYPE html>
<html>
<head>
  <style type="text/css">
  body { text-align:center;font-family:helvetica,arial;font-size:22px;
    color:#888;margin:20px}
  #c {margin:0 auto;width:500px;text-align:left}
  </style>
</head>
<body>
  <h2>Sinatra doesn’t know this ditty.</h2>
  <img src='http://localhost:4444/__sinatra__/404.png'>
  <div id="c">
    Try this:
    <pre>post &#x27;&#x2F;v2&#x2F;byron-wallets&#x27; do
  &quot;Hello World&quot;
end
</pre>
  </div>
</body>
</html>

Port should be a Daedalus' wallet port, so based on your screenshot from https://github.com/input-output-hk/cardano-wallet/issues/2395#issuecomment-759498554 61103.

I did it! Thank you guys @piotr-iohk @KtorZ for help!🥳

The binary isn't statically linked sorry. That'd take a bit more work to do for Haskell system dependencies are typically dynamically linked. You need rocksdb to run that one unfortunately. On aptitude, you get the necessary dependencies by installing librocksdb-dev

apt get install librocksdb-dev

Hi, I still do not get how to install librocksdb.so.6. The libsrocksdb-dev package installs the 5.8.8 version.
I have also downloaded from github the latest rocksdb, compiled and installed it. Still, I do not see the version 6 of librocksdb.
Do I need a specific setup?

The binary isn't statically linked sorry. That'd take a bit more work to do for Haskell system dependencies are typically dynamically linked. You need rocksdb to run that one unfortunately. On aptitude, you get the necessary dependencies by installing librocksdb-dev

apt get install librocksdb-dev

Hi, I still do not get how to install librocksdb.so.6. The libsrocksdb-dev package installs the 5.8.8 version.
I have also downloaded from github the latest rocksdb, compiled and installed it. Still, I do not see the version 6 of librocksdb.
Do I need a specific setup?

Ok, I got it. I modified the Makefile to create dynamic libraries (LIB_MODE?=shared). All good.

Note: there's now a pure typescript implementation of the extract-wallet tool above:

https://github.com/input-output-hk/daedalus/pull/2308

This should make it possible to restore the recovery feature in Daedalus and unlock those who haven't managed to go with the command-line way.

Note: there's now a pure typescript implementation of the extract-wallet tool above:

input-output-hk/daedalus#2308

This should make it possible to restore the recovery feature in Daedalus and unlock those who haven't managed to go with the command-line way.

Wonderful!

Now I have this structure decoded from my secret.key:

{
  "encryptedPayload": {
    "data": [ /* some data */],
    "type": "Buffer"},
  "isEmptyPassphrase": false,
  "passphraseHash": {
    "data": [/* some data */],
    "type": "Buffer"},
  "walletId": "...some HEX..."
}

What can I do next? Can I test some passwords against the password hash? Can I somehow get the recovery phrase? Or anything else to do with that data?

@mprymek the best you can do now is to use these inputs to feed into the wallet server via:

https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/postByronWallet

Screenshot from 2021-01-20 12-12-25

This will restore your wallet, and you'll be able to make a payment from it provided you remember the encryption passphrase.

Can I test some passwords against the password hash?

You could, although it's not straightfroward. The password hash is using a scrypt algorithm, ran on top of the a blake2b_256 hash of your passphrase, serialized as CBOR.

Can I somehow get the recovery phrase?

No. Never. There's a one way transformation from the recovery phrase to the wallet root private key. What you have in the keystore is the (encrypted) root private key; there's no way back to the recovery phrase.

@mprymek the best you can do now is to use these inputs to feed into the wallet server via:

https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/postByronWallet

This will restore your wallet, and you'll be able to make a payment from it provided you remember the encryption passphrase.

I'm sorry, I don't understand this. There's a required property mnemonic_sentence on this endpoint. I don't have it. How can I use this endpoint?! Everything I have is encryptedPayload, passphraseHash and walletId. None of them is used by this endpoint.

You could, although it's not straightfroward. The password hash is using a scrypt algorithm, ran on top of the a blake2b_256 hash of your passphrase, serialized as CBOR.

Could you please post a function which will accept a passphraseHash and a password and return true if matched, false otherwise?

@mprymek this endpoints accepts 6 different kind of input payloads. See the screenshot I've shared, you need the one labelled "random (from xprv)" which doesn't require a mnemonic sentence, the documentation has tabs you can click on.

Could you please post a function which will accept a passphraseHash and a password and return true if matched, false otherwise?

Not yet, but I'll see if I find time. In the meantime, you could let the server do it by trying to change the passphrase to something else. If the old passphrase doesn't match, the request will fail.

@mprymek this endpoints accepts 6 different kind of input payloads. See the screenshot I've shared, you need the one labelled "random (from xprv)" which doesn't require a mnemonic sentence, the documentation has tabs you can click on.

Ah, ok, my bad. What should I feed to encrypted_root_private_key? Whole encryptedPayload converted to hex string?

Not yet, but I'll see if I find time. In the meantime, you could let the server do it by trying to change the passphrase to something else. If the old passphrase doesn't match, the request will fail.

Ok, thanks!

Ah, ok, my bad. What should I feed to encrypted_root_private_key? Whole encryptedPayload converted to hex string?

Exactly.

It worked! My old wallet successfully imported into the current Daedalus!

Thank you, @KtorZ very very much!

Dear @piotr-iohk , dear all,

I am trying to use the Ikar tool to restore my old Daedalus 0.11.2 wallet, but so far with no success:

  • I have Ikar and my Daedalus running ("Connecting to network..."), When I click on Discovery, it says "Wallet servers discovered: 0"
    image

  • However, when I click on Connect, I get connected over HTTP (the icon goes green), but I don't know what to do next, the List of Byron wallets is empty...
    image

Thank you very much in advance for your help

Note: there's now a pure typescript implementation of the extract-wallet tool above:
input-output-hk/daedalus#2308
This should make it possible to restore the recovery feature in Daedalus and unlock those who haven't managed to go with the command-line way.

Wonderful!

Now I have this structure decoded from my secret.key:

{
  "encryptedPayload": {
    "data": [ /* some data */],
    "type": "Buffer"},
  "isEmptyPassphrase": false,
  "passphraseHash": {
    "data": [/* some data */],
    "type": "Buffer"},
  "walletId": "...some HEX..."
}

What can I do next? Can I test some passwords against the password hash? Can I somehow get the recovery phrase? Or anything else to do with that data?

Dear @mprymek could you explain how you managed to do that? Many thanks in advance

@chmieleslav I am not familiar with Ikar but this:

Screenshot from 2021-02-05 17-40-19

looks like a drop-down menu where you may be able to select https as a protocol to run subsequent queries?

Dear @KtorZ , thanks for your quick reply. The https connection / discovery didn't work for me either... I just installed the very last version of Daedalus, but the "import from earlier version " is not implemented... Is there a chance it gets implemented someday?

https://iohk.zendesk.com/hc/en-us/articles/900002473086-Wallet-import-feature-is-currently-disabled

I'm wondering if it WAS available in any earlier version of Daedalus which I could still use now... Otherwise I'll have to wait :(

@chmieleslav as far as I see from the screenshot you shared (https://github.com/input-output-hk/cardano-wallet/issues/2395#issuecomment-774123084) you are trying to connect Ikar to old Daedalus (0.11). That won't work as the underlying cardano-wallet won't even start (I think) on that old version of Daedalus.

The steps I have described in https://github.com/input-output-hk/cardano-wallet/issues/2395#issuecomment-758784374 will work for connecting to new Daedalus where you can import your wallet once you have your old key extracted from old Daedalus.

For extracting the old keys you can use this tool -> https://github.com/input-output-hk/cardano-wallet/issues/2395#issuecomment-759402979 following those steps -> https://github.com/input-output-hk/cardano-wallet/issues/2395#issuecomment-757901705. Unfortunately for this you'll need a Linux machine.

But now I get the error

export-wallets: Could not parse saved checkpoint due to the following error: Failed reading: safecopy: Cardano.Wallet.Kernel.DB.AcidState.DB: Cannot find getter associated with this version number: Version {unVersion = 2}
Empty call stack

CallStack (from HasCallStack):
  error, called at src/Data/Acid/Local.hs:329:7 in acid-state-0.15.0-KPx3nxg5ffCDH1G6VxHbSk:Data.Acid.Local

I used daedalus in 2018 last time and now I have only Secrets-1.0 and Wallet-1.0 folders backup. Also I remember decrypt pasword.
Anyone can help? Thanks guys.

Dear @devilus how did you solve the "Could not parse saved checkpoint due to the following error: Failed reading: safecopy" error? Thank you in advance

Dear @piotr-iohk , dear @diego76
Could you please help me get librocksdb.so.6 on my PC? At this point I tried pretty much everything from this thread, including building and installing the latest version of librocksdb from github by myself, but still no success...

My config:

Distributor ID: Ubuntu
Description:    Ubuntu 18.04.5 LTS
Release:        18.04
Codename:       bionic

I get the master branch of rocksdb from github: https://github.com/facebook/rocksdb

In the INSTALL.md file I read:
_* make shared_lib will compile librocksdb.so, RocksDB shared library. Compiles shared library in release mode._

So I build it:

root@chmiel:/mnt/c/workspace/rocksdb-master/rocksdb-master# make shared_lib
...
  CC       third-party/folly/folly/synchronization/DistributedMutex.o
  CC       third-party/folly/folly/synchronization/ParkingLot.o
  CC       third-party/folly/folly/synchronization/WaitOptions.o
  GEN      util/build_version.cc
$DEBUG_LEVEL is 0
make: Warning: File 'third-party/folly/folly/synchronization/WaitOptions.cpp.d' has modification time 629 s in the future
  CC       util/build_version.o
  CCLD     librocksdb.so.6.17.0
ln -fs librocksdb.so.6.17.0 librocksdb.so.6.17
ln -fs librocksdb.so.6.17.0 librocksdb.so.6
ln -fs librocksdb.so.6.17.0 librocksdb.so
make: warning:  Clock skew detected.  Your build may be incomplete.

There is a "clock skew" warning, but I install:

root@chmiel:/mnt/c/workspace/rocksdb-master/rocksdb-master# sudo make install
$DEBUG_LEVEL is 0
make: Warning: File 'third-party/folly/folly/synchronization/WaitOptions.cpp.d' has modification time 389 s in the future
echo 'prefix=/usr/local' > rocksdb.pc
echo 'exec_prefix=${prefix}' >> rocksdb.pc
echo 'includedir=${prefix}/include' >> rocksdb.pc
echo 'libdir=/usr/local/lib' >> rocksdb.pc
echo '' >> rocksdb.pc
echo 'Name: rocksdb' >> rocksdb.pc
echo 'Description: An embeddable persistent key-value store for fast storage' >> rocksdb.pc
echo Version: 6.17.0 >> rocksdb.pc
echo 'Libs: -L${libdir}  -ldl -lrocksdb' >> rocksdb.pc
echo 'Libs.private: -lpthread -lrt -ldl' >> rocksdb.pc
echo 'Cflags: -I${includedir} -std=c++11  -faligned-new -DHAVE_ALIGNED_NEW -DROCKSDB_PLATFORM_POSIX -DROCKSDB_LIB_IO_POSIX  -DOS_LINUX -fno-builtin-memcmp -DROCKSDB_FALLOCATE_PRESENT -DROCKSDB_MALLOC_USABLE_SIZE -DROCKSDB_PTHREAD_ADAPTIVE_MUTEX -DROCKSDB_BACKTRACE -DROCKSDB_RANGESYNC_PRESENT -DROCKSDB_SCHED_GETCPU_PRESENT -DROCKSDB_AUXV_GETAUXVAL_PRESENT -march=native   -DHAVE_SSE42  -DHAVE_PCLMUL  -DHAVE_AVX2  -DHAVE_BMI  -DHAVE_LZCNT -DHAVE_UINT128_EXTENSION -DROCKSDB_SUPPORT_THREAD_LOCAL  -isystem third-party/gtest-1.8.1/fused-src -isystem ./third-party/folly' >> rocksdb.pc
install -d /usr/local/lib
install -d /usr/local/lib/pkgconfig
for header_dir in `find "include/rocksdb" -type d`; do \
        install -d //usr/local/$header_dir; \
done
for header in `find "include/rocksdb" -type f -name *.h`; do \
        install -C -m 644 $header //usr/local/$header; \
done
install -C -m 644 rocksdb.pc /usr/local/lib/pkgconfig/rocksdb.pc
  AR       librocksdb.a
/usr/bin/ar: creating librocksdb.a
install -d /usr/local/lib
install -C -m 755 librocksdb.a /usr/local/lib
[ -e librocksdb.so.6.17.0 ] && make install-shared || :
make: warning:  Clock skew detected.  Your build may be incomplete.

But then, when I check the version of ibrocksdb, it still says 5.8.8...:

root@chmiel:/mnt/c/Users/Piotr/AppData/Roaming/Daedalus# dpkg -l | grep librocksdb
ii  librocksdb-dev                 5.8.8-1                             amd64        persistent Key-Value Store for Flash and RAM Storage (development)
ii  librocksdb5.8                  5.8.8-1                             amd64        persistent Key-Value Store for Flash and RAM Storage

And still the same error here:

root@chmiel:/mnt/c/Users/Piotr/AppData/Roaming/Daedalus# ./export-wallets --mainnet --wallet-db-path Wallet-1.0 --keyfile Secrets-1.0/secret.key
./export-wallets: error while loading shared libraries: librocksdb.so.6: cannot open shared object file: No such file or directory
root@chmiel:/mnt/c/Users/Piotr/AppData/Roaming/Daedalus#

Thank you very much in advance for your help.

PS. Another idea I tried was to symlink so.5.8.8 to so.6 version of this lib.

sudo ln -sf /usr/lib/librocksdb.so.5.8.8 /usr/lib/librocksdb.so.6
Which gives a strange error like this (@devilus had it too, any help will be much appreciated):

export-wallets: Could not parse saved checkpoint due to the following error: Failed reading: safecopy: Cardano.Wallet.Kernel.DB.AcidState.DB: Cannot find getter associated with this version number: Version {unVersion = 2}
Empty call stack

CallStack (from HasCallStack):
  error, called at src/Data/Acid/Local.hs:329:7 in acid-state-0.15.0-KPx3nxg5ffCDH1G6VxHbSk:Data.Acid.Local

I just realized that I was missing export (sorry...!)

root@chmiel:~# sudo ldconfig -v
/usr/local/lib:
        librocksdb.so.6.17 -> librocksdb.so.6.17.0
/usr/lib:
        librocksdb.so.5.8 -> librocksdb.so.5.8.8

With the following command:
root@chmiel:~# export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib I moved forward, but I have a new error...:

root@chmiel:/mnt/c/Users/Piotr/AppData/Roaming/Daedalus# ./export-wallets --mainnet --wallet-db-path Wallet-1.0 --keyfile Secrets-1.0/secret.key
./export-wallets: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by ./export-wallets)
./export-wallets: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by ./export-wallets)

After the upgrade to Ubuntu 20.04:

root@chmiel:/mnt/c/Users/Piotr/AppData/Roaming/Daedalus# ./export-wallets --mainnet --wallet-db-path Wallet-1.0 --keyfile Secrets-1.0/secret.key
export-wallets: user error (There's no acid-state database matching the given path.)

I'm not sure I understand "acid" term correctly, but wasn't it supposed to be optional? Thank you in advance

@chmieleslav note that it now exists a pure TypeScript version of that keystore exporter. See the following pull request:

https://github.com/input-output-hk/daedalus/pull/2308

Thus, provided that you have node and npm installed, you could do as follows:

$ wget -O- https://github.com/input-output-hk/daedalus/archive/a82994e4fcf6cdc9551a46216fea8ba7eb571e33.zip | bsdtar xf - --include='*restore-keystore*'
$ cd daedalus-a82994e4fcf6cdc9551a46216fea8ba7eb571e33/restore-keystore
$ npm install && chmod +x restore-keystore.ts

| OS | Command |
| --- | --- |
| Linux | ./restore-keystore.ts ~/.local/share/Daedalus/mainnet/Secrets/secret.key |
| Mac OS | ./restore-keystore.ts ~/AppData/Roaming/Daedalus/Secrets-1.0/secret.key |

This worked like a charm, it gave me:

[
    {
        "name": "___name___",
        "encrypted_root_private_key": "___mykey___",
        "passphrase_hash": "___myhash___",
        "is_empty_passphrase": false
    }
]

Then I used Ikar, did the steps described in #2395 and voilà, I can see my old wallet syncing in the new Daedalus:

image

Thank you so much @piotr-iohk and @KtorZ - you saved my ADA savings and I learnt a lot from you! :)

Worked for me, too! Thanks so much, folks! (Yes, I’m one of those who were “smart” enough to backup secret.key instead of writing down the mnemonic back in 2018).

However, I ran into two issues with the steps above which might be related to me being on macOS (not sure though).

Here is what I did to make the restore-keystore.ts utility work:

  • Replace the first line in restore-keystore.ts by #!/usr/bin/env ts-node-script
  • Install typescript and ts-node globally: npm install -g typescript ts-node (sudo was not required)

Also, the ikar approach didn’t work for me. All tabs except “Tools” were disabled, even though it was set to the correct port.

I’ve therefore directly connected to the API using curl as outlined above by @piotr-iohk:

curl --cacert "$HOME/Library/Application Support/Daedalus Mainnet/tls/client/ca.crt" \
  --cert "$HOME/Library/Application Support/Daedalus Mainnet/tls/client/client.pem" \
  https://localhost:$port/v2/byron-wallets -H "Content-Type: application/json" \
  -d '{"encrypted_root_private_key":"$encrypted_root_private_key","name":"My Old Byron Wallet","passphrase_hash":"$passphrase_hash","style":"random"}'

Make sure to replace $port, $encrypted_root_private_key, and $passphrase_hash by your actual values. You can look up the port by pressing ⌘ D in Daedalus.

That worked like a charm! Again, thanks a lot! ❤️

I was able to restore my wallet from my old state directory, so big thanks to everyone on this thread. However, that was only half the battle for me in regaining control of my ADA as I do not have my seed phrase (which is, admittedly irresponsible and entirely my fault given the warnings in Daedalus) and I am unable to recall my spending password.

Is there any method to decrypt/extract/recover the existing spending password or otherwise bypass the spending password to allow me to move funds out of the old wallet? Thanks!

Is there any method to decrypt/extract/recover the existing spending password or otherwise bypass the spending password to allow me to move funds out of the old wallet?

No. The seed is encrypted with strong encryption. It'd take you more than a lifetime to brute force it. So, best you can do is to try passphrases you can think of. Again and again :/...

The method worked perfectly well for me: https://github.com/input-output-hk/cardano-wallet/issues/2395#issuecomment-775014725

I am a windows user. I have used the virtualbox with Ubuntu 20.04 and installed npm and node:
https://www.geeksforgeeks.org/installation-of-node-js-on-linux/
Copied the secrets dir and run the restore-keystore tool.

Ikar worked perfectly well to import wallet back to daedalus as described. Fortunately I got the spending pass...

Thank you for this thread!

Is there any method to decrypt/extract/recover the existing spending password or otherwise bypass the spending password to allow me to move funds out of the old wallet?

No. The seed is encrypted with strong encryption. It'd take you more than a lifetime to brute force it. So, best you can do is to try passphrases you can think of. Again and again :/...

Thanks for the reply. Unfortunately for me, I used my password manager to generate a secure spending password and then somehow failed to save it.

To come at it from a different angle, is there a way to repeatedly retry/check the spending password without manual intervention such that I could use a password cracking program to try to crack the spending password? I'm fairly certain I know the number of characters in the spending password, but that's about all I have to go on.

Thanks again for your help. I know this isn't really a Cardano/Daedalus issue and was caused entirely by user error, so I really appreciate any insight you (or anyone else here) might be able provide.

@strangedesign11 such that I could use a password cracking program to try to crack the spending password

I am really sorry but, If this was possible we would have a major vulnerability problem. Things is, with the current encryption algorithm and parameters, each verification takes around 50ms on a high-end CPU. If you've generated your passphrase using a passphrase manager, then it's likely a quite _secure passphrase_, with quite many characters. The encryption is resistant to rainbow tables and dictionary attacks, so even with a passphrase of only 6 characters, it'd take you a few hundred years to brute-force it. Even with a modern GPU, for a long-enough passphrase it would just be unfeasible :/

Hi KtorZ, I tried to restrore my wallet using Daedalus Flight 3.3.0 using my secret.key but i got below error message. Is my secret.key corrupt or won't work with Daedalus Flight 3.3.0?

Error

@michael8359 Sounds like your secret.key is empty or corrupted indeed.

@KtorZ No way for me to recover my wallet?

@michael8359 I am afraid not. For any help with Daedalus however, please contact the technical support desk or, reach out on https://github.com/input-output-hk/daedalus/issues/1234.

Incidentally, one of the last comment on that thread recommend to make sure to close the old Daedalus before attempting to restore from the secret.key file. Make sure it's the case :+1:

Closing this issue now since Daedalus 3.3.0 now bring back the wallet recovery feature. Thanks all for your patience :pray:

Was this page helpful?
0 / 5 - 0 ratings