Bitcoin Forum
May 08, 2024, 11:58:23 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: LostWord - Program for retrieving lost words of Bitcoin BIP39 seed.  (Read 353 times)
PawGo (OP)
Legendary
*
Offline Offline

Activity: 952
Merit: 1367


View Profile
November 30, 2020, 09:27:05 PM
Last edit: March 02, 2021, 10:36:00 AM by PawGo
Merited by ABCbits (11), hugeblack (2), vapourminer (1), odolvlobo (1), Pmalek (1), casperBGD (1)
 #1

Hello

edited
Recently someone on this forum wrote that he has 23 words of his seed and was looking for a way to find the last, missing word, which could be on any position. As he had problems with his python for btcrecover, I wrote a very simple java program. Unfortunately for some reason it did not work for him, but as I had some time today to play with it, I publish the next release. It is nothing special, but I treat it as a way to learn something new and maybe someone will find it interesting - or even better, someone will find it useful. My idea was to make it more user-friendly than btcrecover. There is still lot of things which could be done, but let's start slowly.
Currently I use library from bitcoin core, what I was able to cover is (based of wonderful page https://iancoleman.io/bip39/) BIP32 and BIP141/P2WPKH. Maybe it is possible to have other modes implemented, I must investigate.
It is also possible to specify derivation path, if one wants to look for address which is not the first one. And 'hardened address' option works too.
Please let me know if you have any idea what also could be useful for some people, maybe you know any other interesting use cases. I think the easiest would be to check several consecutive addresses from derivation path, but is it really important?
The code and compiled jar is available on github: https://github.com/PawelGorny/lostword
edited

Now program words in modes: https://bitcointalk.org/index.php?topic=5295174.msg56473042#msg56473042
All is described in ReadMe in github.

Regards,
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715212703
Hero Member
*
Offline Offline

Posts: 1715212703

View Profile Personal Message (Offline)

Ignore
1715212703
Reply with quote  #2

1715212703
Report to moderator
1715212703
Hero Member
*
Offline Offline

Posts: 1715212703

View Profile Personal Message (Offline)

Ignore
1715212703
Reply with quote  #2

1715212703
Report to moderator
NotATether
Legendary
*
Offline Offline

Activity: 1596
Merit: 6730


bitcoincleanup.com / bitmixlist.org


View Profile WWW
December 01, 2020, 09:35:28 AM
 #2

Usually it isn't the last word of the seed that is lost, it could be any word in the list that is lost somehow and forgotten by human memory. So I suggest implementing support for guessing which word position in the phrase you want to find.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
PawGo (OP)
Legendary
*
Offline Offline

Activity: 952
Merit: 1367


View Profile
December 01, 2020, 09:37:19 AM
 #3

Usually it isn't the last word of the seed that is lost, it could be any word in the list that is lost somehow and forgotten by human memory. So I suggest implementing support for guessing which word position in the phrase you want to find.

Yes, it is how it works. Missing word could be on any position. Maybe I incorrectly used word 'last', but I wanted to say that one is unknown.
odolvlobo
Legendary
*
Offline Offline

Activity: 4298
Merit: 3214



View Profile
December 01, 2020, 08:01:44 PM
 #4

Validating the mnemonic's checksum should limit the number of possibilities to around 192.

Join an anti-signature campaign: Click ignore on the members of signature campaigns.
PGP Fingerprint: 6B6BC26599EC24EF7E29A405EAF050539D0B2925 Signing address: 13GAVJo8YaAuenj6keiEykwxWUZ7jMoSLt
PawGo (OP)
Legendary
*
Offline Offline

Activity: 952
Merit: 1367


View Profile
December 01, 2020, 08:55:14 PM
 #5

Validating the mnemonic's checksum should limit the number of possibilities to around 192.

Indeed! I have published the new release, it is much faster now. Thanks.
PawGo (OP)
Legendary
*
Offline Offline

Activity: 952
Merit: 1367


View Profile
December 02, 2020, 09:10:53 PM
 #6

I played a little and released a new version.
Now it is possible to search for more than one word if the position is specified.
More details in readme.
PawGo (OP)
Legendary
*
Offline Offline

Activity: 952
Merit: 1367


View Profile
December 03, 2020, 09:58:14 AM
 #7

I don't see many bitcoin tools created with Java (mostly uses Python or C/C#/C++). Most Java program i use usually need specific version range (such as Java 1.8/8).
It would be great if you can write required Java version and whether it support OpenJDK.

I used Java8 for compilation (1.8.271), but you may use any 1.8+. I did not test with OpenJDK, but I think it will work - on 99% Wink
Later I will try to install it one some machine and launch.
NotATether
Legendary
*
Offline Offline

Activity: 1596
Merit: 6730


bitcoincleanup.com / bitmixlist.org


View Profile WWW
December 03, 2020, 10:06:04 AM
Merited by hugeblack (2)
 #8

I don't see many bitcoin tools created with Java (mostly uses Python or C/C#/C++). Most Java program i use usually need specific version range (such as Java 1.8/8).
It would be great if you can write required Java version and whether it support OpenJDK.

I used Java8 for compilation (1.8.271), but you may use any 1.8+. I did not test with OpenJDK, but I think it will work - on 99% Wink
Later I will try to install it one some machine and launch.

Java is designed to be portable such that the same Java program that's compiled with one Java development kit should run on a JVM from a different vendor. So it shouldn't matter whether you used Oracle, Amazon, Red Hat, or some community-developed JDK, they're all based on the same OpenJDK standard.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
PawGo (OP)
Legendary
*
Offline Offline

Activity: 952
Merit: 1367


View Profile
December 03, 2020, 10:11:38 AM
 #9

Java is designed to be portable such that the same Java program that's compiled with one Java development kit should run on a JVM from a different vendor. So it shouldn't matter whether you used Oracle, Amazon, Red Hat, or some community-developed JDK, they're all based on the same OpenJDK standard.

Theory.... Wink
As long as you do not use features from newer version than yours or library compiled with the newer version of java...
And minor version sometimes matters, unfortunately... but it is off-topic.

Anyway, you may always get maven and compile project yourself.
PawGo (OP)
Legendary
*
Offline Offline

Activity: 952
Merit: 1367


View Profile
March 02, 2021, 10:35:22 AM
Merited by hugeblack (2)
 #10

Now program words in two modes:
ONE_UNKNOWN

KNOWN_POSITION


Recently I have made some changes and enhancements, so let's summarize the current state:
Available search modes:
ONE_UNKNOWN
Suitable for seeds where we know the number of words, we know order of words, but we do not know one word. Program checks seeds testing a 'lost' word on each position.

KNOWN_POSITION
Suitable for seeds where we know the number of words, we know order of words, we do not know one or more words, but we know position of lost word(s). Program checks seeds testing a 'lost' word(s) on specified position(s).

ONE_UNKNOWN_CHECK_ALL
Suitable for seeds where we know the number of words, we know order of words, but we do not know one word. Program checks seeds testing a 'lost' word on each position. This worker generates 10 addresses for the created seed and checks the balance online (using blockchain.info API). Currently it works only with P2PKH

PERMUTATION_CHECK
Worker creates all the possible (correct) seeds from the given list of words and checks them using given address and derivation path.

PERMUTATION
Worker displays and writes to file all the possible (correct) seeds from the given list of words. (This was requested in topic: https://bitcointalk.org/index.php?topic=5319624.0)

POOL
Suitable for seeds where we know the number of words, we know order of words and we know potential candidates on each position. Still '?' could be used for the whole dictionary.

Additionally I managed to support BIP84, BIP141 (P2WPKH) and BIP32, BIP44 (P2PKH). I also added possibility to search for address not only on one specified position in derivation path, but to specify the range.
 
For details please check readme on github https://github.com/PawelGorny/lostword and corresponding example files.


NotATether
Legendary
*
Offline Offline

Activity: 1596
Merit: 6730


bitcoincleanup.com / bitmixlist.org


View Profile WWW
March 03, 2021, 04:18:36 AM
 #11

ONE_UNKNOWN_CHECK_ALL
Suitable for seeds where we know the number of words, we know order of words, but we do not know one word. Program checks seeds testing a 'lost' word on each position. This worker generates 10 addresses for the created seed and checks the balance online (using blockchain.info API). Currently it works only with P2PKH

Wouldn't it be faster if you generate all the addresses in advance, and fetch the blockchain.info results for all addresses you want to query and save them in some kind of cache, instead of doing a network request each time addresses are generated? I suspect the network latency in making the request for will dominate the iteration time per key.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
PawGo (OP)
Legendary
*
Offline Offline

Activity: 952
Merit: 1367


View Profile
March 03, 2021, 07:07:08 AM
 #12

ONE_UNKNOWN_CHECK_ALL
Suitable for seeds where we know the number of words, we know order of words, but we do not know one word. Program checks seeds testing a 'lost' word on each position. This worker generates 10 addresses for the created seed and checks the balance online (using blockchain.info API). Currently it works only with P2PKH

Wouldn't it be faster if you generate all the addresses in advance, and fetch the blockchain.info results for all addresses you want to query and save them in some kind of cache, instead of doing a network request each time addresses are generated? I suspect the network latency in making the request for will dominate the iteration time per key.

I think there is limit of addresses to ask (at least using free version of blockchain.info API). Probably it could be better/faster with paid version or other provider, I did not investigate it.
PawGo (OP)
Legendary
*
Offline Offline

Activity: 952
Merit: 1367


View Profile
August 12, 2021, 09:34:19 AM
 #13

Update: I have just added support for Ethereum addresses, please check example (file example_21.conf) to see how to launch it. Maybe someone will find it useful.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!