Can you tell me in your formulas what each element means... Also, can you tell me where is the part where the private key value is added to equation
P, Q, and R are simply points on the elliptic curve.
x and y refer to the x and y coordinates of each point.
s refers to the slope of the line you are calculating.
a is taken from the elliptic curve equation, y
2 = x
3 + ax + b. In bitcoin's case a = 0.
As you point out, the private key 0000...001 gives the public key which is equal to the generator point (G):
x = 79BE667E F9DCBBAC 55A06295 CE870B07 029BFCDB 2DCE28D9 59F2815B 16F81798
y = 483ADA77 26A3C465 5DA4FBFC 0E1108A8 FD17B448 A6855419 9C47D08F FB10D4B8
If you want to find the public key for private key 0000...002, then you need to calculate 2G.
So, let P = G, and let R = 2G. You then take the equation I gave above:
s = (3x
p2 + a)/(2y
p)
And plug in all the numbers. Three multiplied by the x coordinate of G squared, over two multiplied by the y coordinate of G. That gives you s.
You then take the next two equations:
x
r = s
2 - x
p - x
qy
r = -y
p + s(x
p - x
r)
s squared minus the x coordinate of G twice (x
p and x
q are the same since we are adding the same point (G) to itself) to find the x coordinate of 2G.
Subtract the x coordinate of 2G from the x coordinate of G, multiply by s, and subtract the y coordinate of G.
This will give you the x and y coordinates of 2G.
All this will be done modulo
p, the field of the curve.
So, if your private key is 4, then your public key is the point that you get to when you perform G + G + G + G. If your private key is 7 then your public key is the point that you get to when you perform G + G + G + G + G + G + G
You wouldn't do that, though. You would do G + G = 2G, 2G + 2G = 4G, 4G + 2G = 6G, and 6G + G = 7G. Four calculations rather than six.