Post
Topic
Board Bitcoin Discussion
Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it
by
Jolly Jocker
on 23/10/2022, 14:14:13 UTC
Quote
Using python or any high level language to do heavy computations is trouble .. cracking is better coded with c/cpp/golang/java .. but thank you a lot for sharing your code

Thanks very much! Wink

maybe this coder suits you better... have fun! Smiley

Code:
# * coding: utf-8 * Python 3.9(64-bit)
"""
author: JollyJocker
"""

import time
import random
import secp256k1 as ice
from time import sleep
from multiprocessing import Process, Queue, cpu_count, freeze_support

core = 4
group_size = 0x100000

def counter():
    total=0
    return total

def hunt_BTC_address(cores='all'):

    available_cores = cpu_count()

    if cores == 'all':
        cores = available_cores
    elif 0 < int(cores) <= available_cores:
        cores = int(cores)
    else:
        cores = 1

    queue = Queue()

    workers = []
    for r in range(cores):
        p = Process(target=generate_key_address_pairs, args=(counter, queue, r))
        workers.append(p)
        p.start()

    for worker in workers:
        worker.join()

def generate_key_address_pairs(counter, queue, r):
    st = time.time()
    cnt = counter()
    while True:
        a = 0x20000000000000000
#       x = random.uniform(1.01, 2.00)
        x = random.triangular(1.000, 1.500, 2.001)
        key_int = int(a * x)

        P = ice.scalar_multiplication(key_int)
        current_pvk = key_int + 1
           
        Pv = ice.point_sequential_increment(group_size, P)

        for t in range(group_size):
            this_btc = ice.pubkey_to_address(0, True, Pv[t*65:t*65+65])
           
            cnt += 1 * core
           
            if this_btc.startswith('13zb1h'): # 13zb1hQ
                l = [hex(current_pvk+t)[2:], this_btc]
                queue.put(l)
                results = queue.get()
                print('\n\n', results, '\n')
               
                if this_btc == '13zb1hQbWVsc2S7ZTZnP2G4undNNpdh5so':
                    file=open(u"BTC.Target.Info.txt","a")
                    file.write('\n ' + hex(current_pvk+t) + '| ' + this_btc)
                    file.close()
                    sleep(1)
                    exit()
       
            if (cnt) % group_size == 0:           
                print(' ', hex(current_pvk+t), ' {0:.20f}'.format(x),'', str(cnt).zfill(13),' [ {1:.2f} Keys/s ] '.format(cnt, cnt/(time.time() - st)), end='\r')

       
        P = Pv[-65:]
        current_pvk += group_size


if __name__ == '__main__':
    freeze_support()
    print('\n |======SOURCE=======||===== MULTIPLIER =====||=====CNT=====||=======SPEED========|\n\n')
    hunt_BTC_address(cores = core)