[Ethereum] How to restore a mnemonic seed with one missing word

hd-walletsmetamaskrecoverySecuritywallets

Anyone know how to restore an ethereum wallet from a seed that's missing only one word?

I'm able write a program that will narrow down the possible seeds to like 1500 candidates which are considered valid, but I'm not exactly sure what the next step is.

Each seed has an infinite number of addresses associated with it to my understanding, so how do I find which one has my wallet? Is there a way to search the hierarchy of each seed for my address in this lifetime? Is there something I'm misunderstanding about how HD wallets work?

Best Answer

I'm assuming you know which wallet you were using before and that you have previously received ether or tokens using the wallet -- or at least have posted a receiving address somewhere (if you're not expecting anyone to send ether/tokens to you and don't have anything stored, I can see only a few limited uses for not simply using a new seed).

Each wallet program that supports mnemonics uses a key derivation path -- effectively, a deterministic way of generating addresses and corresponding private keys from a mnemonic. Several wallets use the same path, but this is unimportant. What is important is that you know the wallet you used before (and, therefore, at least implicitly, have access to the key derivation path). If you have previously received ether or tokens on an address or have posted an address to receive ethers/tokens, then you know (or can know) a critical piece of information: an Ethereum address! Sure, each mnemonic can generate a lot of addresses, but in all likelihood, any address you used is one of the first few in the sequence generated using your mnemonic + the key derivation path. That is, your mnemonic + key derivation path will generate a sequence of addresses, A1, A2, A3...; generally, you'd use addresses in order. Thus, it's likelier that you've used A1 to receive ether/tokens than A2 and, similarly, that you've used A2 before A100000. Thus, there's no need to check A100000.

Now, with each candidate mnemonic with your missing word, you can generate the first hundred addresses using the key derivation path. If you know a receiving address, you can check to see if that address is one of the generated addresses. If you don't know any address associated with it, but you've previously received ethers/tokens, you can check the balance of each of those addresses to see if they contain ether/tokens -- or if any transactions with the address has been performed. If one of the addresses is non-empty, it's either from your mnemonic (congratulations! you've recovered your mnemonic!) or it's a freak collision with someone else's account (congratulations! you should go buy a lottery ticket!).

Related Topic