<p>If you lost last 10 characters from <strong>uncompressed</strong> private key. The number of possible combinations to check is around 58<sup>5</sup>, not just 58 keys like that code above. You need another Python libs to convert all possible uncompressed private key to Bitcoin legacy address until it find your 'missing key' address.</p>

CC BY-SA 4.0
2022-11-27T22:41:50.963Z
More exact:  58^10 / 2^32 -> 26.6 bits.  So computationally that is certainly doable, probably something like an hour of cpu time or so.
Willem Hengeveld
CC BY-SA 4.0
2022-10-25T11:20:07.330Z
2022-10-28T18:16:44.997Z
2022-10-28T18:16:44.997Z
Romo
<p>I have a part of an UNCOMPRESSED private key. Starts at 5, missing 10 characters at the end. I saw the code on this forum and used it in python. But when working with my key, it gives out 2 incorrect options. I think the thing is that the code is written for a compressed key, since I checked on a compressed private key and it worked. What can I do?</p>
<pre><code>
import base58, sys

partial = sys.argv[1]

if len(partial) != 45:
    print(&quot;partial key should be 45 characters&quot;)
    sys.exit(1)

results = {}
for c in '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz':
    wif = base58.b58encode_check(base58.b58decode(partial + c*7)[:33] + b'\x01').decode('ascii')
    if wif[:45] == partial: results[wif] = True

for k in results.keys(): print(k)
</code></pre>

CC BY-SA 4.0
2022-05-29T20:36:03.980Z
What do you mean it gives 2 incorrect options? It will probably give you lots of incorrect guesses. When you are missing 10 characters from a base58 key the number of possible combinations to check is very large.
m1xolyd1an
CC BY-SA 4.0
2022-05-30T07:05:08.883Z
when I run this script with my UNCOMPRESSED key, it gives 2 incorrect options. But when I take the COMPRESSED KEY, this script gives 2 options, 1 of which is completely suitable. @m1xolyd1an
Tasty Fruit
CC BY-SA 4.0
2022-05-31T23:08:12.903Z
What makes the options "incorrect"?
m1xolyd1an
CC BY-SA 4.0
2022-06-01T08:45:40.093Z
The source-code is from [How can I recover the missing end of my private key?](https://bitcoin.stackexchange.com/q/98944/13866) - it would have been best to include this link in the question. From the detailed answer there you should be able to make the necessary changes.
RedGrittyBrick
<private-key><recover-private-key>
How can I recover my private key?
Tasty Fruit
# How can I recover my private key?

(Asked by: username_0 on 2022-05-29)

I have a part of an UNCOMPRESSED private key. Starts at 5, missing 10 characters at the end. I saw the code on this forum and used it in python. But when working with my key, it gives out 2 incorrect options. I think the thing is that the code is written for a compressed key, since I checked on a compressed private key and it worked. What can I do?

```

import base58, sys

partial = sys.argv[1]

if len(partial) != 45:
    print("partial key should be 45 characters")
    sys.exit(1)

results = {}
for c in '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz':
    wif = base58.b58encode_check(base58.b58decode(partial + c*7)[:33] + b'\x01').decode('ascii')
    if wif[:45] == partial: results[wif] = True

for k in results.keys(): print(k)

```

**Tags:** private-key, recover-private-key

> **Comments:**
> **username_1**: What do you mean it gives 2 incorrect options? It will probably give you lots of incorrect guesses. When you are missing 10 characters from a base58 key the number of possible combinations to check is very large.  
> **username_0**: when I run this script with my UNCOMPRESSED key, it gives 2 incorrect options. But when I take the COMPRESSED KEY, this script gives 2 options, 1 of which is completely suitable. @username_1  
> **username_1**: What makes the options "incorrect"?  
> **username_2**: The source-code is from [How can I recover the missing end of my private key?](https://bitcoin.stackexchange.com/q/98944/13866) - it would have been best to include this link in the question. From the detailed answer there you should be able to make the necessary changes.  

---

## 1 answers

### Answer by username_3 on 2022-10-25. Score: 1

If you lost last 10 characters from **uncompressed** private key. The number of possible combinations to check is around 585, not just 58 keys like that code above. You need another Python libs to convert all possible uncompressed private key to Bitcoin legacy address until it find your 'missing key' address.

> **Comments:**
> **username_4**: More exact:  58^10 / 2^32 -> 26.6 bits.  So computationally that is certainly doable, probably something like an hour of cpu time or so.  

---

