Skip to content

How can I restore wallet from secret.key file from daedalus 0.15.1 #2395

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
skazichris opened this issue Dec 14, 2020 · 79 comments
Closed

How can I restore wallet from secret.key file from daedalus 0.15.1 #2395

skazichris opened this issue Dec 14, 2020 · 79 comments

Comments

@skazichris
Copy link

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?
input-output-hk/daedalus#1234 (comment)

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

@mkr-j
Copy link

mkr-j commented Jan 4, 2021

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!

@KtorZ
Copy link
Member

KtorZ commented Jan 4, 2021

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?

@mprymek
Copy link

mprymek commented Jan 4, 2021

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.

@KtorZ
Copy link
Member

KtorZ commented Jan 4, 2021

@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. 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).

@mprymek
Copy link

mprymek commented Jan 4, 2021

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 :)

@mkr-j
Copy link

mkr-j commented Jan 5, 2021

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?

@mprymek
Copy link

mprymek commented Jan 8, 2021

@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

@rdlrt
Copy link

rdlrt commented Jan 9, 2021

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 🙂

@devilus
Copy link

devilus commented Jan 9, 2021

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.)

@clovehitch
Copy link

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.

@khughes5
Copy link

khughes5 commented Jan 10, 2021

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)

@testbookbear
Copy link

testbookbear commented Jan 11, 2021

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

@piotr-iohk
Copy link
Contributor

piotr-iohk commented Jan 11, 2021

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"

@khughes5
Copy link

khughes5 commented Jan 11, 2021

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

@piotr-iohk
Copy link
Contributor

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?

@khughes5
Copy link

khughes5 commented Jan 11, 2021

@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)

@clovehitch
Copy link

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

@khughes5
Copy link

khughes5 commented Jan 12, 2021

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 \tls\client\client.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 :)

@piotr-iohk
Copy link
Contributor

@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!

@khughes5
Copy link

@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!!

@devilus
Copy link

devilus commented Jan 13, 2021

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.

@KtorZ
Copy link
Member

KtorZ commented Jan 13, 2021

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.

@devilus
Copy link

devilus commented Jan 13, 2021

@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

@KtorZ
Copy link
Member

KtorZ commented Jan 13, 2021

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

@devilus
Copy link

devilus commented Jan 13, 2021

@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?

@piotr-iohk
Copy link
Contributor

@devilus one option is to try with this -> #2395 (comment).

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

@devilus
Copy link

devilus commented Jan 13, 2021

@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?

@piotr-iohk
Copy link
Contributor

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

@devilus
Copy link

devilus commented Jan 13, 2021

Yes sure.

After click "Discover"
image

After click "Connect"
image

@chmieleslav
Copy link

chmieleslav commented Feb 8, 2021

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! :)

@aaronk6
Copy link

aaronk6 commented Feb 8, 2021

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! ❤️

@strangedesign11
Copy link

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!

@KtorZ
Copy link
Member

KtorZ commented Feb 10, 2021

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 :/...

@wawabiker
Copy link

The method worked perfectly well for me: #2395 (comment)

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!

@strangedesign11
Copy link

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.

@KtorZ
Copy link
Member

KtorZ commented Feb 11, 2021

@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 :/

@michael8359
Copy link

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

@KtorZ
Copy link
Member

KtorZ commented Feb 16, 2021

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

@michael8359
Copy link

@KtorZ No way for me to recover my wallet?

@KtorZ
Copy link
Member

KtorZ commented Feb 18, 2021

@michael8359 I am afraid not. For any help with Daedalus however, please contact the technical support desk or, reach out on input-output-hk/daedalus#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 👍

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

@KtorZ KtorZ closed this as completed Feb 18, 2021
@Anviking Anviking unpinned this issue Mar 31, 2021
@NeedHelp305
Copy link

NeedHelp305 commented May 2, 2021

@KtorZ or anyone I have used the virtualbox with Ubuntu 20.04 and installed npm and node. Copied the secrets dir and run the restore-keystore tool as described above in Ubuntu Terminal. I get the below error. What am I doing wrong? Am I missing a package or library? Thanks.

