Post
Topic
Board Development & Technical Discussion
Re: Private key to public key (TUTORIAL)
by
bytcoin
on 15/09/2020, 17:47:36 UTC
That's what I wanted! Could you make private key 3?
We must not forget that there are two formulas
The one you used to find the point corresponding to the private key: 2 (or rather 0000000000000000000000000000000000000000000000000000000000000002 to be more precise) it is Duplication of points.
You did it in your example with the base point--> 1 + 1 =2  (but that could be another point)
To go now with 3 we need to do --> 2 + 1 = 3 (we have now 2 différents points and we can't doubling them)

For that you need to use the second formula:

modulo = 115792089237316195423570985008687907853269984665640564039457584007908834671663
Px = 89565891926547004231252920425935692360644145829622209833684329913297188986597 (x coordinate point 2)
Py = 12158399299693830322967808612713398636155367887041628176798871954788371653930 (y coordinate point 2)
Qx = 55066263022277343669578718895168534326250603453777594175500187360389116729240 (x coordinate point 1) not because it is the base point, just because it is the point n°1
Qy = 32670510020758816978083085130507043184471273380659243275938904335757337482424 (y coordinate point 1)

dx = (Qx - Px) % modulo             --> 34499628904269660561674201530767158034393542375844615658184142552908072257357
dy = (Qy - Py) % modulo             --> 95279978516251208768455708490894263304954079172022948940317551626939868843169
c = dy * invert(dx) % modulo       --> 23578750110654438173404407907450265080473019639451825850605815020978465167024
Rx = (c*c - Px - Qx) % modulo     --> 112711660439710606056748659173929673102114977341539408544630613555209775888121 (x coordinate of point (2+1 =3)
Ry = (c*(Px - Rx) - Py) % modulo --> 25583027980570883691656905877401976406448868254816295069919888960541586679410   (y coordinate of point (2+1 =3)

Can't explain better



Order: 115792089237316195423570985008687907852837564279074904382605163141518161494337

Base Point: (55066263022277343669578718895168534326250603453777594175500187360389116729240, 32670510020758816978083085130507043184471273380659243275938904335757337482424)

Modulo: 115792089237316195423570985008687907853269984665640564039457584007908834671663

Private key:  0000000000000000000000000000000000000000000000000000000000000003

Point addition:(2G+1G =3G)
Compressed public key;
In decimal;
Equation:

c = (qy – py) / (qx – px)
rx = c^2 – px – qx

px = 89565891926547004231252920425935692360644145829622209833684329913297188986597
py = 12158399299693830322967808612713398636155367887041628176798871954788371653930
qx = 55066263022277343669578718895168534326250603453777594175500187360389116729240
qy = 32670510020758816978083085130507043184471273380659243275938904335757337482424

c = 32670510020758816978083085130507043184471273380659243275938904335757337482424-
12158399299693830322967808612713398636155367887041628176798871954788371653930=
20512110721064986655115276517793644548315905493617615099140032380968965828494


c = 55066263022277343669578718895168534326250603453777594175500187360389116729240-
89565891926547004231252920425935692360644145829622209833684329913297188986597=
81292460333046534861896783477920749818876442289795948381273441455000762414306


c = 20512110721064986655115276517793644548315905493617615099140032380968965828494/
81292460333046534861896783477920749818876442289795948381273441455000762414306=
23578750110654438173404407907450265080473019639451825850605815020978465167024


c = 23578750110654438173404407907450265080473019639451825850605815020978465167024


rx = 23578750110654438173404407907450265080473019639451825850605815020978465167024^2 -
89565891926547004231252920425935692360644145829622209833684329913297188986597-
55066263022277343669578718895168534326250603453777594175500187360389116729240

rx = 25759636913902563110438328477658084082469757293658084474899962813078412260632-
34499628904269660561674201530767158034393542375844615658184142552908072257357

rx = 107052097246949097972335111955578833901346199583454032856173404268079174674938


rx hex = 0xecad56ff86123a68f47514b195ab6837ba69c1fbdf0beb6339e6f3caead069fa


Now I will try to calculate the private key 0000000000000000000000000000000000000000000000000000000000000005


@ricardosuperx, rx should be
DEC 112711660439710606056748659173929673102114977341539408544630613555209775888121
HEX 0xf9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9