Post
Topic
Board Development & Technical Discussion
Re: Private key to public key (TUTORIAL)
by
ricardosuperx
on 03/05/2020, 14:53:33 UTC
-snip-
Thanks for the answer. I will correct my question.
I just wanted to understand the G + G2 point duplication part ... The public key of 2,
X =0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798.
But for me:
X = 02f37cccfdf3b97758ab40c52b9d0e160e0537f9b65b9c51b2b3e502b62df02f30

If you want to doule point P in order to receive R = P + P, you should make the following:

c = 3*P.x*Px*invert(2*P.y) % modulo
R.x = (c*c - 2*P.x) % modulo
R.y = (c*(P.x - R.x) - P.y) % modulo

modulo = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F

For your case with P = G = Point (Gx, Gy) where:
Gx = 0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798
Gy = 0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8

We have the following:
invert(2*P.y) = 0xb7e31a064ed74d314de79011c5f0a46ac155602353dc3d340fbeaeec9767a6a6
c = 0xcb35b28428101a303eb9d1235992ac63f58857c2f631ee6936d3aebbeddcd1b1
R.x = (c*c - 2*Gx) % modulo = 0xc6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5
R.y = 0x1ae168fea63dc339a3c58419466ceaeef7f632653266d0e1236431a950cfe52a

So we have R.x and R.y of the public key 2G = G + G (public key for private key = 2), and it is written in compressed format like:
02c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5
I have a doubt.
If the private key were 3 ... would it look like this?
R = P+P+P
c = 4*P.x*Px*invert(3*P.y) % modulo
R.x = (c*c - 3*P.x) % modulo