(node:4030) UnhandledPromiseRejectionWarning: Error: Additional info not implemented: 30
    at Decoder._parse (/home/cmendez305/daedalus-a82994e4fcf6cdc9551a46216fea8ba7eb571e33/restore-keystore/node_modules/cbor/lib/decoder.js:455:17)
    at _parse.next ()
    at Decoder._transform (/home/cmendez305/daedalus-a82994e4fcf6cdc9551a46216fea8ba7eb571e33/restore-keystore/node_modules/cbor/vendor/binary-parse-stream/index.js:45:29)
    at Decoder.Transform._read (internal/streams/transform.js:205:10)
    at Decoder.Transform._write (internal/streams/transform.js:193:12)
    at writeOrBuffer (internal/streams/writable.js:358:12)
    at Decoder.Writable.write (internal/streams/writable.js:303:10)
    at NoFilter.ondata (internal/streams/readable.js:719:22)
    at NoFilter.emit (events.js:315:20)
    at NoFilter.EventEmitter.emit (domain.js:467:12)
(Use node --trace-warnings ... to show where the warning was created)
(node:4030) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:4030) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

@piotr-iohk
Copy link
Contributor

@NeedHelp305 the feature of importing old wallet from state directory or secret.key is now available directly in Daedalus. Have you tried that? (Add wallet -> Import)

Screenshot from 2021-05-04 09-25-54

@NeedHelp305
Copy link

@NeedHelp305 the feature of importing old wallet from state directory or secret.key is now available directly in Daedalus. Have you tried that? (Add wallet -> Import)

Screenshot from 2021-05-04 09-25-54

Indeed I did was the first thing I tried actually. I get the dreaded 'Wallets not found...' error as attached even though I point to directory and there is data in both State directory and secret.key file.
Daedalus State2

and this:
Daedalus State1

So then I built a VM with Ubuntu 18.04. Installed node. Installed npm. Python etc. tried the ./export-wallets tool as described above and I'm now stuck here with this error:

Ubuntu error 1

From the little I've been able to learn about Ubuntu it sounds like it's missing a specific file or library? Have not found how to install this missing library yet. Any ideas much appreciated. Thanks.

@NeedHelp305
Copy link

Also tried the ./restore-keystore.ts tool in Ubuntu 18.04 and I got stuck with that one at this point with this error:

Ubuntu restore-keystore error 1

So I ran the suggested 'npm fund' which showed me this:

Ubuntu restore-keystore error 2

What am I doing wrong with the restore-keystore tool?

@quangthienit1994
Copy link

@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 :/

Excuse me, Can you explain about algorithm of passphare ? I don't see any document said about it.

@gitstar2022
Copy link

@stive131 > @KtorZ Hi KtorZ. I have a secret.key which is set no spending password. Is it possible to get unencrypted private key(192 character) by export-wallets? I would like to import to yoroi.

Hey! currently dealing with the same issue. I've got a fair bit of info on solutions, can possibly point you in the right direction of troubleshooting on your own.

You can not decrypt your secret.key- It is a one way encryption only which only works with Daedalus. There is no function you can call to retrieve it.

Are you working with a shelley or byron wallet? Do you know your mnemonics (you can use these in Yoroi). Are you currently using daedalus and what is your issue there? Do you know the error code?

@gitstar2022
Copy link

@stive131 when was your key file generated. is this a shelley wallet or byron?
do you know what the error code is? how many UXTOW are available and when was your last incoming or outgoing transaction. have you verified your balance on the blockchain?

@michael8359
Copy link

@fukur0kuju I have secret.key file but when i did import key and come out with error “wallet not found ”. Would you able to help me?

@MSC-InfoTech
Copy link

@fukur0kuju I just reached out to you, I have a similar issue, would really appreciate any help you can provide!

@gitstar2022
Copy link

