Pages:
Author

Topic: Private Key lost one character - page 2. (Read 6446 times)

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?
Pages:
Jump to: