Post
Topic
Board Development & Technical Discussion
Re: I created smaller secp256k1 just for testing
by
jovica888
on 22/02/2025, 02:49:02 UTC
I also have another Idea like a Kangaroo that will use the infinity point as a referent point so the kangaroo will jump from the public key up and we will save X values of those points when the code jumps over the infinity point then the kangaroo will basically start jumping back because X values now have order in backward... and then when you find collision with itself you can calculate the private key

Code:
priv_key = (n - (G_added - G_at_collision) // 2 - G_at_collision) % n

So in my code I was looking for private key of

03440daba3905488f1b5ad2186f6ce2e9a9fe69327ac975dba1a93f8ed60d7813d

I know that private key is < n/2 so I took the even Y value to have a point > n/2

here is the code

Code:
import ecdsa
from ecdsa.ellipticcurve import Point
import time

# Parameters of the secp256k1 elliptic curve
curve = ecdsa.curves.SECP256k1.curve
G = ecdsa.curves.SECP256k1.generator
n = ecdsa.curves.SECP256k1.order

# Initial point
X = 0x440daba3905488f1b5ad2186f6ce2e9a9fe69327ac975dba1a93f8ed60d7813d
Y = 0x9d656a2ee1049d7bf9c4b48c4df47e92115b0a479c60ba1034c9c2e7a39d2f0c

P = Point(curve, X, Y)

visited_x = {}  # Store X coordinates in RAM
G_added = 0  # Total G added
start_time = time.time()  # Start time
last_print_time = start_time  # Track last print time
iteration = 0  # Track current iteration

while True:
    last5 = X & 0xFFFFF  # Last 7 digits of X-axis
    step = last5 + 1  # Step size
    P = P + step * G  # Jump forward
    X = P.x()
    G_added += step
    iteration += 1
   
    current_time = time.time()
    if current_time - last_print_time >= 5:
        print(f"Total G added: {hex(G_added)}, Current Iteration: {iteration}, Current step: {step}", end="\r")
        last_print_time = current_time
   
    if X in visited_x:
        G_at_collision = visited_x[X]
        priv_key = (n - (G_added - G_at_collision) // 2 - G_at_collision) % n
        end_time = time.time()
        elapsed_time = end_time - start_time
        hours, rem = divmod(elapsed_time, 3600)
        minutes, seconds = divmod(rem, 60)
        print(f"\nPrivate key found: {hex(priv_key)}")
        print(f"Time taken: {int(hours)}h {int(minutes)}m {int(seconds)}s")
        break
    else:
        visited_x[X] = G_added

I know that the code is slow but it finds a solution

Code:
Total G added: 0x11a4b3bb783, Current Iteration: 2312884, Current step: 699786
Private key found: 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25d8a18d30c97
Time taken: 0h 3m 19s

So original private key is
Code:
n - fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25d8a18d30c97
hex 102B76334AA
dec 1111178294442