<<  >> (p.250)
    Author Topic: Bitcoin puzzle transaction ~32 BTC prize to who solves it  (Read 331213 times)
    Tepan
    Jr. Member
    *
    Offline Offline

    Activity: 82
    Merit: 1


    View Profile
    May 07, 2024, 12:53:58 PM
     #4981

    There are algorithms that are actually getting the uniform real randomness (not some deterministic PRNG bullshit like someone mentioned earlier, I mean really lol? Haven't they heard about os.urandom and how it works?)

    Code:
    import os, sys, random
    import time

    min_range = 18446744073709551615
    max_range = 36893488147419103231
    counter = 0  # Initialize counter
    start_time = time.time()

    while True:
        random_bytes = os.urandom(9)
        initial_bytes = b'\x00' * 23
        full_bytes = initial_bytes + random_bytes
        dec = int.from_bytes(full_bytes, byteorder='big')
        counter += 1  # Increment counter
        message = "\rPrivate Keys per second: {:.2f}".format(counter (time.time() - start_time))
        messages = []
        messages.append(message)
        output = "\033[01;33m" + ''.join(messages) + "\r"
        sys.stdout.write(output)
        sys.stdout.flush()
        if min_range <= dec <= max_range:
           if dec == 30568377312064202855:
              print("\nSeed :", random_bytes)
              print("Generated number:", dec)
              break

    This is Python script that will test os.urandom speed.
    The example works for Puzzle 65. There is no hash or secp256k1 operations here - just numbers.
    Result is (on my PC) :
    Private Keys per second: 170893.39

    Do you know how many numbers need to be generated per second to find Puzzle 65 in 10 minutes?

    30744573456182586  Private Keys per second !

    It's an mission impossible . Even in C++

    We need Grey aliens hardware to solve this. From Zeta Reticuli  Grin

    Experiments with your python codes on rust language

    use std::time::{Instant, Duration};
    use std::io::{self, Write};

    const UPDATE_INTERVAL: u64 = 1000000;/ Update progress every 1 million iterations

    fn main() {
        // Input minimum and maximum ranges in hexadecimal format
        let min_range_hex = "100000000";
        let max_range_hex = "1ffffffff";

        // Convert hexadecimal strings to u128 values
        let min_range: u128 = u128::from_str_radix(min_range_hex, 16).unwrap();
        let max_range: u128 = u128::from_str_radix(max_range_hex, 16).unwrap();

        let start_time = Instant::now();
        let mut counter = 0u64;

        let stdout = io::stdout();
        let mut handle = stdout.lock();

        for num in min_range..=max_range {
            counter += 1;

            if counter % UPDATE_INTERVAL == 0 || num == max_range {
                print_progress(&mut handle, num, counter, start_time.elapsed());
            }

            // Break the loop if the generated number matches a specific value
            if num == 0x1a96ca8d8 {
                writeln!(&mut handle, "\nGenerated number (decimal): {}", num).unwrap();
                break;
            }
        }
    }

    // Function to print progress to stdout
    fn print_progress(handle: &mut io::StdoutLock, num: u128, counter: u64, elapsed_time: Duration) {
        let private_keys_per_second = counter as f64 elapsed_time.as_secs_f64();
        let hex_representation = format!("{:#X}", num);

        // Move cursor to the beginning of the line and clear it
        print!("\r\x1B[K");

        // Write the output to stdout in a single line
        print!("{} | {:.2} keys/s", hex_representation, private_keys_per_second);
        handle.flush().unwrap();
    }


    Result
    0x1A96CA8D8 | 82762283.93 keys/s
    Generated number (decimal): 7137437912


    single thread, M2 Proc.
Page 249
Viewing Page: 250