1

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)
4
  • 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
    Commented May 29, 2022 at 20:36
  • 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 Commented May 30, 2022 at 7:05
  • What makes the options "incorrect"?
    – m1xolyd1an
    Commented May 31, 2022 at 23:08
  • The source-code is from How can I recover the missing end of my private key? - 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. Commented Jun 1, 2022 at 8:45

1 Answer 1

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.

1
  • 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. Commented Nov 27, 2022 at 22:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.