Pages:
Author

Topic: Bitcoin puzzle transaction ~32 BTC prize to who solves it - page 13. (Read 230658 times)

member
Activity: 194
Merit: 14
I have the feeling that RetiredCoder is the creator of the puzzles himself.
?
Activity: -
Merit: -
I won't post its source, but soon I will post some software for K (examining K*sqrt required ops) - from classic 2.1 to best 1.23 so people who are interested can learn some things.
I solved #120, #125 and #130 for now, for 130 DB with DP was about 1TB.
About big DP overhead in JLP you can check my old posts, I'm glad that it's super easy for you to make less number but faster kangaroos to reduce this overhead  Grin


How do you managed and accessed the DP database efficiently, given its 1TB size. Did you employ any specific data structures or caching strategies to minimize access time?

You mentioned achieving a reduction in the required operations from classic 2.1 to best 1.23 in K * sqrt terms. Could you explain what methods or optimizations contributed most to this efficiency? How did you implement these changes in your software?

When transitioning from JLP's code to your custom implementation, what metrics did you use to benchmark efficiency improvements? Were there any specific areas where you saw the most significant speed gains?

Most answers in sources here: https://bitcointalksearch.org/topic/solving-ecdlp-with-kangaroos-part-1-2-5517607
About DB - I stored it in RAM directly Smiley
jr. member
Activity: 42
Merit: 0
I won't post its source, but soon I will post some software for K (examining K*sqrt required ops) - from classic 2.1 to best 1.23 so people who are interested can learn some things.
I solved #120, #125 and #130 for now, for 130 DB with DP was about 1TB.
About big DP overhead in JLP you can check my old posts, I'm glad that it's super easy for you to make less number but faster kangaroos to reduce this overhead  Grin


How do you managed and accessed the DP database efficiently, given its 1TB size. Did you employ any specific data structures or caching strategies to minimize access time?

You mentioned achieving a reduction in the required operations from classic 2.1 to best 1.23 in K * sqrt terms. Could you explain what methods or optimizations contributed most to this efficiency? How did you implement these changes in your software?

When transitioning from JLP's code to your custom implementation, what metrics did you use to benchmark efficiency improvements? Were there any specific areas where you saw the most significant speed gains?
?
Activity: -
Merit: -
Isn't this a super easy task, to test? Give me the same program, and I will run it with a GPU and then with a CPU, and let's see which solves the key first. Let's make it an 80 bit range. 1 GPU versus a single core, or do you want to use as many cores as the CPU has? Any bets on which one finds the key first?

80bit yes, because you can use low DP. For 120-130 and higher - you have to use high DP and you will get big overhead with JLP. And it's not easy to test 120-130bit range to confirm Smiley

Also, RetiredCoder, make mods to the program, to create less "kangs" when using a GPU, if it's to crazy for you...it's super easy to do. And another question, how does the speed of "kangs", impact the finding of High DP bits. Does a CPU (which the individual kangs are faster) find high DP bits, faster? Or does the GPU's slow, but many, find more, DP bits, faster?
And the last question, which "high puzzles" have you solved and what did you use to solve (CPU, GPU, DP, etc)

Yes I started with JLP code a long time ago, but after some time I got enough experience and I created my own software from scratch - much faster and efficient. So it's not a mod.
I won't post its source, but soon I will post some software for K (examining K*sqrt required ops) - from classic 2.1 to best 1.23 so people who are interested can learn some things.
I solved #120, #125 and #130 for now, for 130 DB with DP was about 1TB.
About big DP overhead in JLP you can check my old posts, I'm glad that it's super easy for you to make less number but faster kangaroos to reduce this overhead  Grin
newbie
Activity: 8
Merit: 0

Hi,

As far as I have studied bitcoin, it's highly impossible for this addresses to came from one deterministic wallet. Please, correct me if I am wrong. Creating deterministic wallet You have no influence on final shape of priv keys so Yo can not made them,1bit, 2bit, 3bit etc.

BR
Damian

You can have a deterministic wallet and get the first 160 address. Get those private keys, mask them for you need (flip ones and zeros as you wish), and create addresses for these modified private keys.

