Post
Topic
Board Bitcoin Discussion
Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it
by
Mikorist
on 08/12/2022, 14:23:18 UTC
Code:
import os
import time
import base58
import binascii
import secrets
import secp256k1 as ice
from time import sleep

os.system('clear')
t = time.ctime()
print(t, "GOOD LUCK AND HAPPY HUNTING...")

address="1Myn5hoo8pghPZBTTibLjoksVH1k1Fgxmd"
known="L4cgbejhcrqGVwC7qL3owVJSS87zJm53JCpoFokX55"
while True:
    alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"   
    unknown = ''.join(secrets.choice(alphabet) for i in range(10))
    WIF=(f'{known}{unknown}')
    if WIF.startswith('5H') or WIF.startswith('5J') or WIF.startswith('5K') or WIF.startswith('K') or WIF.startswith('L'):
        if WIF.startswith('5H') or WIF.startswith('5J') or WIF.startswith('5K'):
            first_encode = base58.b58decode(WIF)
            private_key_full = binascii.hexlify(first_encode)
            private_key = private_key_full[2:-8]
            private_key_hex = private_key.decode("utf-8")
            dec = int(private_key_hex,16)
                       
        elif WIF.startswith('K') or WIF.startswith('L'):
            first_encode = base58.b58decode(WIF)
            private_key_full = binascii.hexlify(first_encode)
            private_key = private_key_full[2:-8]
            private_key_hex = private_key.decode("utf-8")
            dec = int(private_key_hex[0:64],16)
       
        HEX = "%064x" % dec
        wifc = ice.btc_pvk_to_wif(HEX)
        wifu = ice.btc_pvk_to_wif(HEX, False)
        uaddr = ice.privatekey_to_address(0, False, dec)
        caddr = ice.privatekey_to_address(0, True, dec)
    if caddr.startswith('1Myn5'):
       t = time.ctime()
       print('Time : ', t)
       print('PrivateKey (hex) : ', HEX)
       print('PrivateKey (dec) : ', dec)
       print('PrivateKey (wif) Compressed   : ', wifc)
       print('PrivateKey (wif) UnCompressed : ', wifu)
       print('Bitcoin Address Compressed   = ', caddr)
       print('Bitcoin Address UnCompressed = ', uaddr)
       print("\n continue...\n")
    if caddr == address:
       t = time.ctime()
       print("Winner Found!:",t, caddr, wifc)
       f=open('winner.txt','a')
       f.write('\nTime: ' + t + '\nPrivateKey (hex): ' + HEX + '\nBitcoin Address Compressed : ' + caddr + '\nBitcoin Address UnCompressed :' + uaddr + '\nPrivateKey (wif) Compressed : ' + wifc + '\nPrivateKey (wif) UnCompressed : ' + wifu + '\n==================================')
       f.close()
       sleep(4)
       break

Here is the script. It's fast as hell on my machine.
An example.
Address: "1Myn5hoo8pghPZBTTibLjoksVH1k1Fgxmd"
Part of the key "L4cgbejhcrqGVwC7qL3owVJSS87zJm53JCpoFokX55"

Last 10 characters are missing - about 5 seconds - or was this a lucky combination. Grin