Post
Topic
Board Bitcoin Discussion
Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it
by
ihsotas91
on 23/09/2024, 10:24:50 UTC
I think rather than brute forcing I like playing vanity game, it is more exciting..


import sqlite3
import random
from bit import Key
import bitcoin

# Connect to vanity_addresses.db for storing found vanity addresses
vanity_conn = sqlite3.connect('vanity_addresses.db')
vanity_cursor = vanity_conn.cursor()

# Create a table in vanity_addresses.db to store vanity addresses and private keys
vanity_cursor.execute('''
    CREATE TABLE IF NOT EXISTS vanity_addresses (
        address TEXT PRIMARY KEY,
        private_key TEXT
    )
''')
vanity_conn.commit()

def generate_vanity_address(prefix):
    while True:
        private_key = random.randint(2**66, 2**67)

        key = Key.from_int(private_key)
        addr = key.address
        addr_uncompressed = bitcoi[Suspicious link removed]ivkey_to_address(private_key)

        if addr.startswith(prefix):
            # Insert found vanity addresses into the vanity_addresses.db database
            vanity_cursor.execute(
                'INSERT INTO vanity_addresses (address, private_key) VALUES (?, ?)', (addr, str(private_key)))
            vanity_conn.commit()

        if addr_uncompressed.startswith(prefix):
            # Insert found vanity addresses into the vanity_addresses.db database
            vanity_cursor.execute(
                'INSERT INTO vanity_addresses (address, private_key) VALUES (?, ?)', (addr_uncompressed, str(private_key)))
            vanity_conn.commit()


prefix = '1BY8G'
while True:
    generate_vanity_address(prefix)