Skip to content
This repository has been archived by the owner on May 7, 2020. It is now read-only.

A script for BIP39 Bitcoin SegWit p2wpkh-in-p2sh wallet passphrase recovery.

License

Notifications You must be signed in to change notification settings

jonathancross/segwit-wallet-recovery

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Note: This project is now obsolete.

Instead, please use the forked & revived btcrecover -- which now supports SegWit!


Pass phrase tester for BIP39 SegWit-P2SH wallets

A script which can be used for SegWit bitcoin wallet recovery.

This script assumes you know the BIP39 seed phrase for a p2wpkh-in-p2sh (aka BIP49 segwit defined by the BIP32 path: m/49'/0'/0') wallet, but have forgotten part of the password. Works with Trezor-style wallets. Each test wallet takes approximately 1 second currently, so only makes sense to use if you have no other option or if you think you can guess the password with few tries.

Requirements (tested with Python 3.7.0):

virtualenv env
source env/bin/activate
pip3 install -r requirements.txt

Configuration

Open test-pw.py to configure with your wallet info.

Replace these values with yours:

  • SEED_WORDS (eg 'final round trust era topic march brain envelope spoon minimum bunker start')
  • POSSIBLE_ADDRESSES (eg ['3QZWeXoFxk3Sxr2rZ7iFGLBqGuYny4PGPE', '34xSpck4yJ3kjMWzaynKVFmzwY7u3KjoDC'])
  • NUM_OF_ADDRESSES_TO_GENERATE (eg 5)

Then open passwords.txt and add your passwords guesses (one per line). I recommend using btcrecover to generate thousands or millions of possibilities.

You can use something like this to create many passwords with the --listpass option:

btcrecover.py --listpass --tokenlist tokens.txt --typos-delete --typos-swap --typos-repeat --typos-case --typos-capslock --typos 2 --utf8 > passwords.txt

You'll have to create your own tokens.txt with tokens / patterns which you believe match your password.

Usage

Script will generate virtual wallets with your SEED_WORDS + the password guesses, then generate as many addresses as configured in NUM_OF_ADDRESSES_TO_GENERATE and then check if any of the addresses generated matches any address in POSSIBLE_ADDRESSES. You can run this command to see an example with the defaults:

cat passwords.txt | python3 test-pw.py

You can of course do fancy shell stuff like this to prefix every password with an @ symbol:

cat passwords.txt | sed 's/\(.*\)/@\1/' | python3 test-pw.py

Multiple threads

The script itself is not multi threaded, so if you have 16 cores that you want to saturate, you need to make 16 different passwords.txt files and run 16 instances of this script.

FAQ

Does it work?

YES! This script has already been used to recover a wallet containing 1 bitcoin, so it has already paid its dues :-)

Can I use this if I don't know any of the addresses?

No, unfortunately you must know 1 or more addresses generated by the wallet, otherwise the tool would be too slow to use. If you know the first address (index zero 0 of the first account 0) this will be fastest search.

Does it support bech32 native SegWit wallets?

No, unfortunately these wallets (path: m/84'/0'/0') are not supported. It would be possible to add support by grabbing code from Electrum though. Pull Requests welcome.

Can this help me recover a wallet where I don't know the seed phrase?

No, unfortunately this software does not support that functionality. If you know part of the seed phrase (especially the last part) you might be able to brute force it as the last word is a checksum indicating you have all the other words correct.

TODO:

  • Allow passing parameters for wallet on commandline.
  • Optimize! Code (copied from Electrum tests) is very slow for this purpose.

License

See LICENSE.

This project was assembled with code taken from Electrum; those are Copyright © The Electrum Developers under the MIT License

About

A script for BIP39 Bitcoin SegWit p2wpkh-in-p2sh wallet passphrase recovery.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages