Author

Topic: Private Key lost one character (Read 6446 times)

member
Activity: 170
Merit: 58
May 23, 2020, 12:53:25 PM
#73
I have released a new version, now it is possible to check if one of characters is wrong (verify checksum).
Usage:
Code:
java -jar wiffinder.jar LOST_END L5EZftvrYaSudiozVRzTqLcHLNDoVn7H5HSfM9BAN6tMJX8oT
or
Code:
java -jar wiffinder.jar ROTATE L5EZftvrYaSudiozVRzTqLcHLNDoVn7H5HSfM0BAN6tMJX8oTWz6
member
Activity: 170
Merit: 58
May 23, 2020, 06:49:30 AM
#72
I have created a simple application to restore WIF if lost characters are at the end:
https://github.com/Mathematician09183/WifFinder
if the missing character is at the end then that character is the checksum which is recoverable in a couple of very simple steps:
- replace the missing char with anything from the charset (like 1)
- decode the result using Base58 encoding (not Base58check which is usually the method used to check and remove checksum)
- remove the last 4 bytes
- now encode this result with Base58check
you have the key!


Done in 1.3  Wink

Later I will add searching for characters on other positions (not only at the end).
newbie
Activity: 7
Merit: 1
November 01, 2022, 01:46:49 AM
#71

I do not even know the btc address for both private keys this is how long ago it is.  Also i have another address which 54 characters long i need a script which will fix it.


If it is 54, I would remove characters from the end and try to restore correct WIF.
For other WIFs - it is difficult because you do not know what you look for. It is not a problem to generate WIF - the point it to find your address.

How would you restore correct WIF with 54 characters?   how would i sort out the original privkey?

Hello @JBRai, Did you recover your wallet yet?, I would like to ask some more questions. Could you contact me back please? [Skype live:i2omio]
newbie
Activity: 26
Merit: 3
May 22, 2020, 05:56:41 PM
#70

I do not even know the btc address for both private keys this is how long ago it is.  Also i have another address which 54 characters long i need a script which will fix it.


If it is 54, I would remove characters from the end and try to restore correct WIF.
For other WIFs - it is difficult because you do not know what you look for. It is not a problem to generate WIF - the point it to find your address.

How would you restore correct WIF with 54 characters?   how would i sort out the original privkey?
member
Activity: 170
Merit: 58
May 22, 2020, 05:16:35 PM
#69

I do not even know the btc address for both private keys this is how long ago it is.  Also i have another address which 54 characters long i need a script which will fix it.


If it is 54, I would remove characters from the end and try to restore correct WIF.
For other WIFs - it is difficult because you do not know what you look for. It is not a problem to generate WIF - the point it to find your address.
newbie
Activity: 26
Merit: 3
May 22, 2020, 05:12:05 PM
#68

I was wanting to know if anyone could provide me a search command as i am missing 4 characters from my private key base 58.  From the search command how would you know if the private key is valid or not?

My private key starts with K i have 48/49 characters i just require a search command so my friend can complete this for me?

please let me know thanks

Thanks it has worked, but the address is not getting accepted into blockchain it say invalid address Private key address? please help

Do you know finally what is the exact situation?
If you are sure that you miss characters at the end and even you know the expected BTC address, it is very easy to find.


I do not even know the btc address for both private keys this is how long ago it is.  Also i have another address which 54 characters long i need a script which will fix it.
member
Activity: 170
Merit: 58
May 22, 2020, 04:40:47 AM
#67
I have created a simple application to restore WIF if lost characters are at the end:
https://github.com/Mathematician09183/WifFinder

if i understood your Java code correctly you are looping through all chars and that's a lot of unnecessary code. if the missing character is at the end then that character is the checksum which is recoverable in a couple of very simple steps:
- replace the missing char with anything from the charset (like 1)
- decode the result using Base58 encoding (not Base58check which is usually the method used to check and remove checksum)
- remove the last 4 bytes
- now encode this result with Base58check
you have the key!

this works for 1 to 4 or probably up to 6 missing characters at the end.

ps. i don't think @JBRai problem is with 1 char or even that char being at the end.

Yes, of course. In fact it was the fastest to do, just in few minutes. I rely on bitcoinj code to verify signature and load/reject key.
If character is lost in the middle, then of course it becomes much more interesting, but for 1-2 characters still doable in the reasonable time.
legendary
Activity: 3472
Merit: 10611
May 22, 2020, 04:36:38 AM
#66
I have created a simple application to restore WIF if lost characters are at the end:
https://github.com/Mathematician09183/WifFinder

if i understood your Java code correctly you are looping through all chars and that's a lot of unnecessary code. if the missing character is at the end then that character is the checksum which is recoverable in a couple of very simple steps:
- replace the missing char with anything from the charset (like 1)
- decode the result using Base58 encoding (not Base58check which is usually the method used to check and remove checksum)
- remove the last 4 bytes
- now encode this result with Base58check
you have the key!

this works for 1 to 4 or probably up to 6 missing characters at the end.

ps. i don't think @JBRai problem is with 1 char or even that char being at the end.
member
Activity: 170
Merit: 58
May 22, 2020, 03:20:24 AM
#65

I was wanting to know if anyone could provide me a search command as i am missing 4 characters from my private key base 58.  From the search command how would you know if the private key is valid or not?

My private key starts with K i have 48/49 characters i just require a search command so my friend can complete this for me?

please let me know thanks

Thanks it has worked, but the address is not getting accepted into blockchain it say invalid address Private key address? please help

Do you know finally what is the exact situation?
If you are sure that you miss characters at the end and even you know the expected BTC address, it is very easy to find.
HCP
legendary
Activity: 2086
Merit: 4361
May 21, 2020, 07:41:28 PM
#64
For this code as i have left #should be ' ' blank should i addin my corrupt key with a random letter at the end to add it up to 52 characters?
# Provide a WIF private key with a single missing character.
# Wrong Char              
corrupted_wif = 'KykLRngWxXA8RkznbcQ5UzJbD2QfABiR9E6yVGvigHo2WrwBeGm'
#  Should be:   ''
#  Missing Char                           
for candidate_wif in candidate_wifs(corrupted_wif):
    print(candidate_wif)

You only need to put your "corrupted WIF" in on the line that says: corrupted_wif = '.................'

The "#should be" line is just a comment in the code, it will not be executed so can be left blank. As long as you have the line:

Code:
corrupted_wif = ''

Filled out correctly, then it should work OK!
newbie
Activity: 26
Merit: 3
May 21, 2020, 05:09:06 AM
#63
Hi All

I was wanting to know if anyone could provide me a search command as i am missing 4 characters from my private key base 58.  From the search command how would you know if the private key is valid or not?

My private key starts with K i have 48/49 characters i just require a search command so my friend can complete this for me?

please let me know thanks

You should get the private key with crunch...

Code:
crunch 52 52 123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz -t L4rK1yDtCWekvXuE6oXD9jCYfFNV2cWRpVuPLBcCU2z8Tris@@@@ -o bf.txt

But there are two things to consider...

1.-If you have 48 chars or 49... then you add 4 or 3 @ at the end of the command.

2.-If the 4 missing characters are at the end of the string or whats the position of the missing chars because if they are random the chance to recover it is really small.

Thanks it has worked, but the address is not getting accepted into blockchain it say invalid address Private key address? please help
newbie
Activity: 26
Merit: 3
May 19, 2020, 05:20:45 PM
#62
Hi All

I was wanting to know if anyone could provide me a search command as i am missing 4 characters from my private key base 58.  From the search command how would you know if the private key is valid or not?

My private key starts with K i have 48/49 characters i just require a search command so my friend can complete this for me?

please let me know thanks

You should get the private key with crunch...

Code:
crunch 52 52 123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz -t L4rK1yDtCWekvXuE6oXD9jCYfFNV2cWRpVuPLBcCU2z8Tris@@@@ -o bf.txt

But there are two things to consider...

1.-If you have 48 chars or 49... then you add 4 or 3 @ at the end of the command.

2.-If the 4 missing characters are at the end of the string or whats the position of the missing chars because if they are random the chance to recover it is really small.

how do i use Crunch do i have copy the code in txt file and run it in terminal on mac ? i am using a mac book pro

newbie
Activity: 26
Merit: 3
May 19, 2020, 05:18:35 PM
#61
under corrupted_wif put my private with the missing character and left "should be" empty like ' '
the file is on my desktop under folder called BTC1
Ok... then your "terminal" needs to be in the 'BTC1' directory, when you run the python command, otherwise it won't be able to find the script Wink

On MacOSX, the path to your desktop folder BTC should be something like:
Code:
/Users/YOURUSERNAME/Desktop/BTC1

so if you use the command:
Code:
cd /Users/YOURUSERNAME/Desktop/BTC1

You should see the command prompt change and show you the BTC1 folder... then if you try to run the script again with:
Code:
python corrupt_wif.py

For this code as i have left #should be ' ' blank should i addin my corrupt key with a random letter at the end to add it up to 52 characters?
# Provide a WIF private key with a single missing character.
# Wrong Char             
corrupted_wif = 'KykLRngWxXA8RkznbcQ5UzJbD2QfABiR9E6yVGvigHo2WrwBeGm'
#  Should be:   ''
#  Missing Char                           
for candidate_wif in candidate_wifs(corrupted_wif):
    print(candidate_wif)

It should work.
legendary
Activity: 3346
Merit: 3125
May 13, 2020, 10:48:30 AM
#60
Hi All

I was wanting to know if anyone could provide me a search command as i am missing 4 characters from my private key base 58.  From the search command how would you know if the private key is valid or not?

My private key starts with K i have 48/49 characters i just require a search command so my friend can complete this for me?

please let me know thanks

You should get the private key with crunch...

Code:
crunch 52 52 123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz -t L4rK1yDtCWekvXuE6oXD9jCYfFNV2cWRpVuPLBcCU2z8Tris@@@@ -o bf.txt

But there are two things to consider...

1.-If you have 48 chars or 49... then you add 4 or 3 @ at the end of the command.

2.-If the 4 missing characters are at the end of the string or whats the position of the missing chars because if they are random the chance to recover it is really small.
HCP
legendary
Activity: 2086
Merit: 4361
May 04, 2020, 03:47:25 PM
#59
under corrupted_wif put my private with the missing character and left "should be" empty like ' '
the file is on my desktop under folder called BTC1
Ok... then your "terminal" needs to be in the 'BTC1' directory, when you run the python command, otherwise it won't be able to find the script Wink

On MacOSX, the path to your desktop folder BTC should be something like:
Code:
/Users/YOURUSERNAME/Desktop/BTC1

so if you use the command:
Code:
cd /Users/YOURUSERNAME/Desktop/BTC1

You should see the command prompt change and show you the BTC1 folder... then if you try to run the script again with:
Code:
python corrupt_wif.py

It should work.
newbie
Activity: 26
Merit: 3
May 04, 2020, 04:51:27 AM
#58
under corrupted_wif put my private with the missing character and left "should be" empty like ' '
the file is on my desktop under folder called BTC1
This is what i had copied

