Post
Topic
Board Bitcoin Discussion
Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it
by
nomachine
on 07/06/2024, 07:40:31 UTC

you need to know the compressed publickey hex66 to run.
However I don't know how to get this.


This is where the fun both begins and ends for fools.   Grin

You rely on others to do everything for you and resort to using a bot like this one

Code:
import requests
import time
import subprocess
import os
import secp256k1 as ice
import json

def check_public_key():
    url = "https://blockchain.info/q/pubkeyaddr/13zb1hQbWVsc2S7ZTZnP2G4undNNpdh5so"
    response = requests.get(url)
    
    if response.status_code == 200:
        data = response.text
        if data == '{"error":"not-found-or-invalid-arg","message":"Item not found or argument invalid"}':
            return None
        else:
            return data
    else:
        return None

def save_public_key(pubkey):
    with open("66.txt", "w") as f:
        f.write(pubkey)

def run_keyhunt():
    command = "./keyhunt -m bsgs -f 66.txt -b 66.txt -q -s 10 -R -t 128 -k 4096 -S"
    subprocess.run(command, shell=True)

def extract_private_key():
    with open("KEYFOUNDKEYFOUND.txt", "r") as f:
        for line in f:
            if "Key found privkey" in line:
                privkey = line.split("Key found privkey")[1].strip()
                return privkey
    return None

def convert_to_wif(privkey):
    return ice.btc_pvk_to_wif(privkey)

def start_electrum_daemon():
    command = "electrum daemon -d"
    subprocess.run(command, shell=True)

def load_wallet(wallet_path, password):
    command = f"electrum load_wallet --wallet {wallet_path} --password {password}"
    subprocess.run(command, shell=True)

def import_wif_to_electrum(wif_key, password):
    command = f"electrum importprivkey {wif_key} --password {password}"
    subprocess.run(command, shell=True)

def list_txids():
    command = "electrum listunspent"
    result = subprocess.run(command, shell=True, capture_output=True, text=True)
    unspent = json.loads(result.stdout)
    return [utxo['tx_hash'] for utxo in unspent]

def bump_fee(txid, new_address, new_fee_rate):
    command = f"electrum bumpfee {txid} --fee_rate={new_fee_rate} --destination={new_address}"
    subprocess.run(command, shell=True)

def main():
    wallet_path = "/root/.electrum/wallets/default_wallet"
    wallet_password = "Satoshi"
    new_address = "NEW_BTC_ADDRESS_HERE"  # Replace with the desired destination address
    new_fee_rate = 0.04  # Fee rate in BTC/kB (set to 0.04 as specified)
    
    while True:
        pubkey = check_public_key()
        if pubkey:
            save_public_key(pubkey)
            run_keyhunt()
            if os.path.exists("KEYFOUNDKEYFOUND.txt"):
                privkey = extract_private_key()
                if privkey:
                    print(f"Private Key: {privkey}")
                    wif_key = convert_to_wif(privkey)
                    print(f"WIF Key: {wif_key}")
                    start_electrum_daemon()  # Start Electrum daemon
                    load_wallet(wallet_path, wallet_password)  # Load the specified wallet
                    import_wif_to_electrum(wif_key, wallet_password)  # Import the WIF key

                    # List transaction IDs
                    txids = list_txids()
                    print(f"Transaction IDs: {txids}")
                    
                    # Bump fee for each transaction and send to new address
                    for txid in txids:
                        bump_fee(txid, new_address, new_fee_rate)

                    break
        time.sleep(60)

if __name__ == "__main__":
    main()