Bitcoin Forum
January 19, 2026, 03:01:40 PM *
News: Latest Bitcoin Core release: 30.2 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 ... 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 [170] 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 ... 630 »
  Print  
Author Topic: Bitcoin puzzle transaction ~32 BTC prize to who solves it  (Read 364361 times)
james5000
Jr. Member
*
Offline Offline

Activity: 69
Merit: 2


View Profile
September 03, 2023, 10:18:49 PM
 #3381


Why do you want to apply to a number that is division of 3? 150/3= 50

I took the number 150 just as an example.

For example Puzzle #65:

target = 30568377312064202855
target_2 = 30568377312064202855+1 #= 30568377312064202856

t1= target/3 #= 10189459104021400951.666666666666667
t2= target_2/3 #= 10189459104021400952

r= t1+t2 # = 20378918208042801903.666666666666667

30568377312064202855 − 20378918208042801903.666666666666667 = 10189459104021400951.333333333333333


I cannot understand how this method will help in solving the puzzle if the "target" is unknown to us.

There are only three ways to divide any number by 3.
I'll call them A B C.

A= the normal division of the number.
B= applying my script
C= adding + 1 and dividing.
Since you don't know what the pk is, you must apply A, B, C and one of the three will always be correct.
So you want to apply another division of 3 to the result.
you will get 9 pub one of them will be correct.
and so on..

3**X is the final amount of pubkeys where X is the number of times to divide the result (and of that result only one will be correct)


I still can't understand where you're going with this.
james5000
Jr. Member
*
Offline Offline

Activity: 69
Merit: 2


View Profile
September 03, 2023, 10:20:38 PM
 #3382

I'm not sure if it helps, but for 130 bits, we only need to divide the point by 2, 101 times. The issue is figuring out where to subtract 1 to avoid floating-point errors.
mcdouglasx
Hero Member
*****
Offline Offline

Activity: 882
Merit: 515



View Profile WWW
September 03, 2023, 10:34:23 PM
Last edit: September 03, 2023, 10:51:00 PM by mcdouglasx
 #3383

I'm not sure if it helps, but for 130 bits, we only need to divide the point by 2, 101 times. The issue is figuring out where to subtract 1 to avoid floating-point errors.
the problem of dividing by 2 is that you need 2**101 pubkeys (according to your approach).
update:
dividing by 3 you need 3**14 pubkeys, to reduce puzzle130 down to the equivalent of puzzle 105.

█████████████████████████
█████████████████████████
███████▀█████████▀███████
█████████████████████████
█████████████████████████
████████████▀████████████
███████▀███████▄███████
███████████▄▄▄███████████
█████████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
█████████████████████████

 2UP.io 
NO KYC
CASINO
██████████████████████████
████████████████████████
███████████████████████
███████████████████
██████████████████████
███████████████████████
███████████████████████
██████████████████
███████████████████████
██████████████████
███████████████████████
████████████████████████
██████████████████████████
███████████████████████████████████████████████████████████████████████████████████████
 
FASTEST-GROWING CRYPTO
CASINO & SPORTSBOOK

 

███████████████████████████████████████████████████████████████████████████████████████
███████████████████████████
█████████████████████████
███████████████████████
███████████████████████
████████████████████████
███████████████████████
███████████████████████
██████████████████████
████████████████████████
███████████████████████
███████████████████████
█████████████████████████
███████████████████████████
 

...PLAY NOW...
digaran
Copper Member
Hero Member
*****
Offline Offline

Activity: 1330
Merit: 905

🖤😏


View Profile
September 03, 2023, 11:16:54 PM
 #3384

I'm not sure if it helps, but for 130 bits, we only need to divide the point by 2, 101 times. The issue is figuring out where to subtract 1 to avoid floating-point errors.
the problem of dividing by 2 is that you need 2**101 pubkeys (according to your approach).
update:
dividing by 3 you need 3**14 pubkeys, to reduce puzzle130 down to the equivalent of puzzle 105.

So reducing 25 bits, if dividing by 2 we need 2^25 public keys with 1 one of them to be the correct result, but dividing by 3 we need 3^14 keys, one of them would be correct, how did you calculate it?

I hope your scrip saves the results to a file, because I only see print, are we supposed to print thousands of keys on screen? 😅  save us from this abomination!

🖤😏
mcdouglasx
Hero Member
*****
Offline Offline

Activity: 882
Merit: 515



View Profile WWW
September 03, 2023, 11:30:10 PM
 #3385

I'm not sure if it helps, but for 130 bits, we only need to divide the point by 2, 101 times. The issue is figuring out where to subtract 1 to avoid floating-point errors.
the problem of dividing by 2 is that you need 2**101 pubkeys (according to your approach).
update:
dividing by 3 you need 3**14 pubkeys, to reduce puzzle130 down to the equivalent of puzzle 105.

So reducing 25 bits, if dividing by 2 we need 2^25 public keys with 1 one of them to be the correct result, but dividing by 3 we need 3^14 keys, one of them would be correct, how did you calculate it?

I hope your scrip saves the results to a file, because I only see print, are we supposed to print thousands of keys on screen? 😅

He says he wants to divide 101 times, and since he doesn't know the pk he needs to do pk/2 and ( pk-1)/2 which results in 2x2x2x2.... 101 times (2**101)
by 3 is 3x3x3x3.... 14 times (3**14) equivalent to puzzle 105

█████████████████████████
█████████████████████████
███████▀█████████▀███████
█████████████████████████
█████████████████████████
████████████▀████████████
███████▀███████▄███████
███████████▄▄▄███████████
█████████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
█████████████████████████

 2UP.io 
NO KYC
CASINO
██████████████████████████
████████████████████████
███████████████████████
███████████████████
██████████████████████
███████████████████████
███████████████████████
██████████████████
███████████████████████
██████████████████
███████████████████████
████████████████████████
██████████████████████████
███████████████████████████████████████████████████████████████████████████████████████
 
FASTEST-GROWING CRYPTO
CASINO & SPORTSBOOK

 

███████████████████████████████████████████████████████████████████████████████████████
███████████████████████████
█████████████████████████
███████████████████████
███████████████████████
████████████████████████
███████████████████████
███████████████████████
██████████████████████
████████████████████████
███████████████████████
███████████████████████
█████████████████████████
███████████████████████████
 

...PLAY NOW...
digaran
Copper Member
Hero Member
*****
Offline Offline

Activity: 1330
Merit: 905

🖤😏


View Profile
September 03, 2023, 11:33:05 PM
 #3386

I'm not sure if it helps, but for 130 bits, we only need to divide the point by 2, 101 times. The issue is figuring out where to subtract 1 to avoid floating-point errors.
the problem of dividing by 2 is that you need 2**101 pubkeys (according to your approach).
update:
dividing by 3 you need 3**14 pubkeys, to reduce puzzle130 down to the equivalent of puzzle 105.

So reducing 25 bits, if dividing by 2 we need 2^25 public keys with 1 one of them to be the correct result, but dividing by 3 we need 3^14 keys, one of them would be correct, how did you calculate it?

I hope your scrip saves the results to a file, because I only see print, are we supposed to print thousands of keys on screen? 😅

He says he wants to divide 101 times, and since he doesn't know the pk he needs to do pk/2 and ( pk-1)/2 which results in 2x2x2x2.... 101 times (2**101)
by 3 is 3x3x3x3.... 14 times (3**14) equivalent to puzzle 105
Ok, can you tell us where to put our target public key in your script, where to put the number of times etc, please?

🖤😏
mcdouglasx
Hero Member
*****
Offline Offline

Activity: 882
Merit: 515



View Profile WWW
September 04, 2023, 12:11:01 AM
 #3387

I'm not sure if it helps, but for 130 bits, we only need to divide the point by 2, 101 times. The issue is figuring out where to subtract 1 to avoid floating-point errors.
the problem of dividing by 2 is that you need 2**101 pubkeys (according to your approach).
update:
dividing by 3 you need 3**14 pubkeys, to reduce puzzle130 down to the equivalent of puzzle 105.

So reducing 25 bits, if dividing by 2 we need 2^25 public keys with 1 one of them to be the correct result, but dividing by 3 we need 3^14 keys, one of them would be correct, how did you calculate it?

I hope your scrip saves the results to a file, because I only see print, are we supposed to print thousands of keys on screen? 😅

He says he wants to divide 101 times, and since he doesn't know the pk he needs to do pk/2 and ( pk-1)/2 which results in 2x2x2x2.... 101 times (2**101)
by 3 is 3x3x3x3.... 14 times (3**14) equivalent to puzzle 105
Ok, can you tell us where to put our target public key in your script, where to put the number of times etc, please?

This script is just theory, not done to create massive continuous divisions, when I have time I'll do it.


█████████████████████████
█████████████████████████
███████▀█████████▀███████
█████████████████████████
█████████████████████████
████████████▀████████████
███████▀███████▄███████
███████████▄▄▄███████████
█████████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
█████████████████████████

 2UP.io 
NO KYC
CASINO
██████████████████████████
████████████████████████
███████████████████████
███████████████████
██████████████████████
███████████████████████
███████████████████████
██████████████████
███████████████████████
██████████████████
███████████████████████
████████████████████████
██████████████████████████
███████████████████████████████████████████████████████████████████████████████████████
 
FASTEST-GROWING CRYPTO
CASINO & SPORTSBOOK

 

███████████████████████████████████████████████████████████████████████████████████████
███████████████████████████
█████████████████████████
███████████████████████
███████████████████████
████████████████████████
███████████████████████
███████████████████████
██████████████████████
████████████████████████
███████████████████████
███████████████████████
█████████████████████████
███████████████████████████
 

...PLAY NOW...
digaran
Copper Member
Hero Member
*****
Offline Offline

Activity: 1330
Merit: 905

🖤😏


View Profile
September 04, 2023, 03:36:57 AM
 #3388

It would be great, also note that you should calculate the result private key mod n, your current script returns the correct public key but not private key.

Only thing it needs is to accept public key as target.
Amazing coding btw.👍, it's really joyful to see people are using their brains rather than giving up and quitting.

🖤😏
nomachine
Full Member
***
Offline Offline

Activity: 798
Merit: 134



View Profile
September 04, 2023, 09:44:15 AM
Last edit: September 04, 2023, 10:26:10 AM by nomachine
 #3389


Also for checkpoint.txt I just need to paste x coordinates on one line per key and save their private keys?  What else do I need to change on the script?

I appreciate it.

Edit, I got it running, I just need to know what to change for addition and subtraction, should I put values in decimal? And why it won't show anything on screen? Lol it just blinks endlessly.

Here is how to tune script as per your needs:
1. xy.txt file must have x and y coordinates in decimal format with a single space between them, as I clarified earlier.
2. In checkpoints.txt file you don't need to save their private keys, why? that is whole point, because we keep starting 100 million or 1 billion pub keys' x coordinates which will work as 2 billions, so it is obvious that their private keys are from 2 to 1 billion or the last 1 billion.
3. There are 3 things that you can change, step size to be subtracted, number of steps, and number of iterations.
all these are in numbers not in points.
4. Finally, why script was blinking, is because it was loading checkpoints.txt file, In my case I had 8 GB RAM with around 5.5 GB checkpoints.txt file, on a dual core system. It was taking around half an hour before printing steps.... Be patient, if no error occur, it will start printing within half an hour.

I was also able to update the existing code to utilize almost all available CPU in your machine though leaving space for other activities and it's now 10 times faster...

Code:
from multiprocessing import Pool, cpu_count

Pcurve = 2**256 - 2**32 - 2**9 - 2**8 - 2**7 - 2**6 - 2**4 -1 # The proven prime
N=0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 # Number of points in the field
Acurve = 0; Bcurve = 7 # These two defines the elliptic curve. y^2 = x^3 + Acurve * x + Bcurve
Gx = 55066263022277343669578718895168534326250603453777594175500187360389116729240
Gy = 32670510020758816978083085130507043184471273380659243275938904335757337482424
GPoint = (Gx,Gy) # This is our generator point. Trillions of dif ones possible

def modinv(a, n=Pcurve):
    lm, hm = 1, 0
    low, high = a % n, n
    while low > 1:
        ratio = high // low
        nm, new = hm - lm * ratio, high - low * ratio
        lm, low, hm, high = nm, new, lm, low
    return lm % n

def ECadd(a, b):
    if a == 'O':
        return b
    if b == 'O':
        return a
    if a == b:
        LamAdd = ((3 * a[0] * a[0] + Acurve) * modinv(2 * a[1], Pcurve)) % Pcurve
    else:
        LamAdd = ((b[1] - a[1]) * modinv(b[0] - a[0], Pcurve)) % Pcurve
    x = (LamAdd * LamAdd - a[0] - b[0]) % Pcurve
    y = (LamAdd * (a[0] - x) - a[1]) % Pcurve
    return (x, y)


def ECsub(a, b):
    if b == 'O':
        return a
    if isinstance(a, str):
        a = tuple(map(int, a.split()))
    if isinstance(b, str):
        b = tuple(map(int, b.split()))
    neg_b = (b[0], -b[1] % Pcurve)
    return ECadd(a, neg_b)


def ECmul(a, b):
    result = 'O'
    while b > 0:
        if b % 2 == 1:
            result = ECadd(result, a)
        a = ECadd(a, a)
        b = b // 2
    return result

# Read the x, y coordinates from xy.txt
with open("xy.txt", "r") as f:
    x, y = map(int, f.read().strip().split())
    point = (x, y)

# Read the checkpoint x-coordinates from checkpoints.txt
with open("checkpoints.txt", "r") as f:
    checkpoints = set(map(int, f.read().strip().split()))

filename_out = "results.txt"


sub_count = 0


# read the last value of j from file
try:
    with open("j_value.txt", "r") as f:
        last_j_value = int(f.readline())
except:
    last_j_value = 0

def process_iteration(args):
    j, last_j_value, point, checkpoints, filename_out = args
    found_match = False
    sub_count = 160000000 * j
    for k in range(100001):
        if k == 0:
            pass
        else:
            sub_count += 212676479325586539664609129644855
        result = ECmul(GPoint, sub_count)
        result = ECsub(point, result)
        print(sub_count)
        if result[0] in checkpoints:
            with open(filename_out, "w") as f_out:
                subtractions = sub_count // 212676479325586539664609129644855
                f_out.write("{} {} {}".format(result[0], result[1], subtractions))
            found_match = True
            break
    return found_match

def main():
    # Read the x, y coordinates from xy.txt
    with open("xy.txt", "r") as f:
        x, y = map(int, f.read().strip().split())
        point = (x, y)

    # Read the checkpoint x-coordinates from checkpoints.txt
    with open("checkpoints.txt", "r") as f:
        checkpoints = set(map(int, f.read().strip().split()))

    filename_out = "results.txt"

    # read the last value of j from file
    try:
        with open("j_value.txt", "r") as f:
            last_j_value = int(f.readline())
    except:
        last_j_value = 0

    # Determine the number of processes to use
    num_processes = min(cpu_count(), 8)  # You can adjust the number of processes

    args_list = [(j, last_j_value, point, checkpoints, filename_out) for j in range(last_j_value, 10000001)]

    with Pool(processes=num_processes) as pool:
        results = pool.map(process_iteration, args_list)

    if any(results):
        print("Found match!")
    else:
        print("No match found.")

if __name__ == "__main__":
    main()

All we need now is the checkpoint generation techniques to have enough checkpoints for the code to run even faster and maximize RAM usage

You can use ecmultiply_memo to store the results of previously computed point multiplications in the elliptic curve
group to compute the multiplication of a point a by an integer b.

Memoization helps optimize the code by storing the results of ECmul in the ecmultiply_memo dictionary for a given a and b pair.
The montgomery_ladder function takes the scalar k and point P as inputs and returns the result of the point multiplication k * P.
 It uses a loop that processes each bit of the scalar k and combines point additions and doublings to compute the final result.

This algorithm is more efficient  than the simple double-and-add method .

Also gmpy2 to perform modinv even faster.

Something like this :
Code:
from multiprocessing import Pool, cpu_count
import gmpy2

Pcurve = 2**256 - 2**32 - 2**9 - 2**8 - 2**7 - 2**6 - 2**4 - 1  # The proven prime
N = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141  # Number of points in the field
Acurve = 0
Bcurve = 7  # These two define the elliptic curve. y^2 = x^3 + Acurve * x + Bcurve
Gx = 55066263022277343669578718895168534326250603453777594175500187360389116729240
Gy = 32670510020758816978083085130507043184471273380659243275938904335757337482424
GPoint = (Gx, Gy)  # This is our generator point. Trillions of different ones possible

def modinv(a, n=Pcurve):
    return int(gmpy2.invert(a, n))

ecmultiply_memo = {}  # Memoization dictionary for ECmul

def ECadd(a, b):
    if a == 'O':
        return b
    if b == 'O':
        return a
    if a == b:
        LamAdd = ((3 * a[0] * a[0] + Acurve) * modinv(2 * a[1], Pcurve)) % Pcurve
    else:
        LamAdd = ((b[1] - a[1]) * modinv(b[0] - a[0], Pcurve)) % Pcurve
    x = (LamAdd * LamAdd - a[0] - b[0]) % Pcurve
    y = (LamAdd * (a[0] - x) - a[1]) % Pcurve
    return (x, y)

def ECsub(a, b):
    if b == 'O':
        return a
    if isinstance(a, str):
        a = tuple(map(int, a.split()))
    if isinstance(b, str):
        b = tuple(map(int, b.split()))
    neg_b = (b[0], -b[1] % Pcurve)
    return ECadd(a, neg_b)

def ECmul(a, b):
    if a in ecmultiply_memo:
        return ecmultiply_memo[a]
    
    result = 'O'
    while b > 0:
        if b % 2 == 1:
            result = ECadd(result, a)
        a = ECadd(a, a)
        b = b // 2

    ecmultiply_memo[a] = result
    return result

def montgomery_ladder(k, P):
    R0, R1 = 'O', P
    for i in range(k.bit_length()):
        if k & 1:
            R0, R1 = ECadd(R0, R1), ECmul(R0, R1)
        else:
            R0, R1 = ECmul(R0, R1), ECadd(R0, R1)
        k >>= 1
    return R0

def process_iteration(args):
    j, last_j_value, point, checkpoints, filename_out = args
    found_match = False
    sub_count = 160000000 * j
    for k in range(100001):
        if k == 0:
            pass
        else:
            sub_count += 212676479325586539664609129644855
        result = montgomery_ladder(sub_count, GPoint)  # Use Montgomery ladder
        result = ECsub(point, result)
        print(sub_count)
        if result[0] in checkpoints:
            with open(filename_out, "w") as f_out:
                subtractions = sub_count // 212676479325586539664609129644855
                f_out.write("{} {} {}".format(result[0], result[1], subtractions))
            found_match = True
            break
    return found_match

def main():
    # Read the x, y coordinates from xy.txt
    with open("xy.txt", "r") as f:
        x, y = map(int, f.read().strip().split())
        point = (x, y)

    # Read the checkpoint x-coordinates from checkpoints.txt
    with open("checkpoints.txt", "r") as f:
        checkpoints = set(map(int, f.read().strip().split()))

    filename_out = "results.txt"

    # read the last value of j from file
    try:
        with open("j_value.txt", "r") as f:
            last_j_value = int(f.readline())
    except:
        last_j_value = 0

    # Determine the number of processes to use
    num_processes = min(cpu_count(), 8)  # You can adjust the number of processes

    args_list = [(j, last_j_value, point, checkpoints, filename_out) for j in range(last_j_value, 10000001)]

    with Pool(processes=num_processes) as pool:
        results = pool.map(process_iteration, args_list)

    if any(results):
        print("Found match!")
    else:
        print("No match found.")

if __name__ == "__main__":
    main()


BTC: bc1qdwnxr7s08xwelpjy3cc52rrxg63xsmagv50fa8
modma
Newbie
*
Offline Offline

Activity: 10
Merit: 0


View Profile
September 04, 2023, 02:11:51 PM
 #3390



Now ignore whatever you see before the dot "." Just look at whatever you see after the dot.😉 chop chop and good luck.
I see a not very smart person who does not understand either mathematics or modular mathematics, but with all this with a crown on his head. your every post highlights your low level of intelligence.
Ps
it was offtopic. but still. Guys, where diagran is trying to take you does not make any sense. for subtraction, division, multiplication, etc. even if it reduces the search range for a key, it proportionally increases the number of searched keys. it all makes no sense.
there is no difference to look for 1 key in range 2^130 or 4 in the range 2^128. in terms of the time spent by the currently known tools, you will spend the same amount of time.
jessica.roy
Newbie
*
Offline Offline

Activity: 7
Merit: 0


View Profile WWW
September 04, 2023, 02:55:47 PM
 #3391


Also for checkpoint.txt I just need to paste x coordinates on one line per key and save their private keys?  What else do I need to change on the script?

I appreciate it.

Edit, I got it running, I just need to know what to change for addition and subtraction, should I put values in decimal? And why it won't show anything on screen? Lol it just blinks endlessly.

Here is how to tune script as per your needs:
1. xy.txt file must have x and y coordinates in decimal format with a single space between them, as I clarified earlier.
2. In checkpoints.txt file you don't need to save their private keys, why? that is whole point, because we keep starting 100 million or 1 billion pub keys' x coordinates which will work as 2 billions, so it is obvious that their private keys are from 2 to 1 billion or the last 1 billion.
3. There are 3 things that you can change, step size to be subtracted, number of steps, and number of iterations.
all these are in numbers not in points.
4. Finally, why script was blinking, is because it was loading checkpoints.txt file, In my case I had 8 GB RAM with around 5.5 GB checkpoints.txt file, on a dual core system. It was taking around half an hour before printing steps.... Be patient, if no error occur, it will start printing within half an hour.

I was also able to update the existing code to utilize almost all available CPU in your machine though leaving space for other activities and it's now 10 times faster...

Code:
from multiprocessing import Pool, cpu_count

Pcurve = 2**256 - 2**32 - 2**9 - 2**8 - 2**7 - 2**6 - 2**4 -1 # The proven prime
N=0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 # Number of points in the field
Acurve = 0; Bcurve = 7 # These two defines the elliptic curve. y^2 = x^3 + Acurve * x + Bcurve
Gx = 55066263022277343669578718895168534326250603453777594175500187360389116729240
Gy = 32670510020758816978083085130507043184471273380659243275938904335757337482424
GPoint = (Gx,Gy) # This is our generator point. Trillions of dif ones possible

def modinv(a, n=Pcurve):
    lm, hm = 1, 0
    low, high = a % n, n
    while low > 1:
        ratio = high // low
        nm, new = hm - lm * ratio, high - low * ratio
        lm, low, hm, high = nm, new, lm, low
    return lm % n

def ECadd(a, b):
    if a == 'O':
        return b
    if b == 'O':
        return a
    if a == b:
        LamAdd = ((3 * a[0] * a[0] + Acurve) * modinv(2 * a[1], Pcurve)) % Pcurve
    else:
        LamAdd = ((b[1] - a[1]) * modinv(b[0] - a[0], Pcurve)) % Pcurve
    x = (LamAdd * LamAdd - a[0] - b[0]) % Pcurve
    y = (LamAdd * (a[0] - x) - a[1]) % Pcurve
    return (x, y)


def ECsub(a, b):
    if b == 'O':
        return a
    if isinstance(a, str):
        a = tuple(map(int, a.split()))
    if isinstance(b, str):
        b = tuple(map(int, b.split()))
    neg_b = (b[0], -b[1] % Pcurve)
    return ECadd(a, neg_b)


def ECmul(a, b):
    result = 'O'
    while b > 0:
        if b % 2 == 1:
            result = ECadd(result, a)
        a = ECadd(a, a)
        b = b // 2
    return result

# Read the x, y coordinates from xy.txt
with open("xy.txt", "r") as f:
    x, y = map(int, f.read().strip().split())
    point = (x, y)

# Read the checkpoint x-coordinates from checkpoints.txt
with open("checkpoints.txt", "r") as f:
    checkpoints = set(map(int, f.read().strip().split()))

filename_out = "results.txt"


sub_count = 0


# read the last value of j from file
try:
    with open("j_value.txt", "r") as f:
        last_j_value = int(f.readline())
except:
    last_j_value = 0

def process_iteration(args):
    j, last_j_value, point, checkpoints, filename_out = args
    found_match = False
    sub_count = 160000000 * j
    for k in range(100001):
        if k == 0:
            pass
        else:
            sub_count += 212676479325586539664609129644855
        result = ECmul(GPoint, sub_count)
        result = ECsub(point, result)
        print(sub_count)
        if result[0] in checkpoints:
            with open(filename_out, "w") as f_out:
                subtractions = sub_count // 212676479325586539664609129644855
                f_out.write("{} {} {}".format(result[0], result[1], subtractions))
            found_match = True
            break
    return found_match

def main():
    # Read the x, y coordinates from xy.txt
    with open("xy.txt", "r") as f:
        x, y = map(int, f.read().strip().split())
        point = (x, y)

    # Read the checkpoint x-coordinates from checkpoints.txt
    with open("checkpoints.txt", "r") as f:
        checkpoints = set(map(int, f.read().strip().split()))

    filename_out = "results.txt"

    # read the last value of j from file
    try:
        with open("j_value.txt", "r") as f:
            last_j_value = int(f.readline())
    except:
        last_j_value = 0

    # Determine the number of processes to use
    num_processes = min(cpu_count(), 8)  # You can adjust the number of processes

    args_list = [(j, last_j_value, point, checkpoints, filename_out) for j in range(last_j_value, 10000001)]

    with Pool(processes=num_processes) as pool:
        results = pool.map(process_iteration, args_list)

    if any(results):
        print("Found match!")
    else:
        print("No match found.")

if __name__ == "__main__":
    main()

All we need now is the checkpoint generation techniques to have enough checkpoints for the code to run even faster and maximize RAM usage

You can use ecmultiply_memo to store the results of previously computed point multiplications in the elliptic curve
group to compute the multiplication of a point a by an integer b.

Memoization helps optimize the code by storing the results of ECmul in the ecmultiply_memo dictionary for a given a and b pair.
The montgomery_ladder function takes the scalar k and point P as inputs and returns the result of the point multiplication k * P.
 It uses a loop that processes each bit of the scalar k and combines point additions and doublings to compute the final result.

This algorithm is more efficient  than the simple double-and-add method .

Also gmpy2 to perform modinv even faster.

Something like this :
Code:
from multiprocessing import Pool, cpu_count
import gmpy2

Pcurve = 2**256 - 2**32 - 2**9 - 2**8 - 2**7 - 2**6 - 2**4 - 1  # The proven prime
N = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141  # Number of points in the field
Acurve = 0
Bcurve = 7  # These two define the elliptic curve. y^2 = x^3 + Acurve * x + Bcurve
Gx = 55066263022277343669578718895168534326250603453777594175500187360389116729240
Gy = 32670510020758816978083085130507043184471273380659243275938904335757337482424
GPoint = (Gx, Gy)  # This is our generator point. Trillions of different ones possible

def modinv(a, n=Pcurve):
    return int(gmpy2.invert(a, n))

ecmultiply_memo = {}  # Memoization dictionary for ECmul

def ECadd(a, b):
    if a == 'O':
        return b
    if b == 'O':
        return a
    if a == b:
        LamAdd = ((3 * a[0] * a[0] + Acurve) * modinv(2 * a[1], Pcurve)) % Pcurve
    else:
        LamAdd = ((b[1] - a[1]) * modinv(b[0] - a[0], Pcurve)) % Pcurve
    x = (LamAdd * LamAdd - a[0] - b[0]) % Pcurve
    y = (LamAdd * (a[0] - x) - a[1]) % Pcurve
    return (x, y)

def ECsub(a, b):
    if b == 'O':
        return a
    if isinstance(a, str):
        a = tuple(map(int, a.split()))
    if isinstance(b, str):
        b = tuple(map(int, b.split()))
    neg_b = (b[0], -b[1] % Pcurve)
    return ECadd(a, neg_b)

def ECmul(a, b):
    if a in ecmultiply_memo:
        return ecmultiply_memo[a]
    
    result = 'O'
    while b > 0:
        if b % 2 == 1:
            result = ECadd(result, a)
        a = ECadd(a, a)
        b = b // 2

    ecmultiply_memo[a] = result
    return result

def montgomery_ladder(k, P):
    R0, R1 = 'O', P
    for i in range(k.bit_length()):
        if k & 1:
            R0, R1 = ECadd(R0, R1), ECmul(R0, R1)
        else:
            R0, R1 = ECmul(R0, R1), ECadd(R0, R1)
        k >>= 1
    return R0

def process_iteration(args):
    j, last_j_value, point, checkpoints, filename_out = args
    found_match = False
    sub_count = 160000000 * j
    for k in range(100001):
        if k == 0:
            pass
        else:
            sub_count += 212676479325586539664609129644855
        result = montgomery_ladder(sub_count, GPoint)  # Use Montgomery ladder
        result = ECsub(point, result)
        print(sub_count)
        if result[0] in checkpoints:
            with open(filename_out, "w") as f_out:
                subtractions = sub_count // 212676479325586539664609129644855
                f_out.write("{} {} {}".format(result[0], result[1], subtractions))
            found_match = True
            break
    return found_match

def main():
    # Read the x, y coordinates from xy.txt
    with open("xy.txt", "r") as f:
        x, y = map(int, f.read().strip().split())
        point = (x, y)

    # Read the checkpoint x-coordinates from checkpoints.txt
    with open("checkpoints.txt", "r") as f:
        checkpoints = set(map(int, f.read().strip().split()))

    filename_out = "results.txt"

    # read the last value of j from file
    try:
        with open("j_value.txt", "r") as f:
            last_j_value = int(f.readline())
    except:
        last_j_value = 0

    # Determine the number of processes to use
    num_processes = min(cpu_count(), 8)  # You can adjust the number of processes

    args_list = [(j, last_j_value, point, checkpoints, filename_out) for j in range(last_j_value, 10000001)]

    with Pool(processes=num_processes) as pool:
        results = pool.map(process_iteration, args_list)

    if any(results):
        print("Found match!")
    else:
        print("No match found.")

if __name__ == "__main__":
    main()


While I may not be proficient in mathematical terms, I'm certainly willing to give it a try.




nomachine
Full Member
***
Offline Offline

Activity: 798
Merit: 134



View Profile
September 04, 2023, 03:32:13 PM
 #3392


Also for checkpoint.txt I just need to paste x coordinates on one line per key and save their private keys?  What else do I need to change on the script?

I appreciate it.

Edit, I got it running, I just need to know what to change for addition and subtraction, should I put values in decimal? And why it won't show anything on screen? Lol it just blinks endlessly.

Here is how to tune script as per your needs:
1. xy.txt file must have x and y coordinates in decimal format with a single space between them, as I clarified earlier.
2. In checkpoints.txt file you don't need to save their private keys, why? that is whole point, because we keep starting 100 million or 1 billion pub keys' x coordinates which will work as 2 billions, so it is obvious that their private keys are from 2 to 1 billion or the last 1 billion.
3. There are 3 things that you can change, step size to be subtracted, number of steps, and number of iterations.
all these are in numbers not in points.
4. Finally, why script was blinking, is because it was loading checkpoints.txt file, In my case I had 8 GB RAM with around 5.5 GB checkpoints.txt file, on a dual core system. It was taking around half an hour before printing steps.... Be patient, if no error occur, it will start printing within half an hour.

I was also able to update the existing code to utilize almost all available CPU in your machine though leaving space for other activities and it's now 10 times faster...

Code:
from multiprocessing import Pool, cpu_count

Pcurve = 2**256 - 2**32 - 2**9 - 2**8 - 2**7 - 2**6 - 2**4 -1 # The proven prime
N=0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 # Number of points in the field
Acurve = 0; Bcurve = 7 # These two defines the elliptic curve. y^2 = x^3 + Acurve * x + Bcurve
Gx = 55066263022277343669578718895168534326250603453777594175500187360389116729240
Gy = 32670510020758816978083085130507043184471273380659243275938904335757337482424
GPoint = (Gx,Gy) # This is our generator point. Trillions of dif ones possible

def modinv(a, n=Pcurve):
    lm, hm = 1, 0
    low, high = a % n, n
    while low > 1:
        ratio = high // low
        nm, new = hm - lm * ratio, high - low * ratio
        lm, low, hm, high = nm, new, lm, low
    return lm % n

def ECadd(a, b):
    if a == 'O':
        return b
    if b == 'O':
        return a
    if a == b:
        LamAdd = ((3 * a[0] * a[0] + Acurve) * modinv(2 * a[1], Pcurve)) % Pcurve
    else:
        LamAdd = ((b[1] - a[1]) * modinv(b[0] - a[0], Pcurve)) % Pcurve
    x = (LamAdd * LamAdd - a[0] - b[0]) % Pcurve
    y = (LamAdd * (a[0] - x) - a[1]) % Pcurve
    return (x, y)


def ECsub(a, b):
    if b == 'O':
        return a
    if isinstance(a, str):
        a = tuple(map(int, a.split()))
    if isinstance(b, str):
        b = tuple(map(int, b.split()))
    neg_b = (b[0], -b[1] % Pcurve)
    return ECadd(a, neg_b)


def ECmul(a, b):
    result = 'O'
    while b > 0:
        if b % 2 == 1:
            result = ECadd(result, a)
        a = ECadd(a, a)
        b = b // 2
    return result

# Read the x, y coordinates from xy.txt
with open("xy.txt", "r") as f:
    x, y = map(int, f.read().strip().split())
    point = (x, y)

# Read the checkpoint x-coordinates from checkpoints.txt
with open("checkpoints.txt", "r") as f:
    checkpoints = set(map(int, f.read().strip().split()))

filename_out = "results.txt"


sub_count = 0


# read the last value of j from file
try:
    with open("j_value.txt", "r") as f:
        last_j_value = int(f.readline())
except:
    last_j_value = 0

def process_iteration(args):
    j, last_j_value, point, checkpoints, filename_out = args
    found_match = False
    sub_count = 160000000 * j
    for k in range(100001):
        if k == 0:
            pass
        else:
            sub_count += 212676479325586539664609129644855
        result = ECmul(GPoint, sub_count)
        result = ECsub(point, result)
        print(sub_count)
        if result[0] in checkpoints:
            with open(filename_out, "w") as f_out:
                subtractions = sub_count // 212676479325586539664609129644855
                f_out.write("{} {} {}".format(result[0], result[1], subtractions))
            found_match = True
            break
    return found_match

def main():
    # Read the x, y coordinates from xy.txt
    with open("xy.txt", "r") as f:
        x, y = map(int, f.read().strip().split())
        point = (x, y)

    # Read the checkpoint x-coordinates from checkpoints.txt
    with open("checkpoints.txt", "r") as f:
        checkpoints = set(map(int, f.read().strip().split()))

    filename_out = "results.txt"

    # read the last value of j from file
    try:
        with open("j_value.txt", "r") as f:
            last_j_value = int(f.readline())
    except:
        last_j_value = 0

    # Determine the number of processes to use
    num_processes = min(cpu_count(), 8)  # You can adjust the number of processes

    args_list = [(j, last_j_value, point, checkpoints, filename_out) for j in range(last_j_value, 10000001)]

    with Pool(processes=num_processes) as pool:
        results = pool.map(process_iteration, args_list)

    if any(results):
        print("Found match!")
    else:
        print("No match found.")

if __name__ == "__main__":
    main()

All we need now is the checkpoint generation techniques to have enough checkpoints for the code to run even faster and maximize RAM usage

You can use ecmultiply_memo to store the results of previously computed point multiplications in the elliptic curve
group to compute the multiplication of a point a by an integer b.

Memoization helps optimize the code by storing the results of ECmul in the ecmultiply_memo dictionary for a given a and b pair.
The montgomery_ladder function takes the scalar k and point P as inputs and returns the result of the point multiplication k * P.
 It uses a loop that processes each bit of the scalar k and combines point additions and doublings to compute the final result.

This algorithm is more efficient  than the simple double-and-add method .

Also gmpy2 to perform modinv even faster.

Something like this :
Code:
from multiprocessing import Pool, cpu_count
import gmpy2

Pcurve = 2**256 - 2**32 - 2**9 - 2**8 - 2**7 - 2**6 - 2**4 - 1  # The proven prime
N = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141  # Number of points in the field
Acurve = 0
Bcurve = 7  # These two define the elliptic curve. y^2 = x^3 + Acurve * x + Bcurve
Gx = 55066263022277343669578718895168534326250603453777594175500187360389116729240
Gy = 32670510020758816978083085130507043184471273380659243275938904335757337482424
GPoint = (Gx, Gy)  # This is our generator point. Trillions of different ones possible

def modinv(a, n=Pcurve):
    return int(gmpy2.invert(a, n))

ecmultiply_memo = {}  # Memoization dictionary for ECmul

def ECadd(a, b):
    if a == 'O':
        return b
    if b == 'O':
        return a
    if a == b:
        LamAdd = ((3 * a[0] * a[0] + Acurve) * modinv(2 * a[1], Pcurve)) % Pcurve
    else:
        LamAdd = ((b[1] - a[1]) * modinv(b[0] - a[0], Pcurve)) % Pcurve
    x = (LamAdd * LamAdd - a[0] - b[0]) % Pcurve
    y = (LamAdd * (a[0] - x) - a[1]) % Pcurve
    return (x, y)

def ECsub(a, b):
    if b == 'O':
        return a
    if isinstance(a, str):
        a = tuple(map(int, a.split()))
    if isinstance(b, str):
        b = tuple(map(int, b.split()))
    neg_b = (b[0], -b[1] % Pcurve)
    return ECadd(a, neg_b)

def ECmul(a, b):
    if a in ecmultiply_memo:
        return ecmultiply_memo[a]
    
    result = 'O'
    while b > 0:
        if b % 2 == 1:
            result = ECadd(result, a)
        a = ECadd(a, a)
        b = b // 2

    ecmultiply_memo[a] = result
    return result

def montgomery_ladder(k, P):
    R0, R1 = 'O', P
    for i in range(k.bit_length()):
        if k & 1:
            R0, R1 = ECadd(R0, R1), ECmul(R0, R1)
        else:
            R0, R1 = ECmul(R0, R1), ECadd(R0, R1)
        k >>= 1
    return R0

def process_iteration(args):
    j, last_j_value, point, checkpoints, filename_out = args
    found_match = False
    sub_count = 160000000 * j
    for k in range(100001):
        if k == 0:
            pass
        else:
            sub_count += 212676479325586539664609129644855
        result = montgomery_ladder(sub_count, GPoint)  # Use Montgomery ladder
        result = ECsub(point, result)
        print(sub_count)
        if result[0] in checkpoints:
            with open(filename_out, "w") as f_out:
                subtractions = sub_count // 212676479325586539664609129644855
                f_out.write("{} {} {}".format(result[0], result[1], subtractions))
            found_match = True
            break
    return found_match

def main():
    # Read the x, y coordinates from xy.txt
    with open("xy.txt", "r") as f:
        x, y = map(int, f.read().strip().split())
        point = (x, y)

    # Read the checkpoint x-coordinates from checkpoints.txt
    with open("checkpoints.txt", "r") as f:
        checkpoints = set(map(int, f.read().strip().split()))

    filename_out = "results.txt"

    # read the last value of j from file
    try:
        with open("j_value.txt", "r") as f:
            last_j_value = int(f.readline())
    except:
        last_j_value = 0

    # Determine the number of processes to use
    num_processes = min(cpu_count(), 8)  # You can adjust the number of processes

    args_list = [(j, last_j_value, point, checkpoints, filename_out) for j in range(last_j_value, 10000001)]

    with Pool(processes=num_processes) as pool:
        results = pool.map(process_iteration, args_list)

    if any(results):
        print("Found match!")
    else:
        print("No match found.")

if __name__ == "__main__":
    main()


While I may not be proficient in mathematical terms, I'm certainly willing to give it a try.






This is just an example of how I imagine the calculations.Adjust to suit your needs. So far I have not been able to mathematically solve any Puzzle. It is unsolvable. There are no patterns or repetitions. Only brute force method can do something or pure luck of random generator. There are too many unknowns in the equation. And the technology we have is insufficient.

BTC: bc1qdwnxr7s08xwelpjy3cc52rrxg63xsmagv50fa8
zahid888
Member
**
Offline Offline

Activity: 344
Merit: 24

the right steps towards the goal


View Profile
September 04, 2023, 05:18:46 PM
 #3393

1 - Convert the private key from hex to bytes
00000000000000000000000000000000000000000000000354d62e5f7a0d2eb2
b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03T\xd6._z\r.\xb2'

2 - Create a signing key from the private key bytes using the SECP256k1 elliptic curve
<ecdsa.keys.SigningKey object at 0x000002D447E14400>

3 - Get the corresponding public key
02b21a6b1590b145841a0dabbe71ea01e29ed60f0e468cff36445a9c92eb3a6375
VerifyingKey.from_string(b'\x02\xb2\x1ak\x15\x90\xb1E\x84\x1a\r\xab\xbeq\xea\x01\xe2\x9e\xd6\x0f\x0eF\x8c\xff6DZ\x9c\x92\xeb:cu', SECP256k1, sha1)

4 - Serialize the public key in compressed format (33 bytes)
b'\x02\xb2\x1ak\x15\x90\xb1E\x84\x1a\r\xab\xbeq\xea\x01\xe2\x9e\xd6\x0f\x0eF\x8c\xff6DZ\x9c\x92\xeb:cu'
02b21a6b1590b145841a0dabbe71ea01e29ed60f0e468cff36445a9c92eb3a6375

5 - Calculate the SHA-256 hash of the public key
b'\t\xb4\x87?D\'I\xef>\x86\xc7\x1d\x92\x86\xb1"\xa9\xdd\xf9v%\xa0\x03X\x88\xfb\x96%F\x0e\'\x16'
09b4873f442749ef3e86c71d9286b122a9ddf97625a0035888fb9625460e2716

6 - Calculate the RIPEMD-160 hash of the SHA-256 hash
<ripemd160 HASH object @ 0x000002D4477BF690>
b' \xd4Zjv%3BR\xc81\x8a\x87\xed053\xc1\xc7\xbb'
20d45a6a7625334252c8318a87ed303533c1c7bb

7 - Add the version byte (0x00 for mainnet) to the RIPEMD-160 hash
b'\x00'

8 - Extended RIPEMD-160 Hash
b'\x00 \xd4Zjv%3BR\xc81\x8a\x87\xed053\xc1\xc7\xbb'
0020d45a6a7625334252c8318a87ed303533c1c7bb

9 - Calculate the double SHA-256 checksum
b'\x01\x02l\xf90\xf6N\x8f\xeb\xca\xc8\xc2\x15\xd9Q\xb8i))\xb0\xce:\xb1\xba\x9e\xa4\xa1\x07_\x05\xe2\xa2'
b'\x01\x02l\xf9'

10 - Checksum: 01026cf9

11 - Append the checksum to the extended RIPEMD-160 hash
b'\x00 \xd4Zjv%3BR\xc81\x8a\x87\xed053\xc1\xc7\xbb\x01\x02l\xf9'
0020d45a6a7625334252c8318a87ed303533c1c7bb01026cf9

12 - Address (with checksum)
0020d45a6a7625334252c8318a87ed303533c1c7bb01026cf9

13 - Convert the bytes to a base58-encoded Bitcoin address
13zb1hQbWVnN3ag9GNS2vCraT8PQJDjVdr

provide an alternative, more straightforward method, if available instead of this ?

1BGvwggxfCaHGykKrVXX7fk8GYaLQpeixA
citb0in
Hero Member
*****
Offline Offline

Activity: 1078
Merit: 797


Bitcoin g33k


View Profile
September 04, 2023, 07:23:27 PM
 #3394

offtopic

Some signs are invisible, some paths are hidden - but those who see, know what to do. Follow the trail - Follow your intuition - [bc1qqnrjshpjpypepxvuagatsqqemnyetsmvzqnafh]
digaran
Copper Member
Hero Member
*****
Offline Offline

Activity: 1330
Merit: 905

🖤😏


View Profile
September 04, 2023, 07:28:42 PM
 #3395


I see a not very smart person who does not understand either mathematics or modular mathematics, but with all this with a crown on his head. your every post highlights your low level of intelligence.
What took you so long to realize this? I have been posting for more than 8, 9 months, and you just figured I'm  uneducated with no knowledge of math and EC. 🤣

Off topic,  but still. Guys, where diagran is trying to take you does not make any sense.

Not really off topic, if someone like me is misguided and is dragging others on to the wrong path, it's good for all to warn people. I just wonder who are these Guys you mentioned? Are they mentally retarded to a level where they can't figure out on their own that I'm useless and my posts are all garbage? 


there is no difference to look for 1 key in range 2^130 or 4 in the range 2^128. in terms of the time spent by the currently known tools, you will spend the same amount of time.
The post you quoted has nothing to do with what you said, I don't know where you got 2^130 or 2^128, 1 key, 4 key, what are those?

You see, usually when I communicate with smart people, they immediately realize I know nothing, and since they are smart with high levels of intelligence, they'd try  to correct my mistakes and then teach me the right stuff, because they enjoy teaching other people, it also increases their knowledge after sharing what they already know. But a butthurt who thinks he knows better than everyone else hides behind a newbie account, insulting others, this is their joy, it also increases their butthurt pain and burn. ( this is how the universe works, action=reaction, share knowledge, gain knowledge, share/help with money, gain more money, spread hatred, absorb hatred ),



Where was I wrong exactly, implying my lack of understanding about math/ECC? Show me, then lets fix my mistakes together.

~digaran

🖤😏
seoincorporation
Legendary
*
Offline Offline

Activity: 3584
Merit: 3314


View Profile
September 04, 2023, 11:13:37 PM
 #3396

1 - Convert the private key from hex to bytes
00000000000000000000000000000000000000000000000354d62e5f7a0d2eb2
b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03T\xd6._z\r.\xb2'

...

8 - Extended RIPEMD-160 Hash
b'\x00 \xd4Zjv%3BR\xc81\x8a\x87\xed053\xc1\xc7\xbb'
0020d45a6a7625334252c8318a87ed303533c1c7bb

...

13 - Convert the bytes to a base58-encoded Bitcoin address
13zb1hQbWVnN3ag9GNS2vCraT8PQJDjVdr

provide an alternative, more straightforward method, if available instead of this ?

Your process to generate the address from the hex private key is right, but when you are attacking private keys with brute force there are tons of ways to do it.

People do it the same way as you because they bruteforce the Hex Pk, ...000001, ....000002, etc. But if you want to know an alternate method let me explain one of my favorites:

You can start from the Address: 13zb1hQbWVnN3ag9GNS2vCraT8PQJDjVdr and get the RIPEMD-160 (20d45a6a7625334252c8318a87ed303533c1c7bb).

Sites like privatekeys.pw provide that Hash 160 as you can see in the next link: https://privatekeys.pw/address/bitcoin/13zb1hQbWVnN3ag9GNS2vCraT8PQJDjVdr

And if you want to get that RIPEMD-160 code by yourself you can use the next python script.

Code:
python3 -c "import binascii, hashlib, base58; hash160 = binascii.hexlify(base58.b58decode_check(b'13zb1hQbWVnN3ag9GNS2vCraT8PQJDjVdr')).decode()[2:]; print(hash160)"

Once you have the hash160 you can use tools like brainflayer to get the Private key from the hash160.

I want to be clear, is not the best way but is just a different way to do it.
nomachine
Full Member
***
Offline Offline

Activity: 798
Merit: 134



View Profile
September 05, 2023, 02:10:52 PM
Last edit: September 05, 2023, 03:26:48 PM by nomachine
 #3397

1 - Convert the private key from hex to bytes
00000000000000000000000000000000000000000000000354d62e5f7a0d2eb2
b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03T\xd6._z\r.\xb2'

2 - Create a signing key from the private key bytes using the SECP256k1 elliptic curve
<ecdsa.keys.SigningKey object at 0x000002D447E14400>

3 - Get the corresponding public key
02b21a6b1590b145841a0dabbe71ea01e29ed60f0e468cff36445a9c92eb3a6375
VerifyingKey.from_string(b'\x02\xb2\x1ak\x15\x90\xb1E\x84\x1a\r\xab\xbeq\xea\x01\xe2\x9e\xd6\x0f\x0eF\x8c\xff6DZ\x9c\x92\xeb:cu', SECP256k1, sha1)

4 - Serialize the public key in compressed format (33 bytes)
b'\x02\xb2\x1ak\x15\x90\xb1E\x84\x1a\r\xab\xbeq\xea\x01\xe2\x9e\xd6\x0f\x0eF\x8c\xff6DZ\x9c\x92\xeb:cu'
02b21a6b1590b145841a0dabbe71ea01e29ed60f0e468cff36445a9c92eb3a6375

5 - Calculate the SHA-256 hash of the public key
b'\t\xb4\x87?D\'I\xef>\x86\xc7\x1d\x92\x86\xb1"\xa9\xdd\xf9v%\xa0\x03X\x88\xfb\x96%F\x0e\'\x16'
09b4873f442749ef3e86c71d9286b122a9ddf97625a0035888fb9625460e2716

6 - Calculate the RIPEMD-160 hash of the SHA-256 hash
<ripemd160 HASH object @ 0x000002D4477BF690>
b' \xd4Zjv%3BR\xc81\x8a\x87\xed053\xc1\xc7\xbb'
20d45a6a7625334252c8318a87ed303533c1c7bb

7 - Add the version byte (0x00 for mainnet) to the RIPEMD-160 hash
b'\x00'

8 - Extended RIPEMD-160 Hash
b'\x00 \xd4Zjv%3BR\xc81\x8a\x87\xed053\xc1\xc7\xbb'
0020d45a6a7625334252c8318a87ed303533c1c7bb

9 - Calculate the double SHA-256 checksum
b'\x01\x02l\xf90\xf6N\x8f\xeb\xca\xc8\xc2\x15\xd9Q\xb8i))\xb0\xce:\xb1\xba\x9e\xa4\xa1\x07_\x05\xe2\xa2'
b'\x01\x02l\xf9'

10 - Checksum: 01026cf9

11 - Append the checksum to the extended RIPEMD-160 hash
b'\x00 \xd4Zjv%3BR\xc81\x8a\x87\xed053\xc1\xc7\xbb\x01\x02l\xf9'
0020d45a6a7625334252c8318a87ed303533c1c7bb01026cf9

12 - Address (with checksum)
0020d45a6a7625334252c8318a87ed303533c1c7bb01026cf9

13 - Convert the bytes to a base58-encoded Bitcoin address
13zb1hQbWVnN3ag9GNS2vCraT8PQJDjVdr

provide an alternative, more straightforward method, if available instead of this ?
Translated into Python3 :
Code:
import hashlib
import ecdsa
import base58

# Private key in hexadecimal format
private_key_hex = "00000000000000000000000000000000000000000000000354d62e5f7a0d2eb2"

# Convert private key from hex to bytes
private_key_bytes = bytes.fromhex(private_key_hex)

# Create a signing key from the private key bytes using SECP256k1 curve
signing_key = ecdsa.SigningKey.from_string(private_key_bytes, curve=ecdsa.SECP256k1)

# Get the corresponding public key in compressed format
compressed_public_key = signing_key.get_verifying_key().to_string("compressed")

# Calculate the SHA-256 hash of the compressed public key
sha256_hash = hashlib.sha256(compressed_public_key).digest()

# Calculate the RIPEMD-160 hash of the SHA-256 hash
ripemd160_hash = hashlib.new('ripemd160', sha256_hash).digest()

# Add the version byte (0x00 for mainnet) to the RIPEMD-160 hash
extended_ripe160_hash = b'\x00' + ripemd160_hash

# Calculate the double SHA-256 checksum
checksum = hashlib.sha256(hashlib.sha256(extended_ripe160_hash).digest()).digest()[:4]

# Append the checksum to the extended RIPEMD-160 hash
address_bytes = extended_ripe160_hash + checksum

# Convert the bytes to a base58-encoded Bitcoin address
bitcoin_address = base58.b58encode(address_bytes).decode()

print("Bitcoin Address:", bitcoin_address)

The process of deriving a Bitcoin address from a private key involves several cryptographic operations and encoding steps, so there isn't a significantly shorter method to achieve this without skipping any essential steps.

While it may be possible to write more concise code or create a custom function to encapsulate the process, the core steps themselves are fundamental to Bitcoin address generation.

So there is no way to speed up more through the code. Unfortunately. Grin


p.s.
You can use import secp256k1 as ice
https://github.com/iceland2k14/secp256k1
(You must have this function in the same folder where the command is executed for it to work.)
This is the a custom function which encapsulate the process above :
Code:
import secp256k1 as ice

private_key_hex = "00000000000000000000000000000000000000000000000354d62e5f7a0d2eb2"
dec = int(private_key_hex, 16)
bitcoin_address = ice.privatekey_to_address(0, True, dec)
print("Bitcoin Address:", bitcoin_address)
or:
Code:
python3 -c "import secp256k1 as ice; private_key_hex = '00000000000000000000000000000000000000000000000354d62e5f7a0d2eb2'; dec = int(private_key_hex, 16); bitcoin_address = ice.privatekey_to_address(0, True, dec); print('Bitcoin Address:', bitcoin_address)"

Bitcoin Address: 13zb1hQbWVnN3ag9GNS2vCraT8PQJDjVdr

But this method is not much faster for me. It all depends on how it is used.

BTC: bc1qdwnxr7s08xwelpjy3cc52rrxg63xsmagv50fa8
digaran
Copper Member
Hero Member
*****
Offline Offline

Activity: 1330
Merit: 905

🖤😏


View Profile
September 05, 2023, 04:16:10 PM
Last edit: September 06, 2023, 02:42:40 PM by digaran
 #3398

provide an alternative, more straightforward method, if available instead of this ?

Skip steps 7 up to 13.



Nothing going on around these woods, lets make up new methods and try them to see if one of them works, here is something to work on.
End range :
400000000000000000000000000000000
Fake #130 key :

2c54a14a9556f03272bac1cd222396b57
Subtract 130 from end range : #2

13ab5eb56aa90fcd8d453e32dddc694a9
Subtract above #2 from 130 = #3 :

18a942952aade064e575839a44472d6ae
Subtract #3 from #2 = #4 :

4fde3dfc004d09758304567666ac4205
Multiply #4 by *4 = #5 :

13f78f7f0013425d60c1159d99ab10814
Subtract #5 from #2 = #6 :

4c30c9956a328fd37bd76abbcea736b

Figure out the rest and good luck. 😉

🖤😏
nomachine
Full Member
***
Offline Offline

Activity: 798
Merit: 134



View Profile
September 06, 2023, 08:36:08 PM
 #3399

Nothing going on around these wood

We play with  numbers with at least 20 decimal places here.
If you could make one Giga (10^9) guesses per second, it would take:

10^20 / 10^9 = 10^11 seconds

This is equivalent to roughly 3.2 million years. So, even with an incredibly fast computer making a Giga guesses per second, it would take millions of years to guess a 20-decimal-place number.

We'd better start practicing crystal ball gazing to guess what the correct range of Puzzle 66 is Grin

BTC: bc1qdwnxr7s08xwelpjy3cc52rrxg63xsmagv50fa8
modma
Newbie
*
Offline Offline

Activity: 10
Merit: 0


View Profile
September 06, 2023, 10:45:41 PM
 #3400

Nothing going on around these wood
We'd better start practicing crystal ball gazing to guess what the correct range of Puzzle 66 is Grin
first sensible thought in last 10+ pages
Pages: « 1 ... 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 [170] 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 ... 630 »
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!