import bitcoin.base58
from bitcoin.core import b2x, x
from bitcoin.wallet import CBitcoinSecret, P2PKHBitcoinAddress
from bitcoin.core import Hash

def insert_char(string, char, i):
    return string[:i+1]+char+string[i+1:]

def verify_wif_checksum(wif):
    byte_string = b2x(bitcoin.base58.decode(wif))
    private = byte_string[:-8]
    checksum = byte_string[-8:]
    return checksum == b2x(Hash(x(private)))[:8]

def candidate_wifs(corrupted_wif):
    candidates = []
    for i in range(len(corrupted_wif)):
        for char in bitcoin.base58.B58_DIGITS:
            candidate_wif = insert_char(corrupted_wif, char, i)
            if verify_wif_checksum(candidate_wif):   
                candidates.append(candidate_wif)
    return candidates


# Provide a WIF private key with a single missing character.
corrupted_wif = '5HueCGU8rMjxEXxiPuD5BDku4kFqeZyd4dZ1jvhTVqvbTLvyTJ'
#   Should be:  ''

for candidate_wif in candidate_wifs(corrupted_wif):
    print(candidate_wif)


failed please help - can't open file 'corrupt_wif.py': [Errno 2] No such file or directory cannot open file
Did you actually copy/paste the code from the earlier post into a file and did you name that file corrupt_wif.py? Huh

If so, where is that file?
HCP
legendary
Activity: 2086
Merit: 4361
May 04, 2020, 12:03:52 AM
#57
failed please help - can't open file 'corrupt_wif.py': [Errno 2] No such file or directory cannot open file
Did you actually copy/paste the code from the earlier post into a file and did you name that file corrupt_wif.py? Huh

If so, where is that file?
newbie
Activity: 26
Merit: 3
May 03, 2020, 06:38:12 PM
#56
newbie
Activity: 26
Merit: 3
May 03, 2020, 06:00:06 PM
#55
Ok, well if you have any more troubles, you'll either need to take a screenshot of the error... or copy/paste everything that is being shown in the terminal window when you try to run the commands.

"Invalid Error" and/or "[Errno 2]" don't really tell us anything, so it isn't possible to troubleshoot that properly. Undecided

I installed "pip install bitcoinlib & pip install base58
ran using python corrupt_wif.py
failed please help - can't open file 'corrupt_wif.py': [Errno 2] No such file or directory cannot open file

Last login: Fri May  1 12:35:46 on console

The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
Jaymins-MacBook-Pro:~ jayminr$ cd desktop
Jaymins-MacBook-Pro:desktop jayminr$ cd btc1
Jaymins-MacBook-Pro:btc1 jayminr$ pip install bitcoinlib
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting bitcoinlib
  Using cached https://files.pythonhosted.org/packages/d5/5d/82ee2839784b79a8bbb9448298885ac36d2c865eae135ebd78ae70ca228f/bitcoinlib-0.4.14.tar.gz
Collecting requests>=2.20.0 (from bitcoinlib)
  Using cached https://files.pythonhosted.org/packages/1a/70/1935c770cb3be6e3a8b78ced23d7e0f3b187f5cbfab4749523ed65d7c9b1/requests-2.23.0-py2.py3-none-any.whl
Collecting pyaes==1.6.1 (from bitcoinlib)
  Using cached https://files.pythonhosted.org/packages/44/66/2c17bae31c906613795711fc78045c285048168919ace2220daa372c7d72/pyaes-1.6.1.tar.gz
Collecting scrypt>=0.8.13 (from bitcoinlib)
  Using cached https://files.pythonhosted.org/packages/80/3d/141eb80e754b86f6c25a2ffaf6c3af3acdb65a3e3700829a05ab0c5d965d/scrypt-0.8.13.tar.gz
Collecting SQLAlchemy>=1.3.2 (from bitcoinlib)
  Downloading https://files.pythonhosted.org/packages/75/6a/25db5c553cc45718752886fa849d6f8f828374c3c480ec0b18fdb0a31df6/SQLAlchemy-1.3.16-cp27-cp27m-macosx_10_13_x86_64.whl (1.2MB)
     |████████████████████████████████| 1.2MB 1.7MB/s
Collecting six>=1.10 (from bitcoinlib)
  Downloading https://files.pythonhosted.org/packages/65/eb/1f97cb97bfc2390a276969c6fae16075da282f5058082d4cb10c6c5c1dba/six-1.14.0-py2.py3-none-any.whl
Collecting enum34 (from bitcoinlib)
  Downloading https://files.pythonhosted.org/packages/6f/2c/a9386903ece2ea85e9807e0e062174dc26fdce8b05f216d00491be29fad5/enum34-1.1.10-py2-none-any.whl
Collecting pathlib2 (from bitcoinlib)
  Downloading https://files.pythonhosted.org/packages/e9/45/9c82d3666af4ef9f221cbb954e1d77ddbb513faf552aea6df5f37f1a4859/pathlib2-2.3.5-py2.py3-none-any.whl
Collecting fastecdsa==1.7.5 (from bitcoinlib)
  Downloading https://files.pythonhosted.org/packages/ad/28/8ccec53ea74fb05fe6bca055e67b4a860a664fe2e490fc291e7eff721278/fastecdsa-1.7.5-cp27-cp27m-macosx_10_13_x86_64.whl (46kB)
     |████████████████████████████████| 51kB 11.7MB/s
Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 (from requests>=2.20.0->bitcoinlib)
  Using cached https://files.pythonhosted.org/packages/e1/e5/df302e8017440f111c11cc41a6b432838672f5a70aa29227bf58149dc72f/urllib3-1.25.9-py2.py3-none-any.whl
Collecting idna<3,>=2.5 (from requests>=2.20.0->bitcoinlib)
  Using cached https://files.pythonhosted.org/packages/89/e3/afebe61c546d18fb1709a61bee788254b40e736cff7271c7de5de2dc4128/idna-2.9-py2.py3-none-any.whl
Collecting chardet<4,>=3.0.2 (from requests>=2.20.0->bitcoinlib)
  Using cached https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl
Collecting certifi>=2017.4.17 (from requests>=2.20.0->bitcoinlib)
  Using cached https://files.pythonhosted.org/packages/57/2b/26e37a4b034800c960a00c4e1b3d9ca5d7014e983e6e729e33ea2f36426c/certifi-2020.4.5.1-py2.py3-none-any.whl
Collecting scandir; python_version < "3.5" (from pathlib2->bitcoinlib)
  Downloading https://files.pythonhosted.org/packages/df/f5/9c052db7bd54d0cbf1bc0bb6554362bba1012d03e5888950a4f5c5dadc4e/scandir-1.10.0.tar.gz
