Python script for the 71 BTC puzzle, generating thousands of keys per second randomly! Better than the lottery 🔥
import multiprocessing
import sys
import os
import hashlib
from time import time
from coincurve import PrivateKey
Configurações
TARGET_ADDRESS = "1PWo3JeB9jrGwfHDNpdGK54CRas7fsVzXU"
START_RANGE = int("400000000000000000", 16)
END_RANGE = int("7fffffffffffffffff", 16)
NUM_PROCESSES = 1
CHECKPOINT_DIR = "checkpoints"
RESULT_FILE = "achei_a_bendita.txt"
CHECKPOINT_INTERVAL = 10_000 # salvar a cada 10 mil chaves
if not os.path.exists(CHECKPOINT_DIR):
os.makedirs(CHECKPOINT_DIR)
def base58encode(b):
alphabet = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
num = int.from_bytes(b, 'big')
encode = ''
while num > 0:
num, rem = divmod(num, 58)
encode = alphabet[rem] + encode
pad = 0
for byte in b:
if byte == 0:
pad += 1
else:
break
return '1' * pad + encode
def private_key_to_wif(private_key_int, compressed=True):
privkey_bytes = private_key_int.to_bytes(32, 'big')
prefix = b'\x80' + privkey_bytes
if compressed:
prefix += b'\x01'
checksum = hashlib.sha256(hashlib.sha256(prefix).digest()).digest()[:4]
return base58encode(prefix + checksum)
def save_result(private_key_int, address):
wif = private_key_to_wif(private_key_int)
with open(RESULT_FILE, "a") as f:
f.write(f"Private Key: {hex(private_key_int)} (WIF: {wif}) - Address: {address}\n")
def get_checkpoint(process_id):
path = os.path.join(CHECKPOINT_DIR, f"checkpoint_{process_id}.txt")
if os.path.exists(path):
with open(path, "r") as f:
return int(f.read().strip())
return None
def save_checkpoint(process_id, key_int):
path = os.path.join(CHECKPOINT_DIR, f"checkpoint_{process_id}.txt")
with open(path, "w") as f:
f.write(str(key_int))
def search_sequential(process_id, start, end, target_address, progress_queue):
checkpoint = get_checkpoint(process_id)
if checkpoint and start <= checkpoint < end:
current = checkpoint
else:
current = start
keys_checked = 0
start_time = time()
try:
for key_int in range(current, end):
priv = PrivateKey.from_int(key_int)
pubkey = priv.public_key.format(compressed=True)
h160 = hashlib.new('ripemd160', hashlib.sha256(pubkey).digest()).digest()
address_bytes = b'\x00' + h160
checksum = hashlib.sha256(hashlib.sha256(address_bytes).digest()).digest()[:4]
address = base58encode(address_bytes + checksum)
if address == target_address:
print(f"\n✅ Encontrado pelo processo {process_id}: {hex(key_int)}")
save_result(key_int, address)
progress_queue.put(None) # sinal para parar todos
return
keys_checked += 1
if keys_checked % CHECKPOINT_INTERVAL == 0:
save_checkpoint(process_id, key_int)
elapsed = time() - start_time
progress_queue.put((keys_checked, elapsed))
except Exception as e:
print(f"Erro no processo {process_id}: {e}")
finally:
elapsed = time() - start_time
progress_queue.put((keys_checked, elapsed))
save_checkpoint(process_id, key_int)
def format_number(n):
return f"{n:,}".replace(",", ".")
def monitor_progress(total_keys, progress_queue):
keys_checked = 0
start_time = time()
while True:
message = progress_queue.get()
if message is None:
break
keys, elapsed = message
keys_checked += keys
progress = (keys_checked / total_keys) * 100
speed = keys_checked / elapsed if elapsed > 0 else 0
remaining = total_keys - keys_checked
time_remaining = remaining / speed if speed > 0 else float('inf')
sys.stdout.write(
f"\r🔍 Verificadas: {format_number(keys_checked)}/{format_number(total_keys)} ({progress:.6f}%) | "
f"Velocidade: {format_number(int(speed))} chaves/s | Restante: {time_remaining / 60:.2f} min"
)
sys.stdout.flush()
print("\n✔ Finalizado.")
def parallel_search():
total_range = END_RANGE - START_RANGE
chunk_size = total_range // NUM_PROCESSES
total_keys = chunk_size * NUM_PROCESSES
processes = []
queue = multiprocessing.Queue()
for i in range(NUM_PROCESSES):
chunk_start = START_RANGE + i * chunk_size
chunk_end = chunk_start + chunk_size if i < NUM_PROCESSES - 1 else END_RANGE
p = multiprocessing.Process(target=search_sequential, args=(i, chunk_start, chunk_end, TARGET_ADDRESS, queue))
processes.append(p)
p.start()
monitor_progress(total_keys, queue)
for p in processes:
p.terminate()
if name == "main":
parallel_search()
Just copy and paste! Good luck!
If you find the key and would like to make a donation: 12QmzvUKqNcrXYvXw7oLywyfp9gTFgbNLJ