The one-sentence version
On the curve , the rule "draw a line, find the third intersection, then reflect" "adds" two points to give a third, and so all the points form an abelian group. Adding to itself times to get is fast; going the other way, finding from and , is extremely hard (the elliptic curve discrete logarithm problem). A Bitcoin or Ethereum private key is exactly this .
This article has three layers:
- The intuition: the chord-and-tangent rule and "walking steps"
- Real-world use: Bitcoin, Ethereum, Apple Pay, Signal and the PS3 private key leak
- The mathematics: the group law, curves over finite fields, ECDSA and a worked example over
Layer 1: The Intuition
1.1 What an elliptic curve looks like
Elliptic curves have nothing to do with ellipses (the name comes from integrals for the arc length of an ellipse). An elliptic curve is simply the graph of the equation
and it is symmetric about the -axis. Bitcoin's secp256k1 is about the simplest one: .
1.2 The chord-and-tangent rule: how "addition" is defined
Take two points and on the curve:
- Draw the line through and . It always meets the curve at a third point (a cubic equation has three roots);
- Reflect across the -axis to get ;
- Define .
If , use the tangent at in place of the line through the two points. If the line is vertical ( and its reflection), the intersection is "at infinity", written , and it serves as the zero element.
Amazingly, this seemingly arbitrary rule is commutative and associative, has a zero element, and gives every point an inverse (its reflection). In other words, the points on the curve form a group.
1.3 Private keys and public keys
- Private key: a very large random integer (256 bits in Bitcoin);
- Public key: the public base point added to itself times, .
It is like starting from on a giant, erratically jumping clock face and walking steps. Given the start and the end, you can hardly work out how many steps were taken. With the "double-and-add" trick, computing takes only about doublings and additions; finding in reverse takes even the best algorithms about steps.
Layer 2: Real-World Use
| Where | Curve / algorithm |
|---|---|
| Bitcoin and Ethereum transaction signatures | secp256k1 + ECDSA (Bitcoin Taproot switched to Schnorr) |
| HTTPS key exchange | X25519 (ECDH on Curve25519) |
| SSH, Signal, Git signing | Ed25519 |
| Apple Pay, bank card chips, passports | NIST P-256 |
| Ethereum consensus layer | BLS12-381 (a pairing-friendly curve; see "Bilinear Pairings and BLS Signatures") |
Why it's preferred over RSA: for the same 128-bit security, an elliptic curve key is 256 bits while RSA needs 3072. Short keys, short signatures and fast computation all matter for phones, smart cards and blockchains.
The PS3 private key leak (2010)
An ECDSA signature needs a random number that is different every time. Sony used one fixed to sign PS3 games. The hacker group fail0verflow took two signatures, wrote down an equation and solved for the private key, after which anyone could sign "official" software. In 2013 some Android Bitcoin wallets also reused because of a random number generator bug, and bitcoin was stolen. Section 3.4 explains why.
The quantum threat
Shor's algorithm also solves the elliptic curve discrete logarithm, so ECC falls to quantum computers just as RSA does. See "Post-Quantum Cryptography".
Layer 3: The Mathematics
3.1 Formulas for the group law
Let and . First find the slope of the line:
Then
Derivation: substituting into the curve equation gives a cubic with leading term and coefficient . By Vieta's formulas, the three roots sum to .
Associativity is the hardest part: expanding the formulas directly is extremely tedious. More elegant proofs use algebraic geometry (the Riemann–Roch theorem or the Cayley–Bacharach theorem); here we simply accept it.
3.2 Moving to a finite field
Cryptography doesn't use the real numbers but a finite field : every division in the formulas above becomes multiplication by a multiplicative inverse modulo . The curve turns into a scatter of discrete points, but the group law formulas don't change at all, and it is still an abelian group.
How many points are there? Hasse's theorem says , so the number of points is about . In practice one picks a curve whose point count is a large prime (or a large prime times a small cofactor), so the group is nearly cyclic and has no small subgroups to exploit (see Pohlig–Hellman in "Diffie–Hellman and the Discrete Logarithm").
3.3 A worked example: a curve over
over , with base point
First check that is on the curve: . ✓
Compute (tangent):
- . and , so
Keep adding:
| 1 | 10 | ||
| 2 | 11 | ||
| 3 | 12 | ||
| 4 | 13 | ||
| 5 | 14 | ||
| 6 | 15 | ||
| 7 | 16 | ||
| 8 | 17 | ||
| 9 | 18 |
(the point at infinity). So has order and generates a cyclic group of order . Note that , exactly the reflection of .
The discrete logarithm problem: if you are told only and asked for in , you can only try values one by one; the table gives . On a real curve this table has rows. (Checked with Python.)
3.4 ECDSA, and why reusing is fatal
Let the base point have order , with private key , public key and message hash .
Signing: choose a random , compute , take , and
The signature is . Verification: compute and , and check that the -coordinate of equals . (Because .)
What happens if repeats: two messages use the same , so is the same, and
Two lines of algebra yield the private key. That is all the mathematics of the PS3 incident. Modern implementations use RFC 6979: is generated deterministically from the private key and the message hash, which doesn't depend on the quality of a random number generator and guarantees different messages get different values of .
Summary
| Layer | Key points |
|---|---|
| Intuition | Draw a line, find the third point, reflect: that is "addition" |
| Algebra | Points on the curve form an abelian group; over a finite field there are about points; choose a prime-order group |
| Security | Finding from and is extremely hard (about steps) |
| Engineering | Short keys and fast operations; the signing nonce must never repeat |