In the ECDSA algorithm, the Bitcoin private key is supposedly a point on the graph (or is it?). But the private key is a single integer, and not x,y coordinates. Is the integer, by itself, the x value or the y value? If it is x, then what is y? If it is y, then what is x?
The basic elliptic curve operation is addition of points. The operation of applying this addition repeatedly is called the scalar multiplication of a point by an integer.
The private key is the 'scalar', the point being multiplied is the 'Generator' point, the result is the public key.
Scalar multiplication is basically repeated addition. Multiplying the Generator point by 5 means: calculating G+G+G+G+G.
You calculate this by first calculating G2= G+G, then G4=G2+G2, then G5=G4+G.
The curve formula
The formula for the curve used by bitcoin calculations is as follows:
y^2 == x^3 + 7 ( mod p )
p = 2^256 - 2^32 - 977
Points on the curve
a point (x,y) is on the curve if it matches the above equation
Curve addition is best visualized geometrically
image from certicom
Elliptic curve cryptography does not use floating point values for it's coordinates, all calculations are done in integers modulo a large prime ( mentioned above, named p ). But the method of calculating the sum of 2 points remains the same.
Add points P1=(x1,y1) and P2=(x2,y2), resulting in Psum= (xsum, ysum)
slope = (y1-y2)/(x1-x2) xsum = slope^2 - (x1+x2) ysum = slope*(x1-xsum)-y1
if P1 and P2 are the same point, the above adding formula would involve a division by zero, so a different formula is needed to calculate P+P
slope = 3 * x^2 / (2*y) xdbl = slope^2 - 2*x ydbl = slope *(x-xdbl)-y
For ECDSA a generator point
G was chosen.
The private key is just an integer, lets name it
The public key is the generator point added to itself
k number of times. In other words, multiplied by
If you choose your privatekey unwisely, say 1, your public key would equal the generator point, this address: 1EHNa6Q4Jz2uvNExL497mE43ikXhwF6kZm
As you can see, it was even used recently.
What makes ECDSA a useful crypto system, is that it is easy to calculate a public key from a privatekey, but not the other way around. Another way of putting this is that multiplication is easy, but there is no (easy) division algorithm on an elliptic curve.
See this gist for an example in python
The public key is a point, the private key is a 256 bit integer. We don't actually store the point as x,y as part of the public key though, we store x and the sign of y to save space.