Post
Topic
Board Development & Technical Discussion
Re: I created smaller secp256k1 just for testing
by
jovica888
on 20/02/2025, 20:29:54 UTC
I am not sure about the method where we put gaps between points in the babystep file because there is infinity point so after infinity point all points are moved by 1 so if you jump 600.000.000 keys per jump and you have only 300.000.000 points in BS file I am not sure that it will find a solution because other half of points are moved by 1

In regular BSGS that must work - it does not work only in case if you hit the infinity point when you jump for 600.000.000 keys... But I think the chances for that are small

I have only this code for generating lines
When I generate 300.000.000 keys I take only first 16 characters for matching. It is a simple code and can be improved on many ways. I am not so good at python I was working with PHP like 15 years

Code:
import secp256k1 as ice
import os

# Starting point
P = ice.pub2upub('02145d2611c823a396ef6712ce0f712f09b9b4f3135e3e0aa3230fb9b6d08d1e16')

batch_size = 30_000_000
max_lines = 300_000_000
babystep_file = "babystep.txt"

if os.path.exists(babystep_file):
    with open(babystep_file, "r") as f:
        line_count = sum(1 for _ in f)
else:
    line_count = 0

with open(babystep_file, "a") as f:
    while line_count < max_lines:
        print(f"Generating {batch_size} BSGS points...")
        bsgs_batch = ice.point_sequential_increment(batch_size, P)
       
        for i in range(batch_size):
            hex_string = bsgs_batch[i * 65: i * 65 + 65].hex()
            x_hex = hex_string[2:18] 
            f.write(f"{x_hex}\n")
            line_count += 1
           
            if line_count >= max_lines:
                break
       
        P = ice.pub2upub(bsgs_batch[-65:].hex())
        print(f"Current generating: {line_count}/{max_lines} lines.")

print("Generating of 300.000.000 lines completed.")