Installing collected packages: urllib3, idna, chardet, certifi, requests, pyaes, scrypt, SQLAlchemy, six, enum34, scandir, pathlib2, fastecdsa, bitcoinlib
  Running setup.py install for pyaes ... done
  Running setup.py install for scrypt ... error
    ERROR: Command errored out with exit status 1:
     command: /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/qm/ty1630ms3zgcn56sg60f8qc80000gn/T/pip-install-l5jxx8/scrypt/setup.py'"'"'; __file__='"'"'/private/var/folders/qm/ty1630ms3zgcn56sg60f8qc80000gn/T/pip-install-l5jxx8/scrypt/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/qm/ty1630ms3zgcn56sg60f8qc80000gn/T/pip-record-b6Ycnk/install-record.txt --single-version-externally-managed --compile
         cwd: /private/var/folders/qm/ty1630ms3zgcn56sg60f8qc80000gn/T/pip-install-l5jxx8/scrypt/
    Complete output (36 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.9-x86_64-2.7
    creating build/lib.macosx-10.9-x86_64-2.7/scrypt
    copying scrypt/__init__.py -> build/lib.macosx-10.9-x86_64-2.7/scrypt
    copying scrypt/scrypt.py -> build/lib.macosx-10.9-x86_64-2.7/scrypt
    running build_ext
    building '_scrypt' extension
    creating build/temp.macosx-10.9-x86_64-2.7
    creating build/temp.macosx-10.9-x86_64-2.7/src
    creating build/temp.macosx-10.9-x86_64-2.7/scrypt-1.2.1
    creating build/temp.macosx-10.9-x86_64-2.7/scrypt-1.2.1/lib
    creating build/temp.macosx-10.9-x86_64-2.7/scrypt-1.2.1/lib/crypto
    creating build/temp.macosx-10.9-x86_64-2.7/scrypt-1.2.1/lib/scryptenc
    creating build/temp.macosx-10.9-x86_64-2.7/scrypt-1.2.1/lib/util
    creating build/temp.macosx-10.9-x86_64-2.7/scrypt-1.2.1/libcperciva
    creating build/temp.macosx-10.9-x86_64-2.7/scrypt-1.2.1/libcperciva/alg
    creating build/temp.macosx-10.9-x86_64-2.7/scrypt-1.2.1/libcperciva/crypto
    creating build/temp.macosx-10.9-x86_64-2.7/scrypt-1.2.1/libcperciva/util
    gcc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -g -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DHAVE_CONFIG_H -DHAVE_SYSCTL_HW_USERMEM=1 -Iscrypt-1.2.1 -Iscrypt-1.2.1/lib -Iscrypt-1.2.1/lib/scryptenc -Iscrypt-1.2.1/lib/crypto -Iscrypt-1.2.1/lib/util -Iscrypt-1.2.1/libcperciva/cpusupport -Iscrypt-1.2.1/libcperciva/alg -Iscrypt-1.2.1/libcperciva/util -Iscrypt-1.2.1/libcperciva/crypto -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/scrypt.c -o build/temp.macosx-10.9-x86_64-2.7/src/scrypt.o
    gcc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -g -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DHAVE_CONFIG_H -DHAVE_SYSCTL_HW_USERMEM=1 -Iscrypt-1.2.1 -Iscrypt-1.2.1/lib -Iscrypt-1.2.1/lib/scryptenc -Iscrypt-1.2.1/lib/crypto -Iscrypt-1.2.1/lib/util -Iscrypt-1.2.1/libcperciva/cpusupport -Iscrypt-1.2.1/libcperciva/alg -Iscrypt-1.2.1/libcperciva/util -Iscrypt-1.2.1/libcperciva/crypto -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c scrypt-1.2.1/lib/crypto/crypto_scrypt_smix_sse2.c -o build/temp.macosx-10.9-x86_64-2.7/scrypt-1.2.1/lib/crypto/crypto_scrypt_smix_sse2.o
    gcc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -g -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DHAVE_CONFIG_H -DHAVE_SYSCTL_HW_USERMEM=1 -Iscrypt-1.2.1 -Iscrypt-1.2.1/lib -Iscrypt-1.2.1/lib/scryptenc -Iscrypt-1.2.1/lib/crypto -Iscrypt-1.2.1/lib/util -Iscrypt-1.2.1/libcperciva/cpusupport -Iscrypt-1.2.1/libcperciva/alg -Iscrypt-1.2.1/libcperciva/util -Iscrypt-1.2.1/libcperciva/crypto -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c scrypt-1.2.1/lib/crypto/crypto_scrypt_smix.c -o build/temp.macosx-10.9-x86_64-2.7/scrypt-1.2.1/lib/crypto/crypto_scrypt_smix.o
    gcc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -g -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DHAVE_CONFIG_H -DHAVE_SYSCTL_HW_USERMEM=1 -Iscrypt-1.2.1 -Iscrypt-1.2.1/lib -Iscrypt-1.2.1/lib/scryptenc -Iscrypt-1.2.1/lib/crypto -Iscrypt-1.2.1/lib/util -Iscrypt-1.2.1/libcperciva/cpusupport -Iscrypt-1.2.1/libcperciva/alg -Iscrypt-1.2.1/libcperciva/util -Iscrypt-1.2.1/libcperciva/crypto -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c scrypt-1.2.1/lib/crypto/crypto_scrypt.c -o build/temp.macosx-10.9-x86_64-2.7/scrypt-1.2.1/lib/crypto/crypto_scrypt.o
    gcc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -g -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DHAVE_CONFIG_H -DHAVE_SYSCTL_HW_USERMEM=1 -Iscrypt-1.2.1 -Iscrypt-1.2.1/lib -Iscrypt-1.2.1/lib/scryptenc -Iscrypt-1.2.1/lib/crypto -Iscrypt-1.2.1/lib/util -Iscrypt-1.2.1/libcperciva/cpusupport -Iscrypt-1.2.1/libcperciva/alg -Iscrypt-1.2.1/libcperciva/util -Iscrypt-1.2.1/libcperciva/crypto -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c scrypt-1.2.1/lib/scryptenc/scryptenc.c -o build/temp.macosx-10.9-x86_64-2.7/scrypt-1.2.1/lib/scryptenc/scryptenc.o
    gcc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -g -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DHAVE_CONFIG_H -DHAVE_SYSCTL_HW_USERMEM=1 -Iscrypt-1.2.1 -Iscrypt-1.2.1/lib -Iscrypt-1.2.1/lib/scryptenc -Iscrypt-1.2.1/lib/crypto -Iscrypt-1.2.1/lib/util -Iscrypt-1.2.1/libcperciva/cpusupport -Iscrypt-1.2.1/libcperciva/alg -Iscrypt-1.2.1/libcperciva/util -Iscrypt-1.2.1/libcperciva/crypto -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c scrypt-1.2.1/lib/scryptenc/scryptenc_cpuperf.c -o build/temp.macosx-10.9-x86_64-2.7/scrypt-1.2.1/lib/scryptenc/scryptenc_cpuperf.o
    gcc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -g -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DHAVE_CONFIG_H -DHAVE_SYSCTL_HW_USERMEM=1 -Iscrypt-1.2.1 -Iscrypt-1.2.1/lib -Iscrypt-1.2.1/lib/scryptenc -Iscrypt-1.2.1/lib/crypto -Iscrypt-1.2.1/lib/util -Iscrypt-1.2.1/libcperciva/cpusupport -Iscrypt-1.2.1/libcperciva/alg -Iscrypt-1.2.1/libcperciva/util -Iscrypt-1.2.1/libcperciva/crypto -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c scrypt-1.2.1/lib/util/memlimit.c -o build/temp.macosx-10.9-x86_64-2.7/scrypt-1.2.1/lib/util/memlimit.o
    gcc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -g -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DHAVE_CONFIG_H -DHAVE_SYSCTL_HW_USERMEM=1 -Iscrypt-1.2.1 -Iscrypt-1.2.1/lib -Iscrypt-1.2.1/lib/scryptenc -Iscrypt-1.2.1/lib/crypto -Iscrypt-1.2.1/lib/util -Iscrypt-1.2.1/libcperciva/cpusupport -Iscrypt-1.2.1/libcperciva/alg -Iscrypt-1.2.1/libcperciva/util -Iscrypt-1.2.1/libcperciva/crypto -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c scrypt-1.2.1/libcperciva/alg/sha256.c -o build/temp.macosx-10.9-x86_64-2.7/scrypt-1.2.1/libcperciva/alg/sha256.o
    gcc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -g -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DHAVE_CONFIG_H -DHAVE_SYSCTL_HW_USERMEM=1 -Iscrypt-1.2.1 -Iscrypt-1.2.1/lib -Iscrypt-1.2.1/lib/scryptenc -Iscrypt-1.2.1/lib/crypto -Iscrypt-1.2.1/lib/util -Iscrypt-1.2.1/libcperciva/cpusupport -Iscrypt-1.2.1/libcperciva/alg -Iscrypt-1.2.1/libcperciva/util -Iscrypt-1.2.1/libcperciva/crypto -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c scrypt-1.2.1/libcperciva/crypto/crypto_aes_aesni.c -o build/temp.macosx-10.9-x86_64-2.7/scrypt-1.2.1/libcperciva/crypto/crypto_aes_aesni.o
    gcc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -g -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DHAVE_CONFIG_H -DHAVE_SYSCTL_HW_USERMEM=1 -Iscrypt-1.2.1 -Iscrypt-1.2.1/lib -Iscrypt-1.2.1/lib/scryptenc -Iscrypt-1.2.1/lib/crypto -Iscrypt-1.2.1/lib/util -Iscrypt-1.2.1/libcperciva/cpusupport -Iscrypt-1.2.1/libcperciva/alg -Iscrypt-1.2.1/libcperciva/util -Iscrypt-1.2.1/libcperciva/crypto -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c scrypt-1.2.1/libcperciva/crypto/crypto_aes.c -o build/temp.macosx-10.9-x86_64-2.7/scrypt-1.2.1/libcperciva/crypto/crypto_aes.o
    scrypt-1.2.1/libcperciva/crypto/crypto_aes.c:6:10: fatal error: 'openssl/aes.h' file not found
    #include
             ^~~~~~~~~~~~~~~
    1 error generated.
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/qm/ty1630ms3zgcn56sg60f8qc80000gn/T/pip-install-l5jxx8/scrypt/setup.py'"'"'; __file__='"'"'/private/var/folders/qm/ty1630ms3zgcn56sg60f8qc80000gn/T/pip-install-l5jxx8/scrypt/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/qm/ty1630ms3zgcn56sg60f8qc80000gn/T/pip-record-b6Ycnk/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.
WARNING: You are using pip version 19.2.3, however version 20.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Jaymins-MacBook-Pro:btc1 jayminr$ pip install --upgrade pip
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting pip
  Downloading https://files.pythonhosted.org/packages/54/2e/df11ea7e23e7e761d484ed3740285a34e38548cf2bad2bed3dd5768ec8b9/pip-20.1-py2.py3-none-any.whl (1.5MB)
     |████████████████████████████████| 1.5MB 1.7MB/s
Installing collected packages: pip
  Found existing installation: pip 19.2.3
    Uninstalling pip-19.2.3:
      Successfully uninstalled pip-19.2.3
Successfully installed pip-20.1
Jaymins-MacBook-Pro:btc1 jayminr$ pip install bitcoinlib
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting bitcoinlib
  Using cached bitcoinlib-0.4.14.tar.gz (418 kB)
Requirement already satisfied: requests>=2.20.0 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from bitcoinlib) (2.23.0)
Requirement already satisfied: pyaes==1.6.1 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from bitcoinlib) (1.6.1)
Collecting scrypt>=0.8.13
  Using cached scrypt-0.8.13.tar.gz (53 kB)
Collecting SQLAlchemy>=1.3.2
  Using cached SQLAlchemy-1.3.16-cp27-cp27m-macosx_10_13_x86_64.whl (1.2 MB)
Collecting six>=1.10
  Using cached six-1.14.0-py2.py3-none-any.whl (10 kB)
Collecting enum34
  Using cached enum34-1.1.10-py2-none-any.whl (11 kB)
Collecting pathlib2
  Using cached pathlib2-2.3.5-py2.py3-none-any.whl (18 kB)
Collecting fastecdsa==1.7.5
  Using cached fastecdsa-1.7.5-cp27-cp27m-macosx_10_13_x86_64.whl (46 kB)
Requirement already satisfied: idna<3,>=2.5 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from requests>=2.20.0->bitcoinlib) (2.9)
Requirement already satisfied: chardet<4,>=3.0.2 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from requests>=2.20.0->bitcoinlib) (3.0.4)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from requests>=2.20.0->bitcoinlib) (1.25.9)
Requirement already satisfied: certifi>=2017.4.17 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from requests>=2.20.0->bitcoinlib) (2020.4.5.1)
Collecting scandir; python_version < "3.5"
  Using cached scandir-1.10.0.tar.gz (33 kB)
Could not build wheels for bitcoinlib, since package 'wheel' is not installed.
Could not build wheels for requests, since package 'wheel' is not installed.
Could not build wheels for pyaes, since package 'wheel' is not installed.
Could not build wheels for scrypt, since package 'wheel' is not installed.
Could not build wheels for idna, since package 'wheel' is not installed.
Could not build wheels for chardet, since package 'wheel' is not installed.
Could not build wheels for urllib3, since package 'wheel' is not installed.
Could not build wheels for certifi, since package 'wheel' is not installed.
Could not build wheels for scandir, since package 'wheel' is not installed.
Installing collected packages: scrypt, SQLAlchemy, six, enum34, scandir, pathlib2, fastecdsa, bitcoinlib
    Running setup.py install for scrypt ... error
    ERROR: Command errored out with exit status 1:
     command: /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/qm/ty1630ms3zgcn56sg60f8qc80000gn/T/pip-install-9SjoG3/scrypt/setup.py'"'"'; __file__='"'"'/private/var/folders/qm/ty1630ms3zgcn56sg60f8qc80000gn/T/pip-install-9SjoG3/scrypt/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/qm/ty1630ms3zgcn56sg60f8qc80000gn/T/pip-record-7mrMdQ/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/scrypt
         cwd: /private/var/folders/qm/ty1630ms3zgcn56sg60f8qc80000gn/T/pip-install-9SjoG3/scrypt/
    Complete output (36 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.9-x86_64-2.7
    creating build/lib.macosx-10.9-x86_64-2.7/scrypt
    copying scrypt/__init__.py -> build/lib.macosx-10.9-x86_64-2.7/scrypt
    copying scrypt/scrypt.py -> build/lib.macosx-10.9-x86_64-2.7/scrypt
    running build_ext
    building '_scrypt' extension
    creating build/temp.macosx-10.9-x86_64-2.7
    creating build/temp.macosx-10.9-x86_64-2.7/src
    creating build/temp.macosx-10.9-x86_64-2.7/scrypt-1.2.1
    creating build/temp.macosx-10.9-x86_64-2.7/scrypt-1.2.1/lib
    creating build/temp.macosx-10.9-x86_64-2.7/scrypt-1.2.1/lib/crypto
    creating build/temp.macosx-10.9-x86_64-2.7/scrypt-1.2.1/lib/scryptenc
    creating build/temp.macosx-10.9-x86_64-2.7/scrypt-1.2.1/lib/util
    creating build/temp.macosx-10.9-x86_64-2.7/scrypt-1.2.1/libcperciva
    creating build/temp.macosx-10.9-x86_64-2.7/scrypt-1.2.1/libcperciva/alg
    creating build/temp.macosx-10.9-x86_64-2.7/scrypt-1.2.1/libcperciva/crypto
    creating build/temp.macosx-10.9-x86_64-2.7/scrypt-1.2.1/libcperciva/util
    gcc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -g -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DHAVE_CONFIG_H -DHAVE_SYSCTL_HW_USERMEM=1 -Iscrypt-1.2.1 -Iscrypt-1.2.1/lib -Iscrypt-1.2.1/lib/scryptenc -Iscrypt-1.2.1/lib/crypto -Iscrypt-1.2.1/lib/util -Iscrypt-1.2.1/libcperciva/cpusupport -Iscrypt-1.2.1/libcperciva/alg -Iscrypt-1.2.1/libcperciva/util -Iscrypt-1.2.1/libcperciva/crypto -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/scrypt.c -o build/temp.macosx-10.9-x86_64-2.7/src/scrypt.o
    gcc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -g -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DHAVE_CONFIG_H -DHAVE_SYSCTL_HW_USERMEM=1 -Iscrypt-1.2.1 -Iscrypt-1.2.1/lib -Iscrypt-1.2.1/lib/scryptenc -Iscrypt-1.2.1/lib/crypto -Iscrypt-1.2.1/lib/util -Iscrypt-1.2.1/libcperciva/cpusupport -Iscrypt-1.2.1/libcperciva/alg -Iscrypt-1.2.1/libcperciva/util -Iscrypt-1.2.1/libcperciva/crypto -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c scrypt-1.2.1/lib/crypto/crypto_scrypt_smix_sse2.c -o build/temp.macosx-10.9-x86_64-2.7/scrypt-1.2.1/lib/crypto/crypto_scrypt_smix_sse2.o
    gcc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -g -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DHAVE_CONFIG_H -DHAVE_SYSCTL_HW_USERMEM=1 -Iscrypt-1.2.1 -Iscrypt-1.2.1/lib -Iscrypt-1.2.1/lib/scryptenc -Iscrypt-1.2.1/lib/crypto -Iscrypt-1.2.1/lib/util -Iscrypt-1.2.1/libcperciva/cpusupport -Iscrypt-1.2.1/libcperciva/alg -Iscrypt-1.2.1/libcperciva/util -Iscrypt-1.2.1/libcperciva/crypto -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c scrypt-1.2.1/lib/crypto/crypto_scrypt_smix.c -o build/temp.macosx-10.9-x86_64-2.7/scrypt-1.2.1/lib/crypto/crypto_scrypt_smix.o
    gcc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -g -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DHAVE_CONFIG_H -DHAVE_SYSCTL_HW_USERMEM=1 -Iscrypt-1.2.1 -Iscrypt-1.2.1/lib -Iscrypt-1.2.1/lib/scryptenc -Iscrypt-1.2.1/lib/crypto -Iscrypt-1.2.1/lib/util -Iscrypt-1.2.1/libcperciva/cpusupport -Iscrypt-1.2.1/libcperciva/alg -Iscrypt-1.2.1/libcperciva/util -Iscrypt-1.2.1/libcperciva/crypto -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c scrypt-1.2.1/lib/crypto/crypto_scrypt.c -o build/temp.macosx-10.9-x86_64-2.7/scrypt-1.2.1/lib/crypto/crypto_scrypt.o
    gcc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -g -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DHAVE_CONFIG_H -DHAVE_SYSCTL_HW_USERMEM=1 -Iscrypt-1.2.1 -Iscrypt-1.2.1/lib -Iscrypt-1.2.1/lib/scryptenc -Iscrypt-1.2.1/lib/crypto -Iscrypt-1.2.1/lib/util -Iscrypt-1.2.1/libcperciva/cpusupport -Iscrypt-1.2.1/libcperciva/alg -Iscrypt-1.2.1/libcperciva/util -Iscrypt-1.2.1/libcperciva/crypto -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c scrypt-1.2.1/lib/scryptenc/scryptenc.c -o build/temp.macosx-10.9-x86_64-2.7/scrypt-1.2.1/lib/scryptenc/scryptenc.o
    gcc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -g -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DHAVE_CONFIG_H -DHAVE_SYSCTL_HW_USERMEM=1 -Iscrypt-1.2.1 -Iscrypt-1.2.1/lib -Iscrypt-1.2.1/lib/scryptenc -Iscrypt-1.2.1/lib/crypto -Iscrypt-1.2.1/lib/util -Iscrypt-1.2.1/libcperciva/cpusupport -Iscrypt-1.2.1/libcperciva/alg -Iscrypt-1.2.1/libcperciva/util -Iscrypt-1.2.1/libcperciva/crypto -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c scrypt-1.2.1/lib/scryptenc/scryptenc_cpuperf.c -o build/temp.macosx-10.9-x86_64-2.7/scrypt-1.2.1/lib/scryptenc/scryptenc_cpuperf.o
    gcc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -g -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DHAVE_CONFIG_H -DHAVE_SYSCTL_HW_USERMEM=1 -Iscrypt-1.2.1 -Iscrypt-1.2.1/lib -Iscrypt-1.2.1/lib/scryptenc -Iscrypt-1.2.1/lib/crypto -Iscrypt-1.2.1/lib/util -Iscrypt-1.2.1/libcperciva/cpusupport -Iscrypt-1.2.1/libcperciva/alg -Iscrypt-1.2.1/libcperciva/util -Iscrypt-1.2.1/libcperciva/crypto -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c scrypt-1.2.1/lib/util/memlimit.c -o build/temp.macosx-10.9-x86_64-2.7/scrypt-1.2.1/lib/util/memlimit.o
    gcc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -g -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DHAVE_CONFIG_H -DHAVE_SYSCTL_HW_USERMEM=1 -Iscrypt-1.2.1 -Iscrypt-1.2.1/lib -Iscrypt-1.2.1/lib/scryptenc -Iscrypt-1.2.1/lib/crypto -Iscrypt-1.2.1/lib/util -Iscrypt-1.2.1/libcperciva/cpusupport -Iscrypt-1.2.1/libcperciva/alg -Iscrypt-1.2.1/libcperciva/util -Iscrypt-1.2.1/libcperciva/crypto -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c scrypt-1.2.1/libcperciva/alg/sha256.c -o build/temp.macosx-10.9-x86_64-2.7/scrypt-1.2.1/libcperciva/alg/sha256.o
    gcc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -g -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DHAVE_CONFIG_H -DHAVE_SYSCTL_HW_USERMEM=1 -Iscrypt-1.2.1 -Iscrypt-1.2.1/lib -Iscrypt-1.2.1/lib/scryptenc -Iscrypt-1.2.1/lib/crypto -Iscrypt-1.2.1/lib/util -Iscrypt-1.2.1/libcperciva/cpusupport -Iscrypt-1.2.1/libcperciva/alg -Iscrypt-1.2.1/libcperciva/util -Iscrypt-1.2.1/libcperciva/crypto -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c scrypt-1.2.1/libcperciva/crypto/crypto_aes_aesni.c -o build/temp.macosx-10.9-x86_64-2.7/scrypt-1.2.1/libcperciva/crypto/crypto_aes_aesni.o
    gcc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -g -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DHAVE_CONFIG_H -DHAVE_SYSCTL_HW_USERMEM=1 -Iscrypt-1.2.1 -Iscrypt-1.2.1/lib -Iscrypt-1.2.1/lib/scryptenc -Iscrypt-1.2.1/lib/crypto -Iscrypt-1.2.1/lib/util -Iscrypt-1.2.1/libcperciva/cpusupport -Iscrypt-1.2.1/libcperciva/alg -Iscrypt-1.2.1/libcperciva/util -Iscrypt-1.2.1/libcperciva/crypto -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c scrypt-1.2.1/libcperciva/crypto/crypto_aes.c -o build/temp.macosx-10.9-x86_64-2.7/scrypt-1.2.1/libcperciva/crypto/crypto_aes.o
    scrypt-1.2.1/libcperciva/crypto/crypto_aes.c:6:10: fatal error: 'openssl/aes.h' file not found
    #include
             ^~~~~~~~~~~~~~~
    1 error generated.
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/qm/ty1630ms3zgcn56sg60f8qc80000gn/T/pip-install-9SjoG3/scrypt/setup.py'"'"'; __file__='"'"'/private/var/folders/qm/ty1630ms3zgcn56sg60f8qc80000gn/T/pip-install-9SjoG3/scrypt/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/qm/ty1630ms3zgcn56sg60f8qc80000gn/T/pip-record-7mrMdQ/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/scrypt Check the logs for full command output.
Jaymins-MacBook-Pro:btc1 jayminr$ pip install openssl
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
ERROR: Could not find a version that satisfies the requirement openssl (from versions: none)
ERROR: No matching distribution found for openssl
Jaymins-MacBook-Pro:btc1 jayminr$ pip install base58
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting base58
  Downloading base58-1.0.3-py2-none-any.whl (3.1 kB)
Installing collected packages: base58
Successfully installed base58-1.0.3
Jaymins-MacBook-Pro:btc1 jayminr$ python corrupt_wif.py
/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'corrupt_wif.py': [Errno 2] No such file or directory
Jaymins-MacBook-Pro:btc1 jayminr$ pip currupt_wif.py
ERROR: unknown command "currupt_wif.py"
Jaymins-MacBook-Pro:btc1 jayminr$ python corrupt_wif.py
/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'corrupt_wif.py': [Errno 2] No such file or directory
Jaymins-MacBook-Pro:btc1 jayminr$
HCP
legendary
Activity: 2086
Merit: 4361
April 26, 2020, 06:07:39 PM
#54
Ok, well if you have any more troubles, you'll either need to take a screenshot of the error... or copy/paste everything that is being shown in the terminal window when you try to run the commands.

"Invalid Error" and/or "[Errno 2]" don't really tell us anything, so it isn't possible to troubleshoot that properly. Undecided
newbie
Activity: 26
Merit: 3
April 26, 2020, 03:53:03 PM
#53
I was trying to use pip3 and python 3 and script was not working invalid error.   I have updated python and python3 reinstalled the updated version and going to try again.

MY Mac throws back an error when using just python and python3 : [Errno 2]
At which point? When you're running pip... or when you're running python? Huh

Are you able to take a screenshot of the command you're entering and the output and then upload it to an image hosting service (like imgur.com or lightshot)?
HCP
legendary
Activity: 2086
Merit: 4361
April 24, 2020, 05:49:35 PM
#52
MY Mac throws back an error when using just python and python3 : [Errno 2]
At which point? When you're running pip... or when you're running python? Huh

Are you able to take a screenshot of the command you're entering and the output and then upload it to an image hosting service (like imgur.com or lightshot)?
newbie
Activity: 26
Merit: 3
April 24, 2020, 07:47:36 AM
#51
MY Mac throws back an error when using just python and python3 : [Errno 2]

Hi I saw your Post as i am trying to retrieve my misssing character how would i run this code on a mac book pro?
It's a Python script... a MacBook Pro should have python install by default. You just need to copy/paste the 'script' from that post into a text file, edit the 'corrupted_wif' value to be the WIF of yours that is missing one character and then save the file as "corrupt_wif.py" or some other name... as long as it ends in .py

You will also need to make sure you have the python bitcoinlib library installed. So open a 'terminal' and type:
Code:
pip install bitcoinlib

Once that is installed, you then change the current directory in the terminal to where you created the .py file... and use:
Code:
python corrupt_wif.py

That should run the script for you.

This very short video shows how to create the script using the text editor and run it: https://www.youtube.com/watch?v=Txt-cLLa_vo
newbie
Activity: 26
Merit: 3
April 14, 2020, 04:31:50 AM
#50
Thanks

Hi I saw your Post as i am trying to retrieve my misssing character how would i run this code on a mac book pro?
It's a Python script... a MacBook Pro should have python install by default. You just need to copy/paste the 'script' from that post into a text file, edit the 'corrupted_wif' value to be the WIF of yours that is missing one character and then save the file as "corrupt_wif.py" or some other name... as long as it ends in .py

You will also need to make sure you have the python bitcoinlib library installed. So open a 'terminal' and type:
Code:
pip install bitcoinlib

Once that is installed, you then change the current directory in the terminal to where you created the .py file... and use:
Code:
python corrupt_wif.py

That should run the script for you.

This very short video shows how to create the script using the text editor and run it: https://www.youtube.com/watch?v=Txt-cLLa_vo
HCP
legendary
Activity: 2086
Merit: 4361
April 12, 2020, 09:55:54 PM
#49
Hi I saw your Post as i am trying to retrieve my misssing character how would i run this code on a mac book pro?
It's a Python script... a MacBook Pro should have python install by default. You just need to copy/paste the 'script' from that post into a text file, edit the 'corrupted_wif' value to be the WIF of yours that is missing one character and then save the file as "corrupt_wif.py" or some other name... as long as it ends in .py

You will also need to make sure you have the python bitcoinlib library installed. So open a 'terminal' and type:
Code:
pip install bitcoinlib

Once that is installed, you then change the current directory in the terminal to where you created the .py file... and use:
Code:
python corrupt_wif.py

That should run the script for you.

This very short video shows how to create the script using the text editor and run it: https://www.youtube.com/watch?v=Txt-cLLa_vo
newbie
Activity: 26
Merit: 3
April 12, 2020, 06:23:20 PM
#48
Hi I saw your Post as i am trying to retrieve my misssing character how would i run this code on a mac book pro?

Here's a script in python which uses deepceleron's idea of using the checksum to filter out bad candidates.

It does depend on python-bitcoinlib.
https://github.com/petertodd/python-bitcoinlib

Code:
import bitcoin.base58
from bitcoin.core import b2x, x
from bitcoin.wallet import CBitcoinSecret, P2PKHBitcoinAddress
from bitcoin.core import Hash

def insert_char(string, char, i):
    return string[:i+1]+char+string[i+1:]

def verify_wif_checksum(wif):
    byte_string = b2x(bitcoin.base58.decode(wif))
    private = byte_string[:-8]
    checksum = byte_string[-8:]
    return checksum == b2x(Hash(x(private)))[:8]

def candidate_wifs(corrupted_wif):
    candidates = []
    for i in range(len(corrupted_wif)):
        for char in bitcoin.base58.B58_DIGITS:
            candidate_wif = insert_char(corrupted_wif, char, i)
            if verify_wif_checksum(candidate_wif):   
                candidates.append(candidate_wif)
    return candidates


# Provide a WIF private key with a single missing character.
corrupted_wif = '5HueCGU8rMjxEXxiPuD5BDku4kFqeZyd4dZ1jvhTVqvbTLvyTJ'
#   Should be:  '5HueCGU8rMjxEXxiPuD5BDku4MkFqeZyd4dZ1jvhTVqvbTLvyTJ'

for candidate_wif in candidate_wifs(corrupted_wif):
    print(candidate_wif)

It should hopefully output any candidate private keys.

For example:
5HueCGU8rMjxEXxiPuD5BDku4MkFqeZyd4dZ1jvhTVqvbTLvyTJ

legendary
Activity: 3500
Merit: 6320
Crypto Swap Exchange
March 02, 2020, 06:51:28 PM
#47
Hi All

I was wanting to know if anyone could provide me a search command as i am missing 4 characters from my private key base 58.  From the search command how would you know if the private key is valid or not?

My private key starts with K i have 48/49 characters i just require a search command so my friend can complete this for me?

please let me know thanks

If you know where the characters are missing then take a look here:

https://bitcointalksearch.org/topic/the-finderouter-a-bitcoin-recovery-tool-v0160-2022-09-19-5214021

Download and run. Depending on the speed of your system should not take long at all.

-Dave
newbie
Activity: 26
Merit: 3
March 02, 2020, 01:32:16 PM
#46
Hi All

I was wanting to know if anyone could provide me a search command as i am missing 4 characters from my private key base 58.  From the search command how would you know if the private key is valid or not?

My private key starts with K i have 48/49 characters i just require a search command so my friend can complete this for me?

please let me know thanks
newbie
Activity: 26
Merit: 3
September 29, 2016, 05:37:10 PM
#45
I missed the recent activity in this thread.

Here's another script that substitutes replacements from the base58 character set for each character in the bad wif, and then inserts all base58 chars at each position in the string.

So it should deal with all private keys that have one missing character plus one mistranscribed character.

It takes about 15 minutes to run on my old, slow laptop, but I've included progress output so that you can tell something is at least happening.

Code:
import bitcoin.base58
from bitcoin.core import b2x, x
from bitcoin.core import Hash
import sys

def replace_char(string, char, i):
    return string[:i]+char+string[i+1:]

def insert_char(string, char, i):
    return string[:i+1]+char+string[i+1:]

def verify_wif_checksum(wif):
    byte_string = b2x(bitcoin.base58.decode(wif))
    private = byte_string[:-8]
    checksum = byte_string[-8:]
    return checksum == b2x(Hash(x(private)))[:8]

def candidate_wifs(corrupted_wif):
    candidates = set()
    for i in range(len(corrupted_wif)):
        #print("%i of %i" % (i, len(corrupted_wif)),)
        sys.stdout.write("%3i of %3i : " % (i, len(corrupted_wif)))
        for char in bitcoin.base58.B58_DIGITS:
            sys.stdout.write(char)
            candidate_wif = replace_char(corrupted_wif, char, i)
            for c in insertion_candidates(candidate_wif):
                candidates.add(c)
        print()
    return candidates

def insertion_candidates(corrupted_wif):
    candidates = []
    for i in range(len(corrupted_wif)):
        for char in bitcoin.base58.B58_DIGITS:
            candidate_wif = insert_char(corrupted_wif, char, i)
            if verify_wif_checksum(candidate_wif):
                print("\nFound: %s" % candidate_wif)
                candidates.append(candidate_wif)
    return candidates

# Provide a WIF private key with a single missing character.
# Wrong Char              v
corrupted_wif = '5HueCGU8rkjxEXxiPuD5BDku4kFqeZyd4dZ1jvhTVqvbTLvyTJ'
#  Should be:   '5HueCGU8rMjxEXxiPuD5BDku4MkFqeZyd4dZ1jvhTVqvbTLvyTJ'
#  Missing Char                           ^
for candidate_wif in candidate_wifs(corrupted_wif):
    print(candidate_wif)
hero member
Activity: 544
Merit: 507
June 25, 2016, 05:25:34 AM
#44

yes, it is from bitaddress.org.
My private key start with 5KALGPT****.

Based on bitaddress, private key with 52 characters base58, starts with a 'K' or 'L

Indeed, default they'll give you a WIF Compressed private key, starting with K or L, so i wonder what happened since you ended up with 50 letters starting with a 5.
The two things popping to mind:

1) you used the wallet details to get a private key in WIF format, written it down and forgot 1 letter... Maybe even switched some other letters or couldn't read your handwriting
2) you've written down the WIF compressed PK, but forgot the initial K or L AND one extra letter... The odds of the second letter in the WIF compressed pk being 5 is pretty small tough...

