Bitcoin Forum
May 05, 2024, 10:05:38 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1] 2 »  All
  Print  
Author Topic: Private Key missing 4 characters  (Read 1052 times)
Albatroz4402 (OP)
Newbie
*
Offline Offline

Activity: 26
Merit: 0


View Profile
May 12, 2018, 01:32:42 PM
 #1

Hello people! I've been looking at the forum and seen that there are some ways to recover a private key that is missing some characters, it fed me hope and I'm trying to figure out a way for me to recover my private key.

Currently my private key has only 47 characters, but of the remaining characters, I'm not sure if the missing ones are the end, beginning or middle of the private key (I think it's the end), you know some algorithm you can try to generate a valid private key in my situation?
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714946738
Hero Member
*
Offline Offline

Posts: 1714946738

View Profile Personal Message (Offline)

Ignore
1714946738
Reply with quote  #2

1714946738
Report to moderator
1714946738
Hero Member
*
Offline Offline

Posts: 1714946738

View Profile Personal Message (Offline)

Ignore
1714946738
Reply with quote  #2

1714946738
Report to moderator
1714946738
Hero Member
*
Offline Offline

Posts: 1714946738

View Profile Personal Message (Offline)

Ignore
1714946738
Reply with quote  #2

1714946738
Report to moderator
LoyceV
Legendary
*
Offline Offline

Activity: 3304
Merit: 16599


Thick-Skinned Gang Leader and Golden Feather 2021


View Profile WWW
May 12, 2018, 02:05:28 PM
Last edit: May 12, 2018, 02:54:21 PM by LoyceV
 #2

I have a Python script C program (see Private Key Restorer for source and credits) that can restore up to 5 characters, if you know their exact location.

If the missing characters are at the end, there may be an easier solution. I've successfully used this to restore the 7 characters checksum. Note that this means exposing your private key to blockchain.info, and I certainly don't recommend this for larger values or cold storage.

Albatroz4402 (OP)
Newbie
*
Offline Offline

Activity: 26
Merit: 0


View Profile
May 12, 2018, 02:37:20 PM
 #3

I have a Python script (from someone on the forum here) that can restore up to 5 characters, if you know their exact location.

If the missing characters are at the end, there may be an easier solution. I've successfully used this to restore the 7 characters checksum. Note that this means exposing your private key to blockchain.info, and I certainly don't recommend this for larger values or cold storage.

I took a look at the topic you sent me, so I understood I should create a new wallet at blockchain.info and import my private key? I tried to do this but at the time of entering my private key in the import settings of the address, it tells me that it is invalid!

As for this script in Python, could you pass me?
LoyceV
Legendary
*
Offline Offline

Activity: 3304
Merit: 16599


Thick-Skinned Gang Leader and Golden Feather 2021


View Profile WWW
May 12, 2018, 02:50:01 PM
 #4

I took a look at the topic you sent me, so I understood I should create a new wallet at blockchain.info and import my private key? I tried to do this but at the time of entering my private key in the import settings of the address, it tells me that it is invalid!
Try it without the last 3 characters (so the full checksum is gone).

Quote
As for this script in Python, could you pass me?
Sorry, it's C, I was wrong. See Private Key Restorer.

Albatroz4402 (OP)
Newbie
*
Offline Offline

Activity: 26
Merit: 0


View Profile
May 12, 2018, 04:01:25 PM
 #5

I took a look at the topic you sent me, so I understood I should create a new wallet at blockchain.info and import my private key? I tried to do this but at the time of entering my private key in the import settings of the address, it tells me that it is invalid!
Try it without the last 3 characters (so the full checksum is gone).

Quote
As for this script in Python, could you pass me?
Sorry, it's C, I was wrong. See Private Key Restorer.

Hello Friend!

I've been able to compile the code and am waiting for it to run, but I have a question:

The characters of my private key are not separated by a "-", I only have 47 alphanumeric characters, in the code should I put my address separated by "-"? If so, what pattern should I adopt to put this "-"?
LoyceV
Legendary
*
Offline Offline

Activity: 3304
Merit: 16599


Thick-Skinned Gang Leader and Golden Feather 2021


View Profile WWW
May 12, 2018, 04:44:27 PM
 #6

I've been able to compile the code and am waiting for it to run, but I have a question:

The characters of my private key are not separated by a "-", I only have 47 alphanumeric characters, in the code should I put my address separated by "-"? If so, what pattern should I adopt to put this "-"?
You have to put a "-" at the place where your private key is missing a character. I'm not sure if the code works with just 4 missing, if it doesn't, you can easily omit one more character.

Example: let's say this is your private key:
5Ht1xbx9coyDSTfpGWn882wdZSwTNmMUzfwd1amRpYUZs8Sv7H9 (do not use this one!)
You miss 4 characters, assuming they are missing at the end, this is what you have:
5Ht1xbx9coyDSTfpGWn882wdZSwTNmMUzfwd1amRpYUZs8S
I suggest to use this for the recovery program:
5Ht1xbx9coyDSTfpGWn882wdZSwTNmMUzfwd1amRpYUZs8-----

Albatroz4402 (OP)
Newbie
*
Offline Offline

Activity: 26
Merit: 0


View Profile
May 12, 2018, 07:29:51 PM
 #7

I've been able to compile the code and am waiting for it to run, but I have a question:

The characters of my private key are not separated by a "-", I only have 47 alphanumeric characters, in the code should I put my address separated by "-"? If so, what pattern should I adopt to put this "-"?
You have to put a "-" at the place where your private key is missing a character. I'm not sure if the code works with just 4 missing, if it doesn't, you can easily omit one more character.

Example: let's say this is your private key:
5Ht1xbx9coyDSTfpGWn882wdZSwTNmMUzfwd1amRpYUZs8Sv7H9 (do not use this one!)
You miss 4 characters, assuming they are missing at the end, this is what you have:
5Ht1xbx9coyDSTfpGWn882wdZSwTNmMUzfwd1amRpYUZs8S
I suggest to use this for the recovery program:
5Ht1xbx9coyDSTfpGWn882wdZSwTNmMUzfwd1amRpYUZs8-----

I expected the program to run all the cycles until it finishes, but in the end, it does not show me any results, I imagined that it would show me the possible private keys with the missing characters ....

How can I interpret the result at the end of the program?
David Way
Newbie
*
Offline Offline

Activity: 49
Merit: 0


View Profile
May 12, 2018, 08:21:48 PM
 #8

You need to be in Ubuntu: I ran a virtual machine in oracle virtualbox

if you need help doing that follow tutorial(https://linus.nci.nih.gov/bdge/installUbuntu.html)

i used this version of ubuntu (ubuntu-16.04.3-desktop-amd64.iso)

Once you are successfully in Ubuntu (probably works with other linux distributions but this is what i tested) follow these steps

go to documents and create a folder named "bruteforce"

follow this link https://gist.github.com/tayvano/7755e3e8d8b64581d5ff2865087b93f8

click "raw"

right click and select "save page as"

save page in folder "bruteforce" that we just created

Open the .js file you saved in text editor "gedit"

Change the stuff between the ' ' characters to the characters you have of your private key. Check it 5 times to be sure you got the correct characters in there: var basePrivateKey = 'afdfd9c3d2095ef696594f6cedcae59e72dcd697e2a7521b15781404'

Change the stuff between the ' ' characters to your address: var targetPublicAddress = '0x06A85356DCb5b307096726FB86A78c59D38e08ee';

save and exit gedit

open terminal

navigate to brute force folder. This can be done by typing "cd" hitting the space bar, then dragging and dropping the "bruteforce" folder into the terminal, then hitting enter.

now type "sudo apt-get update"

now type "sudo apt-get install nodejs-legacy" and install

now type "sudo apt-get install npm" and install

now type "npm install ethereumjs-wallet" and hit enter

now type "npm install etheruemjs-util" and hit enter

now type "node brute_force_end_of_private_key.js" and hit enter

thats it!

You should see the following:

$ node /Users/tay/Desktop/brute_force_8_char.js

searching for address : 0x06A85356DCb5b307096726FB86A78c59D38e08ee base private key : afdfd9c3d2095ef696594f6cedcae59e72dcd697e2a7521b15781404 missing chars : 8 it will be quiet now. if you don't see anything below me, it's working on finding your key. If you see something below that doesn't say 'FOUND KEY!', you have an error When it's done it will show:

********************************** FOUND PRIVATE KEY: afdfd9c3d2095ef696594f6cedcae59e72dcd697e2a7521b1578140422a4f890 matching address 0x06A85356DCb5b307096726FB86A78c59D38e08ee
Albatroz4402 (OP)
Newbie
*
Offline Offline

Activity: 26
Merit: 0


View Profile
May 12, 2018, 08:56:10 PM
 #9

You need to be in Ubuntu: I ran a virtual machine in oracle virtualbox

if you need help doing that follow tutorial(https://linus.nci.nih.gov/bdge/installUbuntu.html)

i used this version of ubuntu (ubuntu-16.04.3-desktop-amd64.iso)

Once you are successfully in Ubuntu (probably works with other linux distributions but this is what i tested) follow these steps

go to documents and create a folder named "bruteforce"

follow this link https://gist.github.com/tayvano/7755e3e8d8b64581d5ff2865087b93f8

click "raw"

right click and select "save page as"

save page in folder "bruteforce" that we just created

Open the .js file you saved in text editor "gedit"

Change the stuff between the ' ' characters to the characters you have of your private key. Check it 5 times to be sure you got the correct characters in there: var basePrivateKey = 'afdfd9c3d2095ef696594f6cedcae59e72dcd697e2a7521b15781404'

Change the stuff between the ' ' characters to your address: var targetPublicAddress = '0x06A85356DCb5b307096726FB86A78c59D38e08ee';

save and exit gedit

open terminal

navigate to brute force folder. This can be done by typing "cd" hitting the space bar, then dragging and dropping the "bruteforce" folder into the terminal, then hitting enter.

now type "sudo apt-get update"

now type "sudo apt-get install nodejs-legacy" and install

now type "sudo apt-get install npm" and install

now type "npm install ethereumjs-wallet" and hit enter

now type "npm install etheruemjs-util" and hit enter

now type "node brute_force_end_of_private_key.js" and hit enter

thats it!

You should see the following:

$ node /Users/tay/Desktop/brute_force_8_char.js

searching for address : 0x06A85356DCb5b307096726FB86A78c59D38e08ee base private key : afdfd9c3d2095ef696594f6cedcae59e72dcd697e2a7521b15781404 missing chars : 8 it will be quiet now. if you don't see anything below me, it's working on finding your key. If you see something below that doesn't say 'FOUND KEY!', you have an error When it's done it will show:

********************************** FOUND PRIVATE KEY: afdfd9c3d2095ef696594f6cedcae59e72dcd697e2a7521b1578140422a4f890 matching address 0x06A85356DCb5b307096726FB86A78c59D38e08ee

Thanks for the sugestion! But would not this process work there only for the private key of the Ethereum wallet? The private key I'm trying to fix is from Bitcoin wallet.
bob123
Legendary
*
Offline Offline

Activity: 1624
Merit: 2481



View Profile WWW
May 13, 2018, 07:32:35 AM
 #10

I expected the program to run all the cycles until it finishes, but in the end, it does not show me any results, I imagined that it would show me the possible private keys with the missing characters ....

How can I interpret the result at the end of the program?


What kind of output do you get? No at all?

According to the source code (https://pastebin.com/S8WARrRn):
Code:
int c1 = 0, c2 = 0, c3 = 0, c4 = 0, c5 = 0, status;
    float startTime, endTime;
    for (c1 = 0; c1 < 58; c1++) {
        addr[C_1_INDEX] = chars[c1];
        for (c2 = 0; c2 < 58; c2++) {
            addr[C_2_INDEX] = chars[c2];
            printf("Test: %c%c...", chars[c1], chars[c2]);fflush(stdout);
            startTime = (float)clock()/CLOCKS_PER_SEC;
            for (c3 = 0; c3 < 58; c3++) {
                addr[C_3_INDEX] = chars[c3];
                for (c4 = 0; c4 < 58; c4++) {
                    addr[C_4_INDEX] = chars[c4];
                    for (c5 = 0; c5 < 58; c5++) {
                        addr[C_5_INDEX] = chars[c5];
                        status = valid(addr);
                        if (status) {
                            printf("\nFOUND: %s\n", addr);
                            return 1;
                        }
                    }
                }
            }
            endTime = (float)clock()/CLOCKS_PER_SEC;
            printf("%fs\n", (endTime-startTime));
        }
    }


You should get at least the output of the overall time it took to run the script.

If you do see how long it took overall (in source code: printf("%fs\n", (endTime-startTime));) the program went through all combinations and didn't found the correct private key.
If you do NOT see this output the script somehow (1) is not done yet or (2) aborted.

This script requires you to know the exact location of the missing chars. It will iterate through the positions marked with an '-' only.



Thanks for the sugestion! But would not this process work there only for the private key of the Ethereum wallet? The private key I'm trying to fix is from Bitcoin wallet.

Yes, this is only for ethereum.

LoyceV
Legendary
*
Offline Offline

Activity: 3304
Merit: 16599


Thick-Skinned Gang Leader and Golden Feather 2021


View Profile WWW
May 13, 2018, 10:01:27 AM
 #11

I expected the program to run all the cycles until it finishes, but in the end, it does not show me any results, I imagined that it would show me the possible private keys with the missing characters ....

How can I interpret the result at the end of the program?
What kind of output do you get? No at all?
Did you do this:
run it ( ./recovery ), and stop with ctrl+c, you got 5 "index: XX" lines.

Modify the "define C_X_INDEX" lines in the code (line 49-53). Compile again.
Basically, you need to edit and compile the source twice if you follow these instructions. Only on the second run it searches for your own private key.

If you don't mind me asking: how did you lose the characters, and why is the location of the lost characters uncertain? What happened?

Albatroz4402 (OP)
Newbie
*
Offline Offline

Activity: 26
Merit: 0


View Profile
May 13, 2018, 02:39:01 PM
 #12



What kind of output do you get? No at all?

According to the source code (https://pastebin.com/S8WARrRn):
Code:
int c1 = 0, c2 = 0, c3 = 0, c4 = 0, c5 = 0, status;
    float startTime, endTime;
    for (c1 = 0; c1 < 58; c1++) {
        addr[C_1_INDEX] = chars[c1];
        for (c2 = 0; c2 < 58; c2++) {
            addr[C_2_INDEX] = chars[c2];
            printf("Test: %c%c...", chars[c1], chars[c2]);fflush(stdout);
            startTime = (float)clock()/CLOCKS_PER_SEC;
            for (c3 = 0; c3 < 58; c3++) {
                addr[C_3_INDEX] = chars[c3];
                for (c4 = 0; c4 < 58; c4++) {
                    addr[C_4_INDEX] = chars[c4];
                    for (c5 = 0; c5 < 58; c5++) {
                        addr[C_5_INDEX] = chars[c5];
                        status = valid(addr);
                        if (status) {
                            printf("\nFOUND: %s\n", addr);
                            return 1;
                        }
                    }
                }
            }
            endTime = (float)clock()/CLOCKS_PER_SEC;
            printf("%fs\n", (endTime-startTime));
        }
    }


You should get at least the output of the overall time it took to run the script.

If you do see how long it took overall (in source code: printf("%fs\n", (endTime-startTime));) the program went through all combinations and didn't found the correct private key.
If you do NOT see this output the script somehow (1) is not done yet or (2) aborted.

This script requires you to know the exact location of the missing chars. It will iterate through the positions marked with an '-' only.



The algorithm goes through all the cycles and in the end it does not show me any results, not even the total time spent for execution.

I even generated a private key in WIF format (I do not know if this implies some different behavior) to test the algorithm, I hid 5 random characters in the middle and in the end, I compiled twice the code doing the index changes and even then, end of the process, the algorithm also showed no results.

If you don't mind me asking: how did you lose the characters, and why is the location of the lost characters uncertain? What happened?

At the time when I got the private key, I just jotted down the numbers and letters generated for me, I did not back up, and nowhere else, so I'm not sure what characters in which positions were missing ... (I was very noob) .
LoyceV
Legendary
*
Offline Offline

Activity: 3304
Merit: 16599


Thick-Skinned Gang Leader and Golden Feather 2021


View Profile WWW
May 13, 2018, 03:07:04 PM
Last edit: May 14, 2018, 07:50:32 AM by LoyceV
 #13

The algorithm goes through all the cycles and in the end it does not show me any results, not even the total time spent for execution.
Did you use the first program, or the one that also works on compressed keys?

Quote
At the time when I got the private key, I just jotted down the numbers and letters generated for me, I did not back up, and nowhere else, so I'm not sure what characters in which positions were missing ... (I was very noob) .
I don't think it's very likely your missing characters are at the end of the private key. It's also possible you wrote down one (or more) characters incorrectly.

Aren't you missing 5 characters missing instead of 4, if you have 47 only? A quick test shows my uncompressed private keys are 52 51 characters long.

If you don't know the location, you have (approximately) 47^5 possible locations for the missing digits. Multiply that by the number of possibilities per combination, and it quickly becomes impossible to find.
Do you have any idea how much is stored on your address?

Albatroz4402 (OP)
Newbie
*
Offline Offline

Activity: 26
Merit: 0


View Profile
May 13, 2018, 03:56:34 PM
Last edit: May 13, 2018, 04:20:32 PM by Albatroz4402
 #14

Did you use the first program, or the one that also works on compressed keys?

I used the first program. The strangest thing is that even though I was using a private key that I know, hiding 5 characters, I did not get any results = /. Have you used the first program yet and were able to get a result?

Quote
Aren't you missing 5 characters missing instead of 4, if you have 47 only? A quick test shows my private keys are 52 characters long.

Yes you are right, I found that the private keys had 51 characters, but when testing a few others, I noticed that they are 52 characters.


Quote
Do you have any idea how much is stored on your address?
More or less 5 BTC.
LoyceV
Legendary
*
Offline Offline

Activity: 3304
Merit: 16599


Thick-Skinned Gang Leader and Golden Feather 2021


View Profile WWW
May 13, 2018, 06:14:48 PM
 #15

Have you used the first program yet and were able to get a result?
Yes I have used it, and yes it worked for me. But it has to be uncompressed, you can test it with the private key I posted here.

I've just tested it, and I've edited this part of the source code (line 49 and further):
Code:
#define C_1_INDEX 46
#define C_2_INDEX 47
#define C_3_INDEX 48
#define C_4_INDEX 49
#define C_5_INDEX 50

int main (void) {
    const char *chars = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
    char addr[100];
    strcpy(addr, "5Ht1xbx9coyDSTfpGWn882wdZSwTNmMUzfwd1amRpYUZs8-----");

This is the result after many lines:
Code:
Test: Sq...1.940186s
Test: Sr...1.935791s
Test: Ss...1.942627s
Test: St...1.931152s
Test: Su...1.919434s
Test: Sv...
FOUND: 5Ht1xbx9coyDSTfpGWn882wdZSwTNmMUzfwd1amRpYUZs8Sv7H9

If you can reproduce this and it still doesn't work, at least you know it's not the last 5 characters you're missing.

Quote
More or less 5 BTC.
Well, don't give up, ever! If you can't find it now, try again in a few years.

Thirdspace
Hero Member
*****
Offline Offline

Activity: 1232
Merit: 738


Mixing reinvented for your privacy | chipmixer.com


View Profile
May 14, 2018, 04:04:54 AM
Merited by suchmoon (5)
 #16

Quote
Aren't you missing 5 characters missing instead of 4, if you have 47 only? A quick test shows my private keys are 52 characters long.
Yes you are right, I found that the private keys had 51 characters, but when testing a few others, I noticed that they are 52 characters.
uncompressed address has private key of 51 characters base58 and starts with a '5'
compressed address has private key of 52 characters base58 and starts with a 'K' or 'L'
what is the prefix of your private key, runs the program accordingly with 51/52 char space

Quote
More or less 5 BTC.
Well, don't give up, ever! If you can't find it now, try again in a few years.
you should never give up for that amount. if you do give up,... give it up to me  Cheesy Grin

LoyceV
Legendary
*
Offline Offline

Activity: 3304
Merit: 16599


Thick-Skinned Gang Leader and Golden Feather 2021


View Profile WWW
May 14, 2018, 07:53:33 AM
 #17

uncompressed address has private key of 51 characters base58 and starts with a '5'
compressed address has private key of 52 characters base58 and starts with a 'K' or 'L'
Thanks, I stand corrected. It turns out wc ("word count") adds one byte to it's count.

Quote
what is the prefix of your private key, runs the program accordingly with 51/52 char space
This is the basic question indeed now. If you miss 4 characters, it's much more likely to restore them at random places than with 5 characters.

Albatroz4402 (OP)
Newbie
*
Offline Offline

Activity: 26
Merit: 0


View Profile
May 14, 2018, 02:31:40 PM
 #18

Thanks for the great help my friend!

I have not yet tested the algorithm with the code change you made, I'll test it today at the end of the day and post the result here.

The private key starts with 5, so the total would be 51 characters right?
LoyceV
Legendary
*
Offline Offline

Activity: 3304
Merit: 16599


Thick-Skinned Gang Leader and Golden Feather 2021


View Profile WWW
May 14, 2018, 04:11:01 PM
 #19

The private key starts with 5, so the total would be 51 characters right?
Correct.

Albatroz4402 (OP)
Newbie
*
Offline Offline

Activity: 26
Merit: 0


View Profile
May 15, 2018, 06:20:32 PM
 #20

I did another test of the algorithm with my private key and got no feedback ...

But I understood the algorithm and I managed to reproduce a certain result, I used a random private key of 51 characters, the algorithm only shows a result with a private key of 51 characters and if the missing positions are filled exactly in the place of origin, in any other position the algorithm does not give a response with a valid private key.

Unfortunately in my case I have no idea of the positions of the lost characters, but I keep trying, because it has been very useful for me to learn new skills and resources.
Pages: [1] 2 »  All
  Print  
 
Jump to:  

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