Count n: how many G's so far
The Mirrored Vessel

The Mirrored Vessel

elliptic curve cryptography, turned on a lathe
Preset

An elliptic curve y² = x³ + ax + b is its own mirror image: every point (x, y) has a twin (x, −y). Its twin sits straight across the dashed mirror line. The gold line is the curve itself, over ordinary numbers. Drag to turn the view.

secp256k1 is y² = x³ + 7: a = 0, b = 7. With no x term, the curve has no bend to pinch, so Bitcoin's curve is one smooth sweep with no separate loop. Over the real numbers this is its exact shape, before everything is taken mod a 256-bit prime.
Δ ≈ 0 — the curve has a cusp or self-crossing here, so it isn't an elliptic curve and the addition rule breaks down.
  1. Draw the line through P and Q.
  2. It strikes the curve at exactly one more point, −R.
  3. If the line reaches the mirror it bounces; if not, it doesn't. Either way, folding stacks −R on its twin, so where the line stops is R = P + Q.
Log scale: far points now fit on the curve. The lines look curved only because the paper is stretched; they are still straight lines.
Straightened: the curve becomes a straight 45° line, its twin half the mirror image. Points sit along it by their angle round the curve, so the whole infinite curve fits, with 𝒪, the point at infinity, at the top end. Adding G then slides every point the same distance (folding back at the ends), and the walk spreads evenly. The paper is stretched to make this work, so straight lines bend, like light around a mass, but they still cross the gold line exactly where they meet the curve.

Cryptography uses the same rule, but on whole numbers mod a prime p. The smooth curve shatters into a constellation of points — and because x and y both wrap around, they live on a torus.

The mirror survives: (x, y) and (x, p − y) sit reflected across the torus's equator. Only the points you've already visited are shown, each with a faint thread to its twin; turn on ● Curve to see the whole curve.

Each step adds G: the line through the current point and G meets the curve at a third point −R (a flash, with no path), which then mirrors vertically through the equator to R. Why it lands there: the line is still y = m·x + c, but wrapped onto the torus it becomes a coil winding m times round the tube. Watch it draw: gold dots light up where it crosses the curve. It passes through the current point, G, and crosses exactly one more time, at −R. Pick a secret k and step G, 2G, 3G … The landing point k·G is your public key. Walking forward is easy; given only the gold point, recovering k means retracing a path that looks like noise — the discrete logarithm problem.

Here p = 97, so a computer finds k instantly by brute force. Switch to the Bitcoin preset to see the real thing.

This is secp256k1, Bitcoin's own curve: y² = x³ + 7 mod p, with p = 2²⁵⁶ − 2³² − 977. Every dot is a genuine point on it, placed at its true coordinates: x sets the angle around the ring, y the angle around the tube.

The curve has about 1.16 × 10⁷⁷ points. Only the points your key actually visits are shown. Turn on ● Curve to see a random sample of 1,600 real ones plus their 1,600 mirror twins; drawn in full, the torus would be solid fog.

Your private key is a number k. Your public key is k·G. Bitcoin doesn't step G, 2G, 3G… It reads k in binary, one bit at a time: double at every bit, then add G if the bit is 1. Each step draws a line from the current point to a third point on the curve, −R. Then it mirrors straight up or down through the equator to its twin R, which is the result. The strip below shows which bit caused each step. That's about 380 jumps for a 256-bit key, which is fast forward and hopeless backward.

Why does −R land where it does? Same rule as on the smooth curve: the straight line through R and G, or the tangent at R, meets the curve at exactly one more point. Mod p that line wraps into a coil around the torus. Here it really winds about 10⁷⁶ times, far too dense to draw, so each step shows an illustration: a spiral from the current point to −R that keeps the step's real slope, scaled down, all along its length, so it winds more the further it runs round the ring (a negative slope winds the other way). On add-G steps it passes through G, as the real line does, and a gold dot finds its place there; it then ends on −R. The line's other ~10⁷⁷ points miss the curve entirely, so none are drawn. The real line would cover the torus like fog. That's the security: the landing point is fully determined, but no one can trace the line that leads to it.

private key, bit by bit
Every point and key here is calculated exactly on the real curve in your browser, with 256-bit integers. Don't use a key generated or shown on a web page for real funds.