@stive131 @michael8359 @MSC-InfoTech do not send your secret.key file to anyone. They will wipe your account. This person above is a scammer, they will ask for your secret.key or money upfront. Stay away!

@gitstar2022
Copy link

FD44F93E-B911-461A-85B5-35BEC6EA506D
From your own repository- you asking someone to send secret key.

#1 - I removed my entire error code due to the fact that I didn’t know if it contained sensitive information and was concerned when I saw someone post the same code above here. Have been dealing with Iohk on this for months - they’re aware of everything and of whom the owner of this wallet is.

I have nothing to do with the Stive131 account. They’re using the error code I posted which is why I removed it. You’ll see my post predates their join date on here even.

And you’ve appeared to just threatened me, which really isn’t needed. Just trying to protect people out here on the internet and I was alarmed that you created an account out of nowhere and started asking everyone to help. then I saw your repository asking for a secret.key file. No need to come at me or threaten me for trying to look out for others. If I’m wrong and you’re a good human, then I apologize buddy.

@danielalexlarsen
Copy link

I am happy to see everyone who used Daedalus have regained access to their old wallets :)

Does anyone here have experience in regaining access to other wallets, such as Nami/CCVault?

I have an encrypted key + spending pass from ccvault, mistakingly lost the seed phrase.
I was told you could regain access to the wallet using only the encryption key + spending pass?

@Erhoz
Copy link

Erhoz commented Jul 14, 2023

@khughes5Eu tenho uma ferramenta que pode ser útil para o seu caso de uso, mas você precisará ter o ruby ​​instalado em seu sistema. Para Windows Ruby+Devkit 2.7.2-1 (x64)de https://rubyinstaller.org/downloads/ deve estar OK.

A ferramenta ( https://github.com/piotr-iohk/ikar ) é um aplicativo da web lightweit sobre cardano-wallet e pode ser facilmente conectado com o underaling cardano-walletde sua instância Daedalus.

  1. Para iniciar a ferramenta (depois de ter ruby ​​em seu sistema):
git clone https://github.com/piotr-iohk/ikar.git
cd ikar
bundle config set without 'development test'
bundle install
ruby app.rb
  1. Em seguida, aponte seu navegador para http://localhost:4444/ e clique no botão "Descobrir". Se você tiver o Daedalus em execução, deverá colocá-lo na lista de servidores cardano-wallet descobertos, assim:

Captura de tela de 2021-01-12 17-30-48

  1. Clique em "Conectar"
  2. Em seguida, vá para "Carteiras Byron" -> "Criar aleatório (de xprv)"
  3. Cole a saída do export-walletscomando no formulário abaixo e clique em "Criar"

Captura de tela de 2021-01-12 17-33-46

  1. É isso. Você deve ter sua carteira agora visível no Daedalus e, uma vez restaurada, poderá migrar seus fundos para a carteira Shelley a partir daí.

Espero que ajude!

hello, my friend, I came here to ask for your help, because I am completely lost in an attempt to regain access to my wallet, I had a very old daedalus wallet, which I only kept from it a master key, which is here with me, I have already acquired quite a few application that uses it to recover my funds, but I can't find this application, they all use words or a "secret.key" file, is there any application that I can use that generates a secret.key file to use in daedalus, or else that generates a key.json file so I can use it in adalite.io?

thank you in advance and I apologize if I'm writing in the wrong thread

@DevKing1112
Copy link

Hello everyone!
i have secret.key.
I installed daedalus7.0.1 and loaded the secret.key file and completed the sync.
But I can’t send.
I get the bug “An error occurred”.
I loaded the secret.key file and need another security key?
I have 1.5M ADA in my wallet.

The ADA in the wallet is the money that was kept when the company was established. It was collected in the 10th year of establishment to contribute to society.

How about it?

Please help me!

@abailly
Copy link
Collaborator

abailly commented May 23, 2025

@DevKing1112 Please reach out to Daedalus team support here: https://iohk.zendesk.com/hc/en-us/categories/360000877653-Daedalus-wallet-mainnet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests