# I have 23 words of my 24 word mnemonic (and passphrase) for my ledger nano-s, is it possible for me to brute-force the last word (not in order)

I have ended up wiping my ledger nanao S during test (thoroughly stupid I know) and I am left with 23 (!) seed words and a passphrase. I understand that I should have both backed up my wallet, and made sure of my seed words. I was looking into a program (in python due to there not being too many combinations) that could brute force it due to me knowing that I had written them down in order, just having missed a word, (pasted here due to the massive size due to the size of the word list)

So how would I go about brute forcing it through python, what I have now can (as far as I can see) will give me all of the valid mnemonics, but from there how would I automate the collection of private keys from a bip-39 generator, and the checking of funds in them?

(edit) I know the order of the words, just not where the missing one is, Ive tried to manually sift through the combinations for if the missing word was the last one

(further edit) Im using an offline version of this site for turning the mnemonics into private keys iancoleman.io/bip39 but unfortunately I dont know how to canabalise the code or interact with it with python. from there I was going to use a tool like this github.com/gurnec/btcrecover to find the wallet with btc in it. At least thats what I have so far.

• Do you not know the order of any of the words in the list, or do you just not know the position of the missing one? May 9, 2018 at 23:14
• I know the order of the words, just not where the missing one is, Ive tried to manually sift through the combinations for if the missing word was the last one. May 9, 2018 at 23:19

There are 2048 words in the BIP39 list, there are 24 possible positions for your missing word.

You need to try 2048 x 24 = 49,152 combinations.

For each one, you need to generate a private key + public key and check whether addresses generated from that have any unspent bitcoin associated with them. You can work with a pruned blockchain and probably further prune based on the known date-ranges of your most recent transactions.

Superficially at least, it seems feasible for an automated process to do this in reasonable time (i.e. less than years).

Having tried all words in one position you should have a reasonable idea of how long this will take.

• Due to the way that the mnemonic has a checksum, I only needed to sift through 1/256 of the combinations and thats what the above program does, I was just curious if there were tools to do this already, or if I was overly complicating it. I had an offline version of this site for turning the mnemonics into private keys iancoleman.io/bip39 but unfortunately I dont know how to canabalise the code or interact with it with python. from there I was going to use a tool like this github.com/gurnec/btcrecover to find the wallet with btc in it. May 11, 2018 at 0:11

Since you know the first 23 words, it sound like you only need to calculate the BIP39 checksum, correct?

If so, this script might be what you are looking for. (I have not tried it)

Same thing happened to us. There is a script available here https://github.com/ashmoran/bip39_missing_word which you can use to recover this.

You may want to extend it to check the correct derived path if it has any previous transactions.

It usually generates about 100 valid wallets with one word missing.