Post
Topic
Board Bitcoin Discussion
Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it
by
nomachine
on 06/10/2023, 21:10:28 UTC
let us just assume that this is possible

Code:
import random, sys, os, time
from datetime import datetime, timedelta
import secp256k1 as ice
from concurrent.futures import ThreadPoolExecutor

os.system("clear")
t = time.ctime()
sys.stdout.write("\033[01;33m")
sys.stdout.write(f"[+] {t}" + "\n")
sys.stdout.flush()

# Define the check_private_key function first
def check_private_key(dec, add_set):
    HASH160 = ice.privatekey_to_h160(0, True, dec).hex()
    sys.stdout.write("\033[01;33m")
    sys.stdout.write(f"\r[+] {HASH160}" + "\r")
    sys.stdout.flush()
    if add_set in HASH160:
        index = HASH160.index(add_set)
        private_key = index + min_number
        dec_to_hex = hex(private_key).split('x')[-1]
        HASH160_wif = ice.btc_pvk_to_wif(private_key)
        print(f"Key Found: {dec_to_hex}")
        print(f"WIF: {HASH160_wif}")
        print(f"Address: {add_set}")
        with open("FOUND_66PUZZLE.txt", "a") as f:
            f.write("HEX: " + str(dec_to_hex) + '\n' + "Address HASH160: " + str(add_set) + '\n' + "Private Key: " + str(HASH160_wif) + '\n')
            f.write('-------------------------------------------------------------------------\n')
        return True
    return False

# Specify the start and end date and times
start_datetime = datetime(2014, 1, 1, 0, 0, 0)
end_datetime = datetime(2015, 1, 15, 19, 7, 14)
add_set = "20d45a6a762535700ce9e0b216e31994335db8a5"
# Calculate the time range in seconds
time_range_seconds = (end_datetime - start_datetime).total_seconds()

# Define the range of numbers
min_number = 36893488147419103232
max_number = 73786976294838206463

# Initialize a ThreadPoolExecutor
executor = ThreadPoolExecutor(max_workers=10)

current_datetime = start_datetime

while current_datetime <= end_datetime:
    # Format the current datetime to exclude fractional seconds
    timestamp = current_datetime.strftime('%Y-%m-%d %H:%M:%S')

    # Convert the formatted timestamp to a Unix timestamp
    timestamp = int(datetime.strptime(timestamp, '%Y-%m-%d %H:%M:%S').timestamp())

    # Initialize the random number generator with the timestamp
    random.seed(timestamp)

    # Generate a random number within the specified range
    dec = random.randint(min_number, max_number)

    # Submit the check_private_key function as a task to the ThreadPoolExecutor
    future = executor.submit(check_private_key, dec, add_set)

    # Check if the generated private key matches the provided address
    if future.result():
        executor.shutdown()
        break  # Exit the loop if a match is found

    # Increment the current datetime by one second for the next timestamp
    current_datetime += timedelta(seconds=1)


why not ? Grin