I think these keys are from a deterministic wallet but not just 256 keys, he created like 20000 keys or more, puzzle 65 private key might be the 10000th key masked down, 66 private key the 1500th key masked down and 67 the 7600th key masked down. Just in any case some people might use the keys to derive the seed, they will always fail cause the keys are not in order the way it was generated. He said he spent two years creating this challenge, if he just generated 256 keys and masked them down, it would not take 48 hours.
full member
Activity: 1162
Merit: 237
Shooters Shoot...
Powers of two, and adjust the last element to the value needed to have the desired average.
This jump set was proven optimal here (e.g. minimizes total number of operations):
Kangaroos, Monopoly and Discrete Logarithms, J. M. Pollard, 2000

Well, ok. But I use fixed length table for all tests, it's more practical for implementation, also I get better results for longer list than using powers of two.
I will try your approach to see results.

Question for you: do you prefer fewer kangaroos that jump faster, or lots of kangaroos that jump slower?

I prefer faster kangs because of high DP bits that I have to use to solve high puzzles, to get smaller overhead. But even so, the number of kangs is crazy because there are many GPUs and every GPU has a lot of kangs anyway.

How can you explain case #3 (the awful case with runtime 172 sqrt)? When the Tame and Wild are separated by a distance of b/2, and the average jump size is much too small, it will take a lot of jumps for them to ever meet. In the random case, it's a little better than that, but still too far from the optimal case (e.g. a correct larger average jump size).

Main question here is how many times do you solve a point to calculate average result value? In my tests I solve at least 1000 times.

Quote
I never understodd why JLP and the clones leaned towards squeezing more kangaroos into GPU memory; it slows down everything, instead of speeding things up. Lower throughput, lower speed/kang, and a really high DP overhead.

Like what are y'all even talking about here? You prefer faster kangaroos versus more, slower kangaroos...ok, what's the sweet spot? What bit range? What DP is used?

All of these play a factor...I don't think you can say x y z is always better.

Isn't this a super easy task, to test? Give me the same program, and I will run it with a GPU and then with a CPU, and let's see which solves the key first. Let's make it an 80 bit range. 1 GPU versus a single core, or do you want to use as many cores as the CPU has? Any bets on which one finds the key first?
Also, RetiredCoder, make mods to the program, to create less "kangs" when using a GPU, if it's to crazy for you...it's super easy to do. And another question, how does the speed of "kangs", impact the finding of High DP bits. Does a CPU (which the individual kangs are faster) find high DP bits, faster? Or does the GPU's slow, but many, find more, DP bits, faster?
And the last question, which "high puzzles" have you solved and what did you use to solve (CPU, GPU, DP, etc)
newbie
Activity: 20
Merit: 0
Hello everyone, maybe someone will be interested:
if this puzzle is a deterministic wallet,

Hi,

As far as I have studied bitcoin, it's highly impossible for this addresses to came from one deterministic wallet. Please, correct me if I am wrong. Creating deterministic wallet You have no influence on final shape of priv keys so Yo can not made them,1bit, 2bit, 3bit etc.

BR
Damian

You can have a deterministic wallet and get the first 160 address. Get those private keys, mask them for you need (flip ones and zeros as you wish), and create addresses for these modified private keys.
newbie
Activity: 4
Merit: 0
Hello everyone, maybe someone will be interested:
if this puzzle is a deterministic wallet,

Hi,

As far as I have studied bitcoin, it's highly impossible for this addresses to came from one deterministic wallet. Please, correct me if I am wrong. Creating deterministic wallet You have no influence on final shape of priv keys so Yo can not made them,1bit, 2bit, 3bit etc.

BR
Damian
?
Activity: -
Merit: -
Hello everyone, maybe someone will be interested:
if this puzzle is a deterministic wallet, and if each subsequent private key becomes 2x harder, the bitcoin at that address also doubles,can it then its seed phrase is 1.2.4.8.16.32.64.128.256.512.1024.2048. be it might just be nonsense.
      
2^0 2^1 2^2 2^3 2^4 … 2^11
1.2.4.8.16.32.64.128.256.512.1024.2048.
abandon ability about abstract acid advance among avocado cable divide lend zoo
      
If it turns out as I said, I think that the person who finds the solution will give me a refund.
sorry for bad english

Hello everyone, maybe someone will be interested:
if this puzzle is a deterministic wallet, and if each subsequent private key becomes 2x harder, the bitcoin at that address also doubles,can it then its seed phrase is 1.2.4.8.16.32.64.128.256.512.1024.2048. be it might just be nonsense.
      
2^0 2^1 2^2 2^3 2^4 … 2^11
1.2.4.8.16.32.64.128.256.512.1024.2048.
abandon ability about abstract acid advance among avocado cable divide lend zoo
      
