Post
Topic
Board Bitcoin Discussion
Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it
by
nomachine
on 27/10/2023, 19:17:28 UTC
reduce all of the additional hex keys i am searching for.

Code:
import os, random, secrets, hashlib, ecdsa

# List of target Hash 160 values to search for
target_public_key_hashes = [
    bytes.fromhex('20d45a6a762535700ce9e0b216e31994335db8a5'),
    bytes.fromhex('739437bb3dd6d1983e66629c5f08c70e52769371'),
    bytes.fromhex('e0b8a2baee1b77fc703455f39d51477451fc8cfc'),
    bytes.fromhex('61eb8a50c86b0584bb727dd65bed8d2400d6d5aa'),
    bytes.fromhex('f6f5431d25bbf7b12e8add9af5e3475c44a0a5b8'),
]
# Open a file for writing the found matches
with open('found_matches.txt', 'w') as output_file:
    while True:
        dec = secrets.SystemRandom().randrange(36893488147419103231, 2361183241434822606847)
        private_key_bytes = (b'\x00' * 32)[:-len(dec.to_bytes((dec.bit_length() + 7) // 8, 'big'))] + dec.to_bytes((dec.bit_length() + 7) // 8, 'big')
        signing_key = ecdsa.SigningKey.from_string(private_key_bytes, curve=ecdsa.SECP256k1)
        h160 = hashlib.new('ripemd160', hashlib.sha256(signing_key.get_verifying_key().to_string("compressed")).digest()).digest()
        h160_hex = h160.hex()       
        if h160_hex.startswith(('20d45a', '739437', 'e0b8a2', '61eb8a', 'f6f543')):
            print(h160_hex, dec)
            if h160 in target_public_key_hashes:
                match_str = f"Found match with hash {dec}\n"
                print(match_str)
                output_file.write(match_str)
                target_public_key_hashes.remove(h160)  # Remove the found hash from the list
                if not target_public_key_hashes:
                    print("All target hashes found.")
                    break

There is no limit and way someone can search for a puzzle. It's like art. Mostly worthless art collection.  Grin