<commit_before>---
layout:     post
title:      "Mnemonic Not Working - Recovering Lost Cryptocurrencies"
subtitle:   "How to recover an HD Wallet with Bitcoins, Etherium, Litecoin, Dash, etc."
date:       2017-09-10 12:00:00
author:     "<NAME>"
header-img: "img/mnemonic/crypto-bg.jpg"
comments:   true
published:  true
---

### Update

A few people have asked for help recovering their passphrases after finding this article. I am happy to help but wanted to list a few resources I found that could be useful:

This [guy grnqrtr has a service](http://grnqrtr.com/) for this and many references.

A wallet password and recovery tool: [btcrecover](https://github.com/gurnec/btcrecover).

A [python seed recover script](https://github.com/gurnec/btcrecover/blob/master/docs/Seedrecover_Quick_Start_Guide.md) from the above toolset that looks like it specifically addresses the issue of this article.



<hr style="border-color: gray;"/>

This post is long and covers my entire process, and I learned a lot of things on the way that are worth mentioning if you are interested in some technical crypto knowledge. Keep in mind there was definitely some trial and error and more direct processes possible (easy to see in hindsight). I use "word list", "passphrase", and "mnemonic" interchangeably and together below at times, so sorry for any confusion.

# Background Story

So my friend texts me that her boyfriend had lost $10K worth of coins after updating his wallet device, a [Ledger Nano S](https://www.ledgerwallet.com/products/ledger-nano-s). This is a USB hardware wallet that stores multiple types of coins "offline". Technically, coins are never really stored because they only exist on blockchains, but the passwords to access them are what people secure away. I don't know the details; something like... he was prompted to update the device, and [the default choice cleared out the existing wallet on it](http://support.ledgerwallet.com/knowledge_base/topics/after-the-nano-s-update-i-cant-find-my-coins). All the coins appeared lost after hours of effort.

I felt really bad for him and angry that Ledger doesn't make these consequences absolutely clear (afaik). I've been learning a lot more about cryptocurrencies lately, so while I assumed it was a lost cause, I wanted to help out if I could. My first thought was to leave the device completely alone, akin to not making any changes to your computer files if you accidentally deleted stuff you want to recover. Probably not analogous but a safe move until Ledger support could be reached.

After a little more conversation, I learned that he had written down the 24-word mnemonic passphrase for his wallet. These are automatically generated by the device for you. The 24 word passphrases are not the actual password themselves, but they can be converted into the actual passwords following a standard specification called [BIP39](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki). Two compounding issues though:

* It takes ~20 minutes to input the passphrase on the device, so any input mistakes are punishing.
* What if the written down word list was wrong?

But he had the word list, so even with something written down wrong, it made me optimistic recovery was a possibility. I remembered reading a similar story somewhere, probably on Reddit, where someone had written down one of their 24 words incorrectly, and a friendly interneter wrote a script to find out which word was a mistake and solved it! Something like that anyway - I searched briefly and couldn't find the story. In any case, I googled about restoring wallets from Ledger and passed on [their support page link](http://support.ledgerwallet.com/knowledge_base/topics/how-to-restore-my-backup-without-a-ledger-wallet) and a [website that makes it easier to check if your 24 words are valid](https://www.ledgerwallet.com/support/bip39-standalone.html). At this point, I think they accepted the loss but had some hope.

The next day they still hadn't had luck and sent me over the 24 words to play with.

# Finding the right mnemonic passphrase

Here's the passphrase word list (not the original, but will work as an example):

```
fiscal bomb mutual one alley mistake unfair they proof unveil month prepare logic yard daring adapt eyebrow turn burst mandate win report maximum giraffe
```

Aight, first things first, what does the [Mnemonic Code Converter / BIP39 Tool](https://www.ledgerwallet.com/support/bip39-standalone.html) by [Ian Coleman](https://github.com/iancoleman/bip39) (and used by Ledger) say when you enter this passphrase?


<a href="#">
    <img style="border: lightgray; border-width: thin; border-style: solid;"
          src="{{ site.baseurl }}/img/mnemonic/invalid-mnemonic.png" alt="invalid mnemonic"><commit_msg>Mnemonic post: update ian coleman link<commit_after>---
layout:     post
title:      "Mnemonic Not Working - Recovering Lost Cryptocurrencies"
subtitle:   "How to recover an HD Wallet with Bitcoins, Etherium, Litecoin, Dash, etc."
date:       2017-09-10 12:00:00
author:     "<NAME>"
header-img: "img/mnemonic/crypto-bg.jpg"
comments:   true
published:  true
---

### Update

A few people have asked for help recovering their passphrases after finding this article. I am happy to help but wanted to list a few resources I found that could be useful:

This [guy grnqrtr has a service](http://grnqrtr.com/) for this and many references.

A wallet password and recovery tool: [btcrecover](https://github.com/gurnec/btcrecover).

A [python seed recover script](https://github.com/gurnec/btcrecover/blob/master/docs/Seedrecover_Quick_Start_Guide.md) from the above toolset that looks like it specifically addresses the issue of this article.



<hr style="border-color: gray;"/>

This post is long and covers my entire process, and I learned a lot of things on the way that are worth mentioning if you are interested in some technical crypto knowledge. Keep in mind there was definitely some trial and error and more direct processes possible (easy to see in hindsight). I use "word list", "passphrase", and "mnemonic" interchangeably and together below at times, so sorry for any confusion.

# Background Story

So my friend texts me that her boyfriend had lost $10K worth of coins after updating his wallet device, a [Ledger Nano S](https://www.ledgerwallet.com/products/ledger-nano-s). This is a USB hardware wallet that stores multiple types of coins "offline". Technically, coins are never really stored because they only exist on blockchains, but the passwords to access them are what people secure away. I don't know the details; something like... he was prompted to update the device, and [the default choice cleared out the existing wallet on it](http://support.ledgerwallet.com/knowledge_base/topics/after-the-nano-s-update-i-cant-find-my-coins). All the coins appeared lost after hours of effort.

I felt really bad for him and angry that Ledger doesn't make these consequences absolutely clear (afaik). I've been learning a lot more about cryptocurrencies lately, so while I assumed it was a lost cause, I wanted to help out if I could. My first thought was to leave the device completely alone, akin to not making any changes to your computer files if you accidentally deleted stuff you want to recover. Probably not analogous but a safe move until Ledger support could be reached.

After a little more conversation, I learned that he had written down the 24-word mnemonic passphrase for his wallet. These are automatically generated by the device for you. The 24 word passphrases are not the actual password themselves, but they can be converted into the actual passwords following a standard specification called [BIP39](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki). Two compounding issues though:

* It takes ~20 minutes to input the passphrase on the device, so any input mistakes are punishing.
* What if the written down word list was wrong?

But he had the word list, so even with something written down wrong, it made me optimistic recovery was a possibility. I remembered reading a similar story somewhere, probably on Reddit, where someone had written down one of their 24 words incorrectly, and a friendly interneter wrote a script to find out which word was a mistake and solved it! Something like that anyway - I searched briefly and couldn't find the story. In any case, I googled about restoring wallets from Ledger and passed on [their support page link](http://support.ledgerwallet.com/knowledge_base/topics/how-to-restore-my-backup-without-a-ledger-wallet) and a [website that makes it easier to check if your 24 words are valid](https://www.ledgerwallet.com/support/bip39-standalone.html). At this point, I think they accepted the loss but had some hope.

The next day they still hadn't had luck and sent me over the 24 words to play with.

# Finding the right mnemonic passphrase

Here's the passphrase word list (not the original, but will work as an example):

```
fiscal bomb mutual one alley mistake unfair they proof unveil month prepare logic yard daring adapt eyebrow turn burst mandate win report maximum giraffe
```

Aight, first things first, what does the [Mnemonic Code Converter / BIP39 Tool](https://iancoleman.io/bip39/) by [Ian Coleman](https://github.com/iancoleman/bip39) (and used by Ledger) say when you enter this passphrase?


<a href="#">
    <img style="border: lightgray; border-width: thin; border-style: solid;"
          src="{{ site.baseurl }}/img/mnemonic/invalid-mnemonic.png" alt="invalid mnemonic">
{'fraction_non_alphanumeric': 0.06777533730781299, 'fraction_numerical': 0.008785691873235017, 'mean_word_length': 4.467124070897656, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 14, 'lorem ipsum': 0, 'www.': 5, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '910846', 'n_tokens_mistral': 2609, 'n_tokens_neox': 2452, 'n_words': 1320}