If it turns out as I said, I think that the person who finds the solution will give me a refund.
sorry for bad english
I know that the creator of the puzzle said that there is no pattern
What does the creator say to this?
can you comment?
?
Activity: -
Merit: -
Powers of two, and adjust the last element to the value needed to have the desired average.
This jump set was proven optimal here (e.g. minimizes total number of operations):
Kangaroos, Monopoly and Discrete Logarithms, J. M. Pollard, 2000

Well, ok. But I use fixed length table for all tests, it's more practical for implementation, also I get better results for longer list than using powers of two.
I will try your approach to see results.

Question for you: do you prefer fewer kangaroos that jump faster, or lots of kangaroos that jump slower?

I prefer faster kangs because of high DP bits that I have to use to solve high puzzles, to get smaller overhead. But even so, the number of kangs is crazy because there are many GPUs and every GPU has a lot of kangs anyway.

How can you explain case #3 (the awful case with runtime 172 sqrt)? When the Tame and Wild are separated by a distance of b/2, and the average jump size is much too small, it will take a lot of jumps for them to ever meet. In the random case, it's a little better than that, but still too far from the optimal case (e.g. a correct larger average jump size).

Main question here is how many times do you solve a point to calculate average result value? In my tests I solve at least 1000 times.
newbie
Activity: 38
Merit: 0
I might be thinking about this wrong but if you had a DB of DPs for say the 70 bit range then could use alberts ecctools to divide the #135 to that range and check for collisions, would that be faster then running bsgs over and over on that range for each pubkey.
?
Activity: -
Merit: -
The average jump distance is the one that needs to be multiplied by m, not every jump distances!
The average jump distance = sum(jump_distances) / len(jump_distances)
...
Tame = random between b/2 and b
Wild = random between 1 and b / 2
alpha = sqrt(b) : 21 jump points. Results:

If I need to increase average distance I generate larger jumps, but I don't change the number of jumps in the jump table.
But it seems you do, you added 8 more points to get x256 average distance somehow. So next my question is how do you generate the jump table?
sr. member
Activity: 642
Merit: 316
The optimal value of the jump range is when the kangaroos do not run further than 2 ranges during the solving:
Code:
expected_op = 2.076 * math.sqrt(range) + Nkangaroo
opimal_jmp_distance = range * 2 // expected_op

or simply math.sqrt(range)

But trick probably won't work for puzzles...
For example, you solved 120bit range and accumulated points. The optimal jump distance for this range is 2^59.95.
When you expand these points to the next range - 125bit, they will all be in the range of 2^125, but the average jump distance will be multiplied by 32 and will be 2^64.95.
At the same time, for 125 bits of range, the optimal jump distance is 2^62.44. This means that by the time you accumulate the required number of points for the solution, they will go 5.7 times further out of range. There is no problem that they out of range, kangaroos always run forward, but there will be no benefit from the points that remain in the range of 2^125
Most likely the trick works well when you have a huge base of accumulated points and you can use this to expand the range, knowing that the number of points is enough for the solution.
?
Activity: -
Merit: -
If we have some optimal average jump distance = m * sqrt(b) / 4 where m = number of kangaroos

Why do you think so? From my experience, optimal average jump distance does not depend on the number of kangs (at least if you have many of them), it's always about sqrt(range).
sr. member
Activity: 642
Merit: 316
So the trick is to spread out existing DPs into the higher interval, by changing the perspective on the generator..
But because jump rules need to be identical, this means the jumps are also multiplied as well, to make the same jumps, like this:
You are absolutely right, the jump table should be multiplied. I can't say anything about the optimal distance. I just wanted to try again if it works, because 4 years ago, I missed the point with the jump multiplier.
I'm not sure about the practical benefit of the method, but some boost of 12% can be obtained when moving from puzzle to puzzle.
?
Activity: -
Merit: -
Not only the next one.. 80 bit DPs extended to 90 bit range:
But of course there is a limitation here and it depends on the number of accumulated DPs.
Let's say, 95 bits I will not be able to solve with the number of DPs that I have.

Exactly. If you solved #80, DB with DPs for it will help only like 5-10% to solve #85. But if you have huge x10 DB for #80 you can solve 80-bit range very quickly and also solve #85 much faster, and even #90 will be solved a bit faster. But for high-number puzzles probably you don't have x10 DB.
sr. member
Activity: 642
Merit: 316
What trick is that?
https://bitcointalksearch.org/topic/m.54629413

