-1

This is my story: Several years ago I splitted my bitcoin private key to keep it safe in different places. I lost one part and think I lost my mined bitcoin forever.

Suddenly (I think you understand why) I decided to start searching for any parts and I found 3 of 6!!!!

So for now I have the start(Lets say "5Lagt") and the end("Bh3u2YHU2ntQAFTruAYGhJ1xacPJXr3l6k") so I need to find just 10 alfanumeric chars between.

I am pretty new to programming, but have some basics in Python and C from university.

I have read that the last symbols in WIF compressed private key is a checksum.

So as I understand in pseudo code I need to do following stuff

  • Decode the private key to hex format (this 08+..........+checksum)
  • exclude 08 and the checksum
  • generate the lost part (encode or decode it somehow??)
  • compare the first bytes (what bytes?) with the checksum

I partly understand it theoretically but not practically. I would love to give 10% of bitcoins on the wallet if I get it back!

  • 1
    While I have no reason to doubt the OP's intentions are pure I feel like this could easily be nefarious. Moderator intervention? – bendl Dec 18 '17 at 15:37
  • This is probably not the best place for such question. This site is only used to get help if you get stuck somewhere. But can't do everything for you – saud Dec 18 '17 at 15:38
  • 2
    I mean I dont want you to get all things done for me. The main question for me is this encoding? decoding? What should I do with that? How to decode the WIF key into hex and how to get this checksum to compare? – B1tco1nNewb1e Dec 18 '17 at 15:45
  • There is some code on this Question: https://bitcoin.stackexchange.com/questions/25024/how-do-you-get-a-bitcoin-public-key-from-a-private-key, maybe you can better specify your question after looking at this (or already answer it). – hotfire42 Dec 18 '17 at 16:13
  • 2
    I'm voting to close this question as off-topic because http://bitcoin.stackexchange.com would be a better location – KevinDTimm Dec 18 '17 at 16:45
  • I had this same problem. If you have most of the front of the private key you might be able to recover it. – Auburnate Aug 14 '19 at 18:31

1 Answers1

0

Take that quick sketch of checksum checking, hope it'll guide you in a right direction:

import base58
import hashlib

def check_wif(wif):
    """WIF checksum checking.
    Install base58 before use: `pip install base58`

    >>> check_wif('5HueCGU8rMjxEXxiPuD5BDku4MkFqeZyd4dZ1jvhTVqvbTLvyTJ')
    True
    """
    try:
        wif_bytes = base58.b58decode(wif)
        if wif_bytes[0] != 128:
            return False
        wif_bytes_no_chksum, chksum = wif_bytes[:-4], wif_bytes[-4:]
        wif_bytes_sha256_1 = hashlib.sha256(wif_bytes_no_chksum)
        wif_bytes_sha256_2 = hashlib.sha256(wif_bytes_sha256_1.digest())
        if wif_bytes_sha256_2.digest()[:4] == chksum:
            return True
        else:
            return False
    except ValueError:
        return False

In general python is too slow for that kind of task as I can tell.

9dogs
  • 1,446
  • 10
  • 18