Post
Topic
Board Bitcoin Discussion
Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it
by
nomachine
on 07/05/2024, 03:50:38 UTC
Here's the reality: /dev/urandom is not a secure random number generator.

What kind of security are you talking about when we a brute-force  BTC here?
I want to crack the random generator not to improve it !
To break down random.seed. Here is example

Code:
import random
import os
import time
import secp256k1 as ice

puzzle = 30
target = "d39c4704664e1deb76c9331e637564c257d68a08"
lower_range_limit = 2 ** (puzzle - 1)
upper_range_limit = (2 ** puzzle) - 1

start_time = time.time()

for x in range(1000000):
    constant_prefix = b'yx\xcb\x08\xb70l'
    prefix_length = len(constant_prefix)
    length = 8
    ending_length = length - prefix_length
    ending_bytes = os.urandom(ending_length)
    random_bytes = constant_prefix + ending_bytes
    random.seed(random_bytes)
    dec = random.randint(lower_range_limit, upper_range_limit)
    caddr = ice.privatekey_to_h160(0, True, dec).hex()
    if caddr == target:
        print(caddr, dec)
        print(random_bytes)
        break

end_time = time.time()
execution_time_ms = (end_time - start_time) * 1000

print("Execution Time (ms):", execution_time_ms)

This is a millisecond puzzle 30 solver.

d39c4704664e1deb76c9331e637564c257d68a08 1033162084
b'yx\xcb\x08\xb70l\xf1'
Execution Time (ms): 2.8727054595947266