Yes, old DPs can be reused if you keep old jump table, but they don't help much.
It's a good idea to use them for one next puzzle to improve chances a bit, but that's all.

Not only the next one.. 80 bit DPs extended to 90 bit range:
Code:
Start:0
Stop :3FFFFFFFFFFFFFFFFFFFFFF
Keys :1
KeyX :672DDE17A8F345C04D6C0B5C53750E107907313ECF5B3FFDB122868515ECD171
KeyY :B151B8521AA206F51FE685A231C5FAED10D903DA70F15EDDE3C09CB2AC41AA08
LoadWork: [HashTable 7449.0/9315.7MB] [35s]
Number of CPU thread: 0
NB_RUN: 64
GPU_GRP_SIZE: 128
NB_JUMP: 32
Range width: 2^90
Jump Avg distance: 2^40.03
Number of kangaroos: 2^20.46
Suggested DP: 24
Expected operations: 2^46.08
Expected RAM: 2725.0MB
DP size: 20 [0xFFFFF00000000000]
GPU: GPU #0 NVIDIA GeForce GTX 1660 SUPER (22x64 cores) Grid(88x128) (141.0 MB used)
SolveKeyGPU Thread GPU#0: creating kangaroos...
SolveKeyGPU Thread GPU#0: 2^20.46 kangaroos [10.5s]
[711.66 MK/s][GPU 711.66 MK/s][Count 2^49.63][Dead 0][32:00 (Avg 1.2d)][7483.8/9361.2MB]  Cur td: 8F8EDB4B5B318F159493
Mult td: 23E3B6D2D6CC63C56524C00

Key# 0 [1S]Pub:  0x02672DDE17A8F345C04D6C0B5C53750E107907313ECF5B3FFDB122868515ECD171
       Priv: 0x387599B938E25FF1A07C51E

Done: Total time 32:40
But of course there is a limitation here and it depends on the number of accumulated DPs.
Let's say, 95 bits I will not be able to solve with the number of DPs that I have.
?
Activity: -
Merit: -
Yesterday I finally decided to get out of the dusty shelf the trick that @arulbero came up with 4 years ago. I decided to try to expand 80-bit points to the 85-bit range. The expected solution time is 5 hours 35 minutes for GTX 1660s. 5 hours passed and nothing... I thought that this trick really won't work. But today I changed the jump table (as you hinted) and here is the result: on the first attempt the key in the 85-bit range was found in 6 minutes, and the second in 14 minutes.

Yes, old DPs can be reused if you keep old jump table, but they don't help much.
It's a good idea to use them for one next puzzle to improve chances a bit, but that's all.
sr. member
Activity: 642
Merit: 316
-snip-
It was already discussed on why I do not believe DPs can be reused for larger intervals, they will only ever get hit if the deterministic jump rules stay the same. The proportion between "found DPs" and "total existing DPs" is extremely low, so the sets of found DPs will likely not intersect, when jump rules change.
Yesterday I finally decided to get out of the dusty shelf the trick that @arulbero came up with 4 years ago. I decided to try to expand 80-bit points to the 85-bit range. The expected solution time is 5 hours 35 minutes for GTX 1660s. 5 hours passed and nothing... I thought that this trick really won't work. But today I changed the jump table (as you hinted) and here is the result: on the first attempt the key in the 85-bit range was found in 6 minutes, and the second in 14 minutes.
Code:
KeyX :1080678DD05E815CEB501F2B839F1CBBEE619F9FB00455F7B2D78AC192A3583F
KeyY :D7B0FCB2F91693B51D6B1A7A51142A91AC338D114BD990A3B425D61850C7A15B
LoadWork: [HashTable 7449.0/9315.7MB] [36s]
Number of CPU thread: 0
NB_RUN: 64
GPU_GRP_SIZE: 128
NB_JUMP: 32
Range width: 2^85
Jump Avg distance: 2^40.03
Number of kangaroos: 2^20.46
Suggested DP: 22
Expected operations: 2^43.71
Expected RAM: 536.9MB
DP size: 20 [0xFFFFF00000000000]
GPU: GPU #0 NVIDIA GeForce GTX 1660 SUPER (22x64 cores) Grid(88x128) (141.0 MB used)
SolveKeyGPU Thread GPU#0: creating kangaroos...
SolveKeyGPU Thread GPU#0: 2^20.46 kangaroos [10.8s]
[697.63 MK/s][GPU 697.63 MK/s][Count 2^49.63][Dead 0][14:29 (Avg 05:44:40)][7464.5/9336.8MB]  Cur td: CAD97661AD8E4C0EBB8D
Mult td: 195B2ECC35B1C981D771A0

Key# 0 [1S]Pub:  0x031080678DD05E815CEB501F2B839F1CBBEE619F9FB00455F7B2D78AC192A3583F
       Priv: 0x15A640BAD94A621F9A02F0
member
Activity: 348
Merit: 34
Dear Friends
i backed to home after 6 days, on 1st nov, immdiatly i need to start traveling to 2000 miles away, for attend my close relative funereal,
during my 2 days travel to go i see messages at mobile phone, due to non available my desktop system , i cant participate
upon reach back at my system, i start writing this post with most easiest method about KtimeG Challenge Game, its total 3 step to find missing part, and 2 step back to privatekey

raw work
maxkey (hex)- minkey (hex), see how much 0 right side apear (90 in this puzle)
convert minkey into mod N, and then pubkey
address pubkey - minkey pubkey
result pubkey div 16 ( due to minkey ref to hex) as we have counted 90's 0 , 90 time loop check,
last we have 5aad97e6e197ddf3d014 pubkey

Gpu process pubkey for private key, found (5aad97e6e197ddf3d014)

now reverse
5aad97e6e197ddf3d014 x 16, 90 times to fille back 90's 0
then result add minkey hex
Private Key !!!!!!!!!!!!

Breakup Below


A  minkey
0x659756abf6c17ca70e0000000000000000000140be6ddd93e441f8d4b4a85653b20b4cdcc5c74 8207a0daa16191d07a425d8080c276f9412472e0429e61bc355
Dec: 378910740179897432693357321750481224493231606889794828290705977402364066269
Hex: d674b47af96587841f00471e5106277467a472a4fe97b8a5ce8f152e24f9dd
Pubkey: 021e07dada5c10fe81d5780bf3c1b772915dd6db98044bf77216bbc5dda283955b

B  pubkey
0x659756abf6c17ca70e5aad97e6e197ddf3d01540be6ddd93e441f8d4b4a85653b20b4cdcc5c74 8207a0daa16191d07a425d8080c276f9412472e0429e61bc355
Dec: 81441912728144611542033516536424891594486853195135222765184684141394073615958
Hex: b40e7d34265ab9533a64622bd1a188fb8abb8829af545169abad49b46be5fe56
Pubkey: 03a61fc84b6429f07fc0edf25265ef7a0ced3cd9a0edea85e9f58b50b5d73f66e7

C maxkey
Dec: 62120226893276139655396064408353610522500686847644094598223336080741851159646
Hex: 8956cd6cbf12c663969a46006e11acfebf411f2e930704ee38d4fdeac9bf5c5e

B-A
0x5aad97e6e197ddf3d014000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000
Dec : 81063001987964714109340159214674410369993621588245427936893978163991709549689
Hex : b338087fab6153cbb64561e4b35082d41653e3b70a55b9b105deba9f3dc10479
Pubkey: 03634641685eca3f8284bcd4ddf233dac92a551bb5ff74a0b3fd587d4da7c13eea



(B-A)/16 loop 90

5aad97e6e197ddf3d014
Pubkey: 03a1708bbb4e9b81a738eaca200d2b06a8f1d351aa3b07c8e255850500bef5ec2b


raw homework for b-a at level of pubkey
>>> 0x659756abf6c17ca70e5aad97e6e197ddf3d01540be6ddd93e441f8d4b4a85653b20b4cdcc5c74 8207a0daa16191d07a425d8080c276f9412472e0429e61bc355-0x659756abf6c17ca70e0000000000000000000140be6ddd93e441f8d4b4a85653b20b4cdcc5c748207a0daa16191d07a425d8080c276f9412472e0429e61bc355
1005681669055354146613222747685626267813986635935225180005598248700045377814988 002421710664308410663717703967808552865612110780956672
>>> hex(1005681669055354146613222747685626267813986635935225180005598248700045377814988 002421710664308410663717703967808552865612110780956672)
'0x5aad97e6e197ddf3d014000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000'
>>>


any Question Huh??
who buy me a Coffee



ktg.py
its for B-A pubkeys

Code:
from fastecdsa.curve import secp256k1
from fastecdsa.point import Point
from fastecdsa import keys, curve
import gmpy2
import random
import numpy as np
p1 = 115792089237316195423570985008687907852837564279074904382605163141518161494337
def c2ux(point):

 x_hex = point[2:66]

 return x_hex