I have to ask: is there any chance you might have printed out the page from bitaddress... Chances of mixing up letters and bad handwriting are pretty small on a printed piece of paper.... I know, it's a longshot, but it's certainly worth your effort to try and remember this

you are right.

Nothing loss to add extra K or L in front and run the script again, although the odds pretty small thought.
I used to tried to replace some character from my writing key, like "o" to zero, "f" to capital F.....perhaps i should spend much effort to try again and again with the script.



I wonder if you could recover your key. update us please
legendary
Activity: 1176
Merit: 1280
May Bitcoin be touched by his Noodly Appendage
June 21, 2016, 08:25:57 AM
#43
Nearly everything has been said I think Sad

You can also try to generate many empty WIF private keys, write them down and then compare your writings with the original ones
With much luck you may find what errors you tend to make: mixing one letter with another, mixing two consecutive letters, capitalizing downcase letters, etc
legendary
Activity: 3584
Merit: 5243
https://merel.mobi => buy facemasks with BTC/LTC
June 16, 2016, 03:30:46 AM
#42
you are right.

Nothing loss to add extra K or L in front and run the script again, although the odds pretty small thought.
I used to tried to replace some character from my writing key, like "o" to zero, "f" to capital F.....perhaps i should spend much effort to try again and again with the script.



>10BTC is worth >$7k at current preev rate. If i were you, i'd try everything to get that money back. $7k is not the end of the world, but i'd have to work for a really long time in order to put $7k in my savings account...

You can try to interpolate all letters you're unsure about, generate addresses starting with K or L,.... Maye you'll get lucky Smiley
The other option is to offer a 10 or 20% finders fee and let some REALLY, REALLY, REALLY trusted member try to solve your problem. It's certainly something you shouldn't do very lightly, since it'll involve sending this person everything you know (including the written pk). If you take this path, defenately chose somebody who has been around for a long time, did business worth at least 100BTC on this forum, has a lot of green trust, didn't change his/her password recently, and can sign a message with a really old staked address. Sending over the private key should be a "last resort", but if it's chosing between forfeiting 10BTC or giving 2BTC finders fee and recuperating 8BTC with a reasonable risk, i'd chose the latter.
newbie
Activity: 16
Merit: 1
June 16, 2016, 02:35:19 AM
#41

yes, it is from bitaddress.org.
My private key start with 5KALGPT****.

Based on bitaddress, private key with 52 characters base58, starts with a 'K' or 'L

Indeed, default they'll give you a WIF Compressed private key, starting with K or L, so i wonder what happened since you ended up with 50 letters starting with a 5.
The two things popping to mind:

1) you used the wallet details to get a private key in WIF format, written it down and forgot 1 letter... Maybe even switched some other letters or couldn't read your handwriting
2) you've written down the WIF compressed PK, but forgot the initial K or L AND one extra letter... The odds of the second letter in the WIF compressed pk being 5 is pretty small tough...

I have to ask: is there any chance you might have printed out the page from bitaddress... Chances of mixing up letters and bad handwriting are pretty small on a printed piece of paper.... I know, it's a longshot, but it's certainly worth your effort to try and remember this

you are right.

Nothing loss to add extra K or L in front and run the script again, although the odds pretty small thought.
I used to tried to replace some character from my writing key, like "o" to zero, "f" to capital F.....perhaps i should spend much effort to try again and again with the script.

legendary
Activity: 3584
Merit: 5243
https://merel.mobi => buy facemasks with BTC/LTC
June 16, 2016, 02:22:37 AM
#40

yes, it is from bitaddress.org.
My private key start with 5KALGPT****.

Based on bitaddress, private key with 52 characters base58, starts with a 'K' or 'L

Indeed, default they'll give you a WIF Compressed private key, starting with K or L, so i wonder what happened since you ended up with 50 letters starting with a 5.
The two things popping to mind:

1) you used the wallet details to get a private key in WIF format, written it down and forgot 1 letter... Maybe even switched some other letters or couldn't read your handwriting
2) you've written down the WIF compressed PK, but forgot the initial K or L AND one extra letter... The odds of the second letter in the WIF compressed pk being 5 is pretty small tough...

I have to ask: is there any chance you might have printed out the page from bitaddress... Chances of mixing up letters and bad handwriting are pretty small on a printed piece of paper.... I know, it's a longshot, but it's certainly worth your effort to try and remember this
newbie
Activity: 16
Merit: 1
June 16, 2016, 02:06:21 AM
#39
I know it's gonna be a trust issue, but if I were you, I'd ask someone for help with running the scripts. Maybe one of the coders that were helping you. You are running a windows computer, right?

i've ran the script on linux, and it work perfectly to find missing one character with others bitcoin private key.
The issue is my key written on paper just simply doesn't work out as expected , no ideas where gone wrong...hehe

Well, if you did this:
  • generated a new private key
  • removed 1 character
  • ran it trough kn_b_y's script
  • got some valid private keys back, imported them, worked ok

But you cannot run the private key you have on paper trough the same script (0 outputs), chances are pretty high the string you have on paper isn't correct to begin with Sad
A private key in WIF is indeed 51 characters (if i'm not mistaking), so i'm finding it a bit odd...

you say you:
  • generated a private key with bitaddress (i can only assume that's the online bitaddress.org, or maybe the downloaded sourcecode)
  • if i'm not mistaking, bitaddress gives you a Private Key WIF Compressed (52 characters base58, starts with a 'K' or 'L')
  • since your private key starts with a 5, you might have clicked on 'wallet details', so you can see the private key wif compressed, private key wif (51 characters, starts with 5), Private Key Hexadecimal Format and Private Key Base64
  • To begin with, i find it odd that you would have saved the private key wif, instead of the private key wif compressed (since that's the default one)
  • are you sure you already imported in in a wallet like that?

yes, it is from bitaddress.org.
My private key start with 5KALGPT****.

Based on bitaddress, private key with 52 characters base58, starts with a 'K' or 'L
newbie
Activity: 16
Merit: 1
June 16, 2016, 02:00:04 AM
#38
.... all we need to do is feed different text possibilities into the validator logically. It may be possible to programmatically find the private key with several characters mistranscribed or missing:

- Starts with "5"? No? Add "5" if missing characters; substitute "5" if right length; add "5" and drop other characters if right length;
- Correct Length: substitute alternate upper/lower case for one character, check all positions for one character wrong, then iterate for increasing numbers of multiple incorrect cases, incorrect letters, etc;
- Missing one character? Try adding all Base58 characters at all positions.

Missing two characters? It becomes a slightly harder problem. Adding two characters in all possible positions = 3,956,064 possibilities (if the 5 at the start is correct). Single-threaded python does about 300,000 SHA256 hashes a second on my PC, so probably less than a minute to try all.

This might be an interesting programming project, but I wouldn't bother until it's actually going to recover some Bitcoins.

It sounds like the private key may need more massaging to recover, whether programmatically, or by analysis of what was written down. I would start by analyzing how you transcribed the private key to paper, and think for yourself where you were and how it might have been written in error. Did you lose your place when writing it down, are there any letters close to each other that repeat? Did you make a mistake in lower/upper case when transcribing. Picture yourself with pen and paper in one hand and screen, you will be your own best resource for figuring out how it might have gone wrong.

Programming a solution to "brute force" what was written down now needs to be informed about further possible ways that mistakes were made.

hehe, i hope i knew where it went wrong  Huh, and it is impossible to recall.... Cry
legendary
Activity: 3584
Merit: 5243
https://merel.mobi => buy facemasks with BTC/LTC
June 16, 2016, 01:58:37 AM
#37
I know it's gonna be a trust issue, but if I were you, I'd ask someone for help with running the scripts. Maybe one of the coders that were helping you. You are running a windows computer, right?

i've ran the script on linux, and it work perfectly to find missing one character with others bitcoin private key.
The issue is my key written on paper just simply doesn't work out as expected , no ideas where gone wrong...hehe

Well, if you did this:
  • generated a new private key
  • removed 1 character
  • ran it trough kn_b_y's script
  • got some valid private keys back, imported them, worked ok
You can be pretty sure you're doing it right Wink

But you cannot run the private key you have on paper trough the same script (0 outputs), chances are pretty high the string you have on paper isn't correct to begin with Sad
A private key in WIF is indeed 51 characters (if i'm not mistaking), so i'm finding it a bit odd...

you say you:
  • generated a private key with bitaddress (i can only assume that's the online bitaddress.org, or maybe the downloaded sourcecode)
  • if i'm not mistaking, bitaddress gives you a Private Key WIF Compressed (52 characters base58, starts with a 'K' or 'L')
  • since your private key starts with a 5, you might have clicked on 'wallet details', so you can see the private key wif compressed, private key wif (51 characters, starts with 5), Private Key Hexadecimal Format and Private Key Base64
  • To begin with, i find it odd that you would have saved the private key wif, instead of the private key wif compressed (since that's the default one)
  • are you sure you already imported in in a wallet like that?
legendary
Activity: 1512
Merit: 1036
June 16, 2016, 01:50:54 AM
#36
.... all we need to do is feed different text possibilities into the validator logically. It may be possible to programmatically find the private key with several characters mistranscribed or missing:

- Starts with "5"? No? Add "5" if missing characters; substitute "5" if right length; add "5" and drop other characters if right length;
- Correct Length: substitute alternate upper/lower case for one character, check all positions for one character wrong, then iterate for increasing numbers of multiple incorrect cases, incorrect letters, etc;
- Missing one character? Try adding all Base58 characters at all positions.

Missing two characters? It becomes a slightly harder problem. Adding two characters in all possible positions = 3,956,064 possibilities (if the 5 at the start is correct). Single-threaded python does about 300,000 SHA256 hashes a second on my PC, so probably less than a minute to try all.

This might be an interesting programming project, but I wouldn't bother until it's actually going to recover some Bitcoins.

It sounds like the private key may need more massaging to recover, whether programmatically, or by analysis of what was written down. I would start by analyzing how you transcribed the private key to paper, and think for yourself where you were and how it might have been written in error. Did you lose your place when writing it down, are there any letters close to each other that repeat? Did you make a mistake in lower/upper case when transcribing. Picture yourself with pen and paper in one hand and screen, you will be your own best resource for figuring out how it might have gone wrong.

Programming a solution to "brute force" what was written down now needs to be informed about further possible ways that mistakes were made.
newbie
Activity: 16
Merit: 1
June 16, 2016, 01:45:46 AM
#35
I know it's gonna be a trust issue, but if I were you, I'd ask someone for help with running the scripts. Maybe one of the coders that were helping you. You are running a windows computer, right?

i've ran the script on linux, and it work perfectly to find missing one character with others bitcoin private key.
The issue is my key written on paper just simply doesn't work out as expected , no ideas where gone wrong...hehe
full member
Activity: 165
Merit: 100
June 16, 2016, 01:36:07 AM
#34
I know it's gonna be a trust issue, but if I were you, I'd ask someone for help with running the scripts. Maybe one of the coders that were helping you. You are running a windows computer, right?
newbie
Activity: 16
Merit: 1
June 16, 2016, 01:25:15 AM
#33
i stored the altcoin in bitcoin address and it was generated from bitaddress, subsequently import the address in omniwallet to view/transfer the coins.

1. 50 characters private key on hand under WIF format, start with "5".
2. I cann't import my private key into omniwallet, now i recall i used to be imported before...but not sure i copy it from clipboard or on my paper written paper.
3. subsequently i found bitaddress private key was generated with 51 characters, and i suspect my 50 characters written on paper was incorrect, and it should be 51 char instead...

Thank you for all dudes in assist to provide the script to find the missing char, but no smiling from lucky lady  Huh Angry
newbie
Activity: 16
Merit: 1
June 16, 2016, 01:12:42 AM
#32
This is a pretty common problem when recording such a long key.
Always best to test the recorded key before sending bitcoins to it.

I am curious as to how much bitcoins are stuck there for now?

>10 btc Sad
legendary
Activity: 1229
Merit: 1001
June 12, 2016, 12:06:28 PM
#31
This is a pretty common problem when recording such a long key.
Always best to test the recorded key before sending bitcoins to it.

I am curious as to how much bitcoins are stuck there for now?
newbie
Activity: 16
Merit: 1
June 10, 2016, 12:57:00 AM
#30
Here's a script in python which uses deepceleron's idea of using the checksum to filter out bad candidates.

It does depend on python-bitcoinlib.
https://github.com/petertodd/python-bitcoinlib

Code:
import bitcoin.base58
from bitcoin.core import b2x, x
from bitcoin.wallet import CBitcoinSecret, P2PKHBitcoinAddress
from bitcoin.core import Hash

def insert_char(string, char, i):
    return string[:i+1]+char+string[i+1:]

def verify_wif_checksum(wif):
    byte_string = b2x(bitcoin.base58.decode(wif))
    private = byte_string[:-8]
    checksum = byte_string[-8:]
    return checksum == b2x(Hash(x(private)))[:8]

def candidate_wifs(corrupted_wif):
    candidates = []
    for i in range(len(corrupted_wif)):
        for char in bitcoin.base58.B58_DIGITS:
            candidate_wif = insert_char(corrupted_wif, char, i)
            if verify_wif_checksum(candidate_wif):   
                candidates.append(candidate_wif)
    return candidates


# Provide a WIF private key with a single missing character.
corrupted_wif = '5HueCGU8rMjxEXxiPuD5BDku4kFqeZyd4dZ1jvhTVqvbTLvyTJ'
#   Should be:  '5HueCGU8rMjxEXxiPuD5BDku4MkFqeZyd4dZ1jvhTVqvbTLvyTJ'

for candidate_wif in candidate_wifs(corrupted_wif):
    print(candidate_wif)

It should hopefully output any candidate private keys.

For example:
5HueCGU8rMjxEXxiPuD5BDku4MkFqeZyd4dZ1jvhTVqvbTLvyTJ


Hi, the script run perfectly as i did some test. Many thanks!  Wink
However, it show no result when i insert my 50 characters private key. I'm completely out of clue now.... Huh
legendary
Activity: 3584
Merit: 5243
https://merel.mobi => buy facemasks with BTC/LTC
May 02, 2016, 04:45:42 AM
#29
The possibilities to find the missing character seems simple. It is very hard to find it correct. If you're not sure the place of the character in your private key, it may be impossible to generate the correct address.

If you read the code kn_b_y has produced, you'll see that it's not only possible, but even not that hard to do... If you're not familiar with python, i already gave a basic start on how to solve the problem with perl (altough kn_b_y's version is a lot better, it only produces valid private keys)
full member
Activity: 196
Merit: 100
April 30, 2016, 11:49:27 AM
#28
The possibilities to find the missing character seems simple. It is very hard to find it correct. If you're not sure the place of the character in your private key, it may be impossible to generate the correct address.
newbie
Activity: 26
Merit: 3
April 28, 2016, 06:51:07 AM
#27
Seems like kn_b_y solved your problem  Grin
@kn_b_y: nice work man, just a little tip: try to avoid posting real private keys... The address you generated was empty (luckily), but still used, so if it's part of a wallet of yours, it might be a good idear to "freeze" it, so you don't accidently receive any coins in it...

Though I noticed the generated address was incorrect - a potential hazzard!

So I've edited the post.
newbie
Activity: 26
Merit: 3
April 28, 2016, 05:02:13 AM
#26
Seems like kn_b_y solved your problem  Grin
@kn_b_y: nice work man, just a little tip: try to avoid posting real private keys... The address you generated was empty (luckily), but still used, so if it's part of a wallet of yours, it might be a good idear to "freeze" it, so you don't accidently receive any coins in it...

Thanks. I'm available for work.  Wink Anybody??

Yeah, I too was curious to see if the address had been used before and noticed some activity.

It's not a key I generated. It's the one from deepceleron's post which is also used in the WIF docs at:
https://en.bitcoin.it/wiki/Wallet_import_format
legendary
Activity: 3584
Merit: 5243
https://merel.mobi => buy facemasks with BTC/LTC
April 28, 2016, 01:07:21 AM
#25
Seems like kn_b_y solved your problem  Grin
@kn_b_y: nice work man, just a little tip: try to avoid posting real private keys... The address you generated was empty (luckily), but still used, so if it's part of a wallet of yours, it might be a good idear to "freeze" it, so you don't accidently receive any coins in it...
legendary
Activity: 3808
Merit: 7912
April 27, 2016, 09:48:39 PM
#24
Hi,

I wrote my private key on the paper, and i tried to retrieve the btc from the address recently, but found my private key only contain 50 characters! It is my mistake when record down the private key!!

The private key format is WIF without any compressed, base58, start with "5".
I've 50 characters on hand, is there any brute force tools to calculate the key in quick way?

Thank you.

  How many coins are stored in the address?
newbie
Activity: 26
Merit: 3
April 27, 2016, 08:09:54 PM
#23
Here's a script in python which uses deepceleron's idea of using the checksum to filter out bad candidates.

It does depend on python-bitcoinlib.
https://github.com/petertodd/python-bitcoinlib

Code:
import bitcoin.base58
from bitcoin.core import b2x, x
from bitcoin.wallet import CBitcoinSecret, P2PKHBitcoinAddress
from bitcoin.core import Hash

def insert_char(string, char, i):
    return string[:i+1]+char+string[i+1:]

def verify_wif_checksum(wif):
    byte_string = b2x(bitcoin.base58.decode(wif))
    private = byte_string[:-8]
    checksum = byte_string[-8:]
    return checksum == b2x(Hash(x(private)))[:8]

def candidate_wifs(corrupted_wif):
    candidates = []
    for i in range(len(corrupted_wif)):
        for char in bitcoin.base58.B58_DIGITS:
            candidate_wif = insert_char(corrupted_wif, char, i)
            if verify_wif_checksum(candidate_wif):   
                candidates.append(candidate_wif)
    return candidates


# Provide a WIF private key with a single missing character.
corrupted_wif = '5HueCGU8rMjxEXxiPuD5BDku4kFqeZyd4dZ1jvhTVqvbTLvyTJ'
#   Should be:  '5HueCGU8rMjxEXxiPuD5BDku4MkFqeZyd4dZ1jvhTVqvbTLvyTJ'

for candidate_wif in candidate_wifs(corrupted_wif):
    print(candidate_wif)

It should hopefully output any candidate private keys.

For example:
5HueCGU8rMjxEXxiPuD5BDku4MkFqeZyd4dZ1jvhTVqvbTLvyTJ
legendary
Activity: 3584
Merit: 5243
https://merel.mobi => buy facemasks with BTC/LTC
April 20, 2016, 07:33:33 AM
#22
It isn't finished (yet), i just had 10 minutes over my lunchbreak, so i made a first "draft".. No checking for correct keys ATM.
Just enter the characters that can be used to insert into your key in the $db string, and the key (missing 1 character) in the $privatekey_wif string, and the script will generate all possible combinations...

It should run on windows  Undecided with activestate perl, without any extra modules... It's untested, and i don't take any blame if things go wrong  Grin

You can take this script, and invoke any windows command (like bitcoin-cli  importprivkey $key) and make this work, or you can wait untill i've included a checking-function (if and when i find the time to do this).


Code:
#!c:\perl64\bin\perl.exe
$db = "allvalidcharacters";
$privatekey_wif="mykeymissingonecharacter";
@delen = split('',$privatekey_wif);
@letters = split('',$db);
$length = length($privatekey_wif);
for ($position = 0; $position < $length+1; $position++)
{
foreach(@letters)
{
@new = @delen;
splice(@new, $position, 0, $_);
print join('',@new)."\n";
}
}
newbie
Activity: 16
Merit: 1
April 18, 2016, 06:03:09 AM
#21
@deepceleron: thanks for the info, i never tought about the problem like that.

Since it seems to be an interesting problem, i'll try to write a perl script to take a private key in WIF format with x missing letters as input, and permutate all allowed characters in this string, test if the permutated pk is valid and write all the valid keys to a logfile (or import them in bitcoin core directly).

Since this is a bit more difficult, and i can only work on the problem during my luchbreak, it might take a couple of days tough.

I cann't appreciate enough for your help Cheesy . Take your time, this is not a problem.
legendary
Activity: 3584
Merit: 5243
https://merel.mobi => buy facemasks with BTC/LTC
April 18, 2016, 12:49:06 AM
#20
@deepceleron: thanks for the info, i never tought about the problem like that.

Since it seems to be an interesting problem, i'll try to write a perl script to take a private key in WIF format with x missing letters as input, and permutate all allowed characters in this string, test if the permutated pk is valid and write all the valid keys to a logfile (or import them in bitcoin core directly).

Since this is a bit more difficult, and i can only work on the problem during my luchbreak, it might take a couple of days tough.
legendary
Activity: 1512
Merit: 1036
April 17, 2016, 04:21:04 AM
#19
The wallet import format has a checksum in it just like Bitcoin addresses. It is possible to quickly determine if a candidate "recovered" key is valid:

WIF checksum checking

1 - Take the Wallet Import Format string
Code:
   5HueCGU8rMjxEXxiPuD5BDku4MkFqeZyd4dZ1jvhTVqvbTLvyTJ

2 - Convert it to a byte string using Base58Check encoding
Code:
   800C28FCA386C7A227600B2FE50B7CAE11EC86D3BF1FBE471BE89827E19D72AA1D507A5B8D

3 - is the beginning byte string 0x80? If not, invalid.

4 - Drop the last 4 checksum bytes from the byte string
Code:
   800C28FCA386C7A227600B2FE50B7CAE11EC86D3BF1FBE471BE89827E19D72AA1D

5 - Perform SHA-256 hash on the shortened string
Code:
   8147786C4D15106333BF278D71DADAF1079EF2D2440A4DDE37D747DED5403592

6 - Perform SHA-256 hash on result of SHA-256 hash
Code:
   507A5B8DFED0FC6FE8801743720CEDEC06AA5C6FCA72B07C49964492FB98A714

7 - Take the first 4 bytes of the second SHA-256 hash, this is the checksum
Code:
   507A5B8D

8 - Is #7 the same as the last 4 bytes of #2? If not, invalid.

If we have such a checking routine that can try hundreds of WIF key checksums per second, then all we need to do is feed different text possibilities into the validator logically. It may be possible to programmatically find the private key with several characters mistranscribed or missing:

- Starts with "5"? No? Add "5" if missing characters; substitute "5" if right length; add "5" and drop other characters if right length;
- Correct Length: substitute alternate upper/lower case for one character, check all positions for one character wrong, then iterate for increasing numbers of multiple incorrect cases, incorrect letters, etc;
- Missing one character? Try adding all Base58 characters at all positions.

Missing two characters? It becomes a slightly harder problem. Adding two characters in all possible positions = 3,956,064 possibilities (if the 5 at the start is correct). Single-threaded python does about 300,000 SHA256 hashes a second on my PC, so probably less than a minute to try all.

This might be an interesting programming project, but I wouldn't bother until it's actually going to recover some Bitcoins.
newbie
Activity: 16
Merit: 1
April 15, 2016, 07:13:05 AM
#18
thanks dude, i will run it in cygwin  Wink

If you cannot get it fixed, let us know and i'll rewrite it in perl (not much work, but i won't do it if it's not needed)

that will be great if you can rewrite it in perl.
i just ran it in the cygwin, same error  Grin
legendary
Activity: 3584
Merit: 5243
https://merel.mobi => buy facemasks with BTC/LTC
April 15, 2016, 04:11:58 AM
#17
thanks dude, i will run it in cygwin  Wink

If you cannot get it fixed, let us know and i'll rewrite it in perl (not much work, but i won't do it if it's not needed)
newbie
Activity: 16
Merit: 1
April 15, 2016, 02:12:50 AM
#16
I'm using perl in window, and encounter an error as below. Do i have to define the variables like i='(A..Z)' ??

C:\Strawberry\perl\test>perl test.pl
Missing $ on loop variable at test.pl line 1.

Quote
for i in `perl -e '$,=" ";
print +(A..Z),(a..z),(0..9)'`;

"for i in something; do something; done" is not perl. It's bash, and I don't think you get that in stock windows boxes even today. Install cygwin and try there.

^^ this is correct... I'm running on a linux box (and i wrongly assumed so were you), so it's basically a combination between bash and perl (which is installed by default on 90+% of the linux distros, but not on windows... you need something like mobaXterm or cygwin with some addons to do this task)...
Did you get this solved, or do i have to rewrite it in pure perl?
I'm using perl in window, and encounter an error as below. Do i have to define the variables like i='(A..Z)' ??

C:\Strawberry\perl\test>perl test.pl
Missing $ on loop variable at test.pl line 1.

Quote
for i in `perl -e '$,=" ";
print +(A..Z),(a..z),(0..9)'`;

"for i in something; do something; done" is not perl. It's bash, and I don't think you get that in stock windows boxes even today. Install cygwin and try there.

thanks dude, i will run it in cygwin  Wink
newbie
Activity: 16
Merit: 1
April 15, 2016, 02:05:28 AM
#15
maybe you can use crunch - wordlist generator
https://sourceforge.net/projects/crunch-wordlist/

Code:
./crunch 52 52 123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz -t L4rK1yDtCWekvXuE6oXD9jCYfFNV2cWRpVuPLBcCU2z8TrisoyY@ -o found.txt

cool tool, i give a try  Cheesy
legendary
Activity: 3584
Merit: 5243
https://merel.mobi => buy facemasks with BTC/LTC
April 15, 2016, 01:36:38 AM
#14
maybe you can use crunch - wordlist generator
https://sourceforge.net/projects/crunch-wordlist/

Code:
./crunch 52 52 123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz -t L4rK1yDtCWekvXuE6oXD9jCYfFNV2cWRpVuPLBcCU2z8TrisoyY@ -o found.txt

it's a nice tool... I didn't know that one, seems like a really cool tool to use in the future.
Thanks for the link Smiley
member
Activity: 101
Merit: 11
N.E.E.T
April 15, 2016, 01:35:01 AM
#13
maybe you can use crunch - wordlist generator
https://sourceforge.net/projects/crunch-wordlist/

Code:
./crunch 52 52 123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz -t L4rK1yDtCWekvXuE6oXD9jCYfFNV2cWRpVuPLBcCU2z8TrisoyY@ -o found.txt
legendary
Activity: 3584
Merit: 5243
https://merel.mobi => buy facemasks with BTC/LTC
April 15, 2016, 01:33:47 AM
#12
I'm using perl in window, and encounter an error as below. Do i have to define the variables like i='(A..Z)' ??

C:\Strawberry\perl\test>perl test.pl
Missing $ on loop variable at test.pl line 1.

Quote
for i in `perl -e '$,=" ";
print +(A..Z),(a..z),(0..9)'`;

"for i in something; do something; done" is not perl. It's bash, and I don't think you get that in stock windows boxes even today. Install cygwin and try there.

^^ this is correct... I'm running on a linux box (and i wrongly assumed so were you), so it's basically a combination between bash and perl (which is installed by default on 90+% of the linux distros, but not on windows... you need something like mobaXterm or cygwin with some addons to do this task)...
Did you get this solved, or do i have to rewrite it in pure perl?
legendary
Activity: 1974
Merit: 1029
April 15, 2016, 01:30:38 AM
#11
I'm using perl in window, and encounter an error as below. Do i have to define the variables like i='(A..Z)' ??

C:\Strawberry\perl\test>perl test.pl
Missing $ on loop variable at test.pl line 1.

Quote
for i in `perl -e '$,=" ";
print +(A..Z),(a..z),(0..9)'`;

"for i in something; do something; done" is not perl. It's bash, and I don't think you get that in stock windows boxes even today. Install cygwin and try there.
newbie
Activity: 16
Merit: 1
April 15, 2016, 12:58:29 AM
#10
I'm using perl in window, and encounter an error as below. Do i have to define the variables like i='(A..Z)' ??

C:\Strawberry\perl\test>perl test.pl
Missing $ on loop variable at test.pl line 1.

Quote
for i in `perl -e '$,=" ";
print +(A..Z),(a..z),(0..9)'`;
legendary
Activity: 3584
Merit: 5243
https://merel.mobi => buy facemasks with BTC/LTC
March 23, 2016, 08:51:08 AM
#9
Indeed, i'm going to do so. The missing character is not really the last character but somewhere inside the 50.
Your guys are awesome.

Sorry, i wrongfully assumed it was the last character that went missing (wrong copy/paste), but like CIYAM already said, you can repeat the step 50 times Wink

EDIT: btw: you can get the bitcoin-cli binary, connect it to blockchain.info's JSON-RPC API in case you don't want to sync the whole blockchain:

for i in `perl -e '$,=" ";print +(A..Z),(a..z),(0..9)'` ; do bitcoin-cli -rpcconnect=rpc.blockchain.info -rpcport=443 -rpcssl -rpcuser=YourWalletIdentifier -rpcpassword=YourPassword importprivkey "yourkey"$i ; done

Just be carefull: i'm not sure if blockchain will ban your ip after x ammount of tries Wink ALSO: sweep your wallet and move your funds to a secure wallet once you've used blockchain's API, i would personally not trust an online wallet....
(btw: the approach is untested)
newbie
Activity: 16
Merit: 1
March 23, 2016, 08:21:04 AM
#8
i'm sorry i'm not a programmer Cheesy, any open source tool available to do that?

Do you have bitcoind running on a linux server?
In that case, something like this might work:
Code:
for i in `perl -e '$,=" ";print +(A..Z),(a..z),(0..9)'` ; do bitcoin-cli  importprivkey "yourkey"$i ; done

Bravo! Many thanks! Grin, i don't have bitcoind running now, but i will get one to do so.

That will only guess a final character (i.e. is assuming you missed the very last character only). If you are not certain which character you missed then you'd need to basically repeat like this:

Code:
for i in `perl -e '$,=" ";print +(A..Z),(a..z),(0..9)'` ; do bitcoin-cli  importprivkey "y"$i"ourkey" ; done
for i in `perl -e '$,=" ";print +(A..Z),(a..z),(0..9)'` ; do bitcoin-cli  importprivkey "yo"$i"urkey" ; done
for i in `perl -e '$,=" ";print +(A..Z),(a..z),(0..9)'` ; do bitcoin-cli  importprivkey "you"$i"rkey" ; done
for i in `perl -e '$,=" ";print +(A..Z),(a..z),(0..9)'` ; do bitcoin-cli  importprivkey "your"$i"key" ; done
for i in `perl -e '$,=" ";print +(A..Z),(a..z),(0..9)'` ; do bitcoin-cli  importprivkey "yourk"$i"ey" ; done
for i in `perl -e '$,=" ";print +(A..Z),(a..z),(0..9)'` ; do bitcoin-cli  importprivkey "yourke"$i"y" ; done
for i in `perl -e '$,=" ";print +(A..Z),(a..z),(0..9)'` ; do bitcoin-cli  importprivkey "yourkey"$i ; done

(hope that makes sense and of course the first character is always going to be the 5)


Indeed, i'm going to do so. The missing character is not really the last character but somewhere inside the 50.
Your guys are awesome.
legendary
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
March 23, 2016, 08:16:06 AM
#7
i'm sorry i'm not a programmer Cheesy, any open source tool available to do that?

Do you have bitcoind running on a linux server?
In that case, something like this might work:
Code:
for i in `perl -e '$,=" ";print +(A..Z),(a..z),(0..9)'` ; do bitcoin-cli  importprivkey "yourkey"$i ; done

Bravo! Many thanks! Grin, i don't have bitcoind running now, but i will get one to do so.

That will only guess a final character (i.e. is assuming you missed the very last character only). If you are not certain which character you missed then you'd need to basically repeat like this:

Code:
for i in `perl -e '$,=" ";print +(A..Z),(a..z),(0..9)'` ; do bitcoin-cli  importprivkey "y"$i"ourkey" ; done
for i in `perl -e '$,=" ";print +(A..Z),(a..z),(0..9)'` ; do bitcoin-cli  importprivkey "yo"$i"urkey" ; done
for i in `perl -e '$,=" ";print +(A..Z),(a..z),(0..9)'` ; do bitcoin-cli  importprivkey "you"$i"rkey" ; done
for i in `perl -e '$,=" ";print +(A..Z),(a..z),(0..9)'` ; do bitcoin-cli  importprivkey "your"$i"key" ; done
for i in `perl -e '$,=" ";print +(A..Z),(a..z),(0..9)'` ; do bitcoin-cli  importprivkey "yourk"$i"ey" ; done
for i in `perl -e '$,=" ";print +(A..Z),(a..z),(0..9)'` ; do bitcoin-cli  importprivkey "yourke"$i"y" ; done
for i in `perl -e '$,=" ";print +(A..Z),(a..z),(0..9)'` ; do bitcoin-cli  importprivkey "yourkey"$i ; done

(hope that makes sense and of course the first character is always going to be the 5)
newbie
Activity: 16
Merit: 1
March 23, 2016, 08:11:40 AM
#6
i'm sorry i'm not a programmer Cheesy, any open source tool available to do that?

Do you have bitcoind running on a linux server?
In that case, something like this might work:
Code:
for i in `perl -e '$,=" ";print +(A..Z),(a..z),(0..9)'` ; do bitcoin-cli  importprivkey "yourkey"$i ; done

Bravo! Many thanks! Grin, i don't have bitcoind running now, but i will get one to do so.
legendary
Activity: 3584
Merit: 5243
https://merel.mobi => buy facemasks with BTC/LTC
March 23, 2016, 08:04:51 AM
#5
i'm sorry i'm not a programmer Cheesy, any open source tool available to do that?

Do you have bitcoind running on a linux server?
In that case, something like this might work:
Code:
for i in `perl -e '$,=" ";print +(A..Z),(a..z),(0..9)'` ; do bitcoin-cli  importprivkey "yourkey"$i ; done
newbie
Activity: 16
Merit: 1
March 23, 2016, 07:59:39 AM
#4
i'm sorry i'm not a programmer Cheesy, any open source tool available to do that?
legendary
Activity: 3584
Merit: 5243
https://merel.mobi => buy facemasks with BTC/LTC
March 23, 2016, 07:55:21 AM
#3
Pretty easy to hack something together in bash or perl, just loop trough all the characters, add them to the end of your private key, and try to import them using JSON-RPC, either into bitcoin core or to blockchain.info
legendary
Activity: 3472
Merit: 4801
March 23, 2016, 07:52:50 AM
#2
Hi,

I wrote my private key on the paper, and i tried to retrieve the btc from the address recently, but found my private key only contain 50 characters! It is my mistake when record down the private key!!

The private key format is WIF without any compressed, base58, start with "5".
I've 50 characters on hand, is there any brute force tools to calculate the key in quick way?

Thank you.

If you're sure that you are only missing 1 character, and that you got ALL the other characters correct, then you have less than 3,000 possibilities to try.  A computer program could probably try all the possibilities in less than a second.

Do not give your private key to anybody else to try for you (unless you are VERY CERTAIN that they are trustworthy).  And be VERY careful about any programs anybody else gives you (since they could be trying to trick you into running wallet stealing software).
newbie
Activity: 16
Merit: 1
March 23, 2016, 07:30:23 AM
#1
Hi,

I wrote my private key on the paper, and i tried to retrieve the btc from the address recently, but found my private key only contain 50 characters! It is my mistake when record down the private key!!

The private key format is WIF without any compressed, base58, start with "5".
I've 50 characters on hand, is there any brute force tools to calculate the key in quick way?

Thank you.
Jump to: