How private keys, public keys, signing and verification actually work β visualized
An elliptic curve is defined by a deceptively simple equation. Bitcoin uses secp256k1, which is:
In reality the curve lives over a finite field modulo a huge prime p β so all coordinates are integers and the "curve" looks like scattered dots. But we visualize it over the real numbers to understand the geometry.
For this to be a valid elliptic curve, the discriminant must be non-zero:
This prevents the curve from having cusps or self-intersections.
β’ The curve is symmetric about the x-axis (because yΒ² means Β±y are both solutions)
β’ Any non-vertical line intersects the curve in at most 3 points
β’ These two properties enable point addition β the foundation of ECC
p = 2Β²β΅βΆ β 2Β³Β² β 977
That's a 78-digit number. The curve has ~2Β²β΅βΆ points.
You can "add" two points on an elliptic curve using a geometric rule. This operation is the only building block of all ECC operations.
Given two points P and Q on the curve, draw the line that passes through both.
This line will always intersect the curve at exactly one more point (let's call it βR).
Then P + Q = (xβ, yβ) β the reflected point.
When adding a point to itself, use the tangent line at P:
Then apply the same xβ, yβ formulas. This is called 2P.
ECC key generation has just two ingredients: a private key (a random number) and a generator point G baked into the curve specification.
Just a random 256-bit integer. That's it. Example (simplified):
In reality: a 77-digit random number like
0x9f3d...a7b2
The result of scalar multiplication Q = k Γ G. It's a point on the curve (x, y) β two 256-bit numbers.
Share this freely β it's your identity.
Given Q and G, finding k requires solving the Elliptic Curve Discrete Logarithm Problem (ECDLP).
With 2Β²β΅βΆ possible values, no known algorithm can do this in feasible time β not even with all computers on Earth running for billions of years.
Elliptic Curve Digital Signature Algorithm (ECDSA) lets you sign a message using your private key. Anyone with your public key can verify it β but only you (with the private key) can create it.
Anyone with your public key Q can verify a signature (r, s) β without knowing the private key. This is the magic.
When signing, we computed: s = kβ»ΒΉ(H + rΒ·privateKey)
Rearranging: k = sβ»ΒΉΒ·H + sβ»ΒΉΒ·rΒ·privateKey = uβ + uβΒ·privateKey
Multiplying both sides by G: kΒ·G = uβΒ·G + uβΒ·(privateKeyΒ·G) = uβΒ·G + uβΒ·Q
And kΒ·G is exactly the point whose x-coordinate is r β so the check X.x = r reconstructs the nonce point without knowing k or the private key.
β‘ The equation balances only if the private key used to sign matches the public key used to verify.
The entire security of ECC rests on one problem: the Elliptic Curve Discrete Logarithm Problem (ECDLP).
Imagine a phone book with 2Β²β΅βΆ entries (more than the number of atoms in the observable universe). You know the address (Q) and the starting address (G). You need to figure out how many steps it took to walk from G to Q.
Going forward (k Γ G) is fast β it takes only ~256 steps using double-and-add. Going backwards (finding k from Q) requires essentially brute force through 2ΒΉΒ²βΈ operations at minimum β utterly infeasible.
| Security level | RSA key size | ECC key size | Ratio |
|---|---|---|---|
| 80-bit | 1,024 bits | 160 bits | 6Γ smaller |
| 128-bit | 3,072 bits | 256 bits | 12Γ smaller |
| 192-bit | 7,680 bits | 384 bits | 20Γ smaller |
| 256-bit | 15,360 bits | 521 bits | 30Γ smaller |
β’ Smaller keys β 256-bit ECC β 3072-bit RSA in security
β’ Faster operations β less computation, better for IoT/mobile
β’ Smaller certificates β important for TLS handshake speed
β’ Used everywhere β TLS 1.3, Bitcoin, Signal, Apple Secure Enclave, SSH keys
Shor's algorithm on a sufficiently powerful quantum computer could break ECDLP β same as RSA. Both rely on mathematical hardness problems solvable by quantum algorithms.
This is why NIST is standardising post-quantum cryptography (lattice-based, hash-based) as the next generation β independent of elliptic curves.
| Curve | Used in | Key size | Equation |
|---|---|---|---|
| secp256k1 | Bitcoin, Ethereum | 256-bit | yΒ² = xΒ³ + 7 |
| P-256 (secp256r1) | TLS, FIDO2, Apple | 256-bit | yΒ² = xΒ³ β 3x + b |
| P-384 | NSA Suite B, TLS | 384-bit | yΒ² = xΒ³ β 3x + b |
| Curve25519 | Signal, WireGuard, SSH | 255-bit | yΒ² = xΒ³ + 486662xΒ² + x |
| Ed25519 | SSH keys, TLS 1.3 | 255-bit | Edwards form |