def c2uy(point):

 p_hex = 'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F'
 p = int(p_hex, 16)
 compressed_key_hex = point
 x_hex = compressed_key_hex[2:66]
 x = int(x_hex, 16)
 prefix = compressed_key_hex[0:2]

 y_square = (gmpy2.powmod(x, 3, p)  + 7) % p
 #y_square_square_root = gmpy2.powmod(y_square, (p+1)/4, p)
 y_square_square_root = gmpy2.powmod(y_square, (p+1) * gmpy2.powmod(4, p - 2, p) % p , p)
 if (prefix == "02" and y_square_square_root & 1) or (prefix == "03" and not y_square_square_root & 1):
     y = (-y_square_square_root) % p
 else:
     y = y_square_square_root

 computed_y_hex = format(y, '064x')


 return computed_y_hex


def cpub(x,y):
 prefix = '02' if y % 2 == 0 else '03'
 c = prefix+ hex(x)[2:].zfill(64)
 return c


p = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F

def decompress_pubkey(pk):
    x = int.from_bytes(pk[1:33], byteorder='big')
    y_sq = (pow(x, 3, p) + 7) % p
    y = pow(y_sq, (p + 1) // 4, p)
    if y % 2 != pk[0] % 2:
        y = p - y
    y = y.to_bytes(32, byteorder='big')
    return b'\x04' + pk[1:33] + y

# G point
xsorg = 0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798
ysorg = 0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8
Sorg = Point(xsorg, ysorg, curve=secp256k1)

# address pubkey point
line= '03a61fc84b6429f07fc0edf25265ef7a0ced3cd9a0edea85e9f58b50b5d73f66e7'    # main-pubkey
xs = int(c2ux(line),16)
ys = int(c2uy(line),16)
S = Point(xs, ys, curve=secp256k1)

# minkey Pubkey point
line1= '021e07dada5c10fe81d5780bf3c1b772915dd6db98044bf77216bbc5dda283955b' #   minkey-pubkey
xs1 = int(c2ux(line1),16)
ys1 = int(c2uy(line1),16)
S1 = Point(xs1, ys1, curve=secp256k1)

R1 = S-S1
xx=R1.x
yy=R1.y
R1pubkey=cpub(xx,yy)

print (R1pubkey)



ktg1.py
its for (B-A)Result pubkey and remove 90's 0,
thats all, you have missing part pubkey

Code:
from fastecdsa.curve import secp256k1
from fastecdsa.point import Point
from fastecdsa import keys, curve
import gmpy2
import random
import numpy as np
p1 = 115792089237316195423570985008687907852837564279074904382605163141518161494337
def c2ux(point):

 x_hex = point[2:66]

 return x_hex



def c2uy(point):

 p_hex = 'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F'
 p = int(p_hex, 16)
 compressed_key_hex = point
 x_hex = compressed_key_hex[2:66]
 x = int(x_hex, 16)
 prefix = compressed_key_hex[0:2]

 y_square = (gmpy2.powmod(x, 3, p)  + 7) % p
 #y_square_square_root = gmpy2.powmod(y_square, (p+1)/4, p)
 y_square_square_root = gmpy2.powmod(y_square, (p+1) * gmpy2.powmod(4, p - 2, p) % p , p)
 if (prefix == "02" and y_square_square_root & 1) or (prefix == "03" and not y_square_square_root & 1):
     y = (-y_square_square_root) % p
 else:
     y = y_square_square_root

 computed_y_hex = format(y, '064x')


 return computed_y_hex


def cpub(x,y):
 prefix = '02' if y % 2 == 0 else '03'
 c = prefix+ hex(x)[2:].zfill(64)
 return c


p = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F

# G point
xsorg = 0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798
ysorg = 0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8
Sorg = Point(xsorg, ysorg, curve=secp256k1)


# B-A pubkey to remove ending 0's
line= '03634641685eca3f8284bcd4ddf233dac92a551bb5ff74a0b3fd587d4da7c13eea'    # B-A-pubkey
xs = int(c2ux(line),16)
ys = int(c2uy(line),16)
S = Point(xs, ys, curve=secp256k1)

# we found 90's 0, fill in below line for div 16
for i in range(0,90):
  S = S*108555083659983933209597798445644913612035216511632722858692340445173276400941
  xx=S.x
  yy=S.y
  Spubkey=cpub(xx,yy)
print (Spubkey)

Pages:
Jump to: