Post
Topic
Board Bitcoin Discussion
Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it
by
albert0bsd
on 21/07/2024, 03:26:43 UTC
Alberto, you did not broadcast the transaction in Mempool. Can you explain to us what you did? Although your transaction was sent later on the main network (not through Mempool), it was confirmed.

What are you talking about? All TX pass thought mempool (Unless you mine the block)

What I did

1.- retrieve the public key from the mempool transaction (https://mempool.space/docs/api/rest#get-address-transactions-mempool)
2.- get the privatekey with keyhunt (bsgsd daemon https://github.com/albertobsd/keyhunt/blob/main/BSGSD.md )
3.- create a new TX with the UTXO (https://bitcoinlib.readthedocs.io/en/latest/  https://github.com/1200wd/bitcoinlib/blob/master/examples/transactions.py )
4.- broadcast the TX withthe mempool.space API  ( https://mempool.space/docs/api/rest#post-transaction )

All previous point were done full automated with python

Some considerations
2.- I scan from 0x1 to 0x3ffffffffffffffff to avoid previous mistakes of private keys in lower ranges, so It took me twice the amount of time needed to crack the privatekey (It was less than a minute)

4.- I should add some other API provider to broadcast transactions just to add redundancy

The code for broadcast in python using requests

Code:
#Current function
def broadcast_transaction(raw_tx):
    try:
        url = ""
        if networkname=="bitcoin":
            url = "https://mempool.space/api/tx"
        elif networkname=="testnet":
            url = "https://mempool.space/testnet/api/tx"
        else:
            print("Unknow network")
            exit()
        response = requests.post(url, data=raw_tx)
        return response.text
    except requests.exceptions.RequestException as e:
        print(f"error {str(e)}")
        return ""

#Next is just an example, not the actual code.

networkname= 'bitcoin'
RAWTX = "010000000120e57c9717271536b9623703c14ed29b40c98c3c28f2667935f3d63897fae33e000000006a473044022068357d38b55b987e139ce069de456cb399b04f37861879bb7e425ef84b11816a0220425c3fb1c6fa90ca1d7ab6971375a94d62e36a49041d7cfda338d51f4169a08e0121029fd3d2479a37f40d03975cb51ce0fa18cbb709cc46b47caeaa1722cfd3683583ffffffff011821070000000000160014c0f3278346024832e71d25a24d5ae4b73885f85d00000000"
value = broadcast_transaction(RAWTX)
#Need to evaluate value to check if the TX was successful or not