j55rrt (OP)
Newbie
Offline
Activity: 16
Merit: 1
|
|
April 18, 2016, 11:03:09 AM |
|
@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 . Take your time, this is not a problem.
|
|
|
|
|
|
|
|
The trust scores you see are subjective; they will change depending on who you have in your trust list.
|
|
|
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
|
|
|
mocacinno
Legendary
Offline
Activity: 3388
Merit: 4922
https://merel.mobi => buy facemasks with BTC/LTC
|
|
April 20, 2016, 12:33:33 PM |
|
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 with activestate perl, without any extra modules... It's untested, and i don't take any blame if things go wrong 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). #!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"; } }
|
|
|
|
kn_b_y
Newbie
Offline
Activity: 26
Merit: 3
|
|
April 28, 2016, 01:09:54 AM Last edit: April 28, 2016, 11:48:44 AM by kn_b_y |
|
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-bitcoinlibimport 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
|
|
|
|
xhomerx10
Legendary
Offline
Activity: 3836
Merit: 8011
|
|
April 28, 2016, 02:48:39 AM |
|
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?
|
|
|
|
mocacinno
Legendary
Offline
Activity: 3388
Merit: 4922
https://merel.mobi => buy facemasks with BTC/LTC
|
|
April 28, 2016, 06:07:21 AM |
|
Seems like kn_b_y solved your problem @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...
|
|
|
|
kn_b_y
Newbie
Offline
Activity: 26
Merit: 3
|
|
April 28, 2016, 10:02:13 AM |
|
Seems like kn_b_y solved your problem @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. 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
|
|
|
|
kn_b_y
Newbie
Offline
Activity: 26
Merit: 3
|
|
April 28, 2016, 11:51:07 AM Last edit: April 28, 2016, 02:17:31 PM by kn_b_y |
|
Seems like kn_b_y solved your problem @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.
|
|
|
|
immangrace
|
|
April 30, 2016, 04:49:27 PM |
|
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.
|
|
|
|
mocacinno
Legendary
Offline
Activity: 3388
Merit: 4922
https://merel.mobi => buy facemasks with BTC/LTC
|
|
May 02, 2016, 09:45:42 AM |
|
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)
|
|
|
|
j55rrt (OP)
Newbie
Offline
Activity: 16
Merit: 1
|
|
June 10, 2016, 05:57:00 AM |
|
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-bitcoinlibimport 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: 5HueCGU8rMjxEXxiPuD5BDku4MkFqeZyd4dZ1jvhTVqvbTLvyTJHi, the script run perfectly as i did some test. Many thanks! However, it show no result when i insert my 50 characters private key. I'm completely out of clue now....
|
|
|
|
Rune
Legendary
Offline
Activity: 1229
Merit: 1001
|
|
June 12, 2016, 05:06:28 PM |
|
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?
|
|
|
|
j55rrt (OP)
Newbie
Offline
Activity: 16
Merit: 1
|
|
June 16, 2016, 06:12:42 AM |
|
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
|
|
|
|
j55rrt (OP)
Newbie
Offline
Activity: 16
Merit: 1
|
|
June 16, 2016, 06:25:15 AM |
|
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
|
|
|
|
PantminerS7
|
|
June 16, 2016, 06:36:07 AM |
|
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?
|
|
|
|
j55rrt (OP)
Newbie
Offline
Activity: 16
Merit: 1
|
|
June 16, 2016, 06:45:46 AM |
|
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
|
|
|
|
deepceleron
Legendary
Offline
Activity: 1512
Merit: 1032
|
|
June 16, 2016, 06:50:54 AM |
|
.... 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.
|
|
|
|
mocacinno
Legendary
Offline
Activity: 3388
Merit: 4922
https://merel.mobi => buy facemasks with BTC/LTC
|
|
June 16, 2016, 06:58:37 AM |
|
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 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 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?
|
|
|
|
j55rrt (OP)
Newbie
Offline
Activity: 16
Merit: 1
|
|
June 16, 2016, 07:00:04 AM |
|
.... 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 , and it is impossible to recall....
|
|
|
|
j55rrt (OP)
Newbie
Offline
Activity: 16
Merit: 1
|
|
June 16, 2016, 07:06:21 AM |
|
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 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
|
|
|
|
mocacinno
Legendary
Offline
Activity: 3388
Merit: 4922
https://merel.mobi => buy facemasks with BTC/LTC
|
|
June 16, 2016, 07:22:37 AM |
|
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
|
|
|
|
|