The Setup
Everyone agrees on:
- A curve equation (like )
- A prime (defines the finite field)
- A generator point
- The order (how many points generates)
These are public parameters. Bitcoin’s secp256k1 curve has all these standardized.
Key Generation
Step 1: Pick a random private key .
This is just a random number between and .
For secp256k1, is a 256-bit number.
Step 2: Compute the public key .
Multiply the generator by your private key .
The result is a point on the curve.
What the Keys Look Like
| Key | What It Is | Size (secp256k1) |
|---|---|---|
| Private key | A random number | 256 bits (32 bytes) |
| Public key | A point | 512 bits (64 bytes) |
The public key can be compressed to 257 bits by storing only and one bit indicating if is even or odd (since there are two possible values).
Why Is This Secure?
An attacker knows:
- (public)
- (public)
To find , they need to solve:
Given and , find such that .
This is the Elliptic Curve Discrete Logarithm Problem (ECDLP).
Why ECDLP Is Hard
You might think: “Just keep subtracting from until you reach .”
But can be as large as .
Even at 1 billion operations per second, checking all possibilities would take longer than the age of the universe. Much longer.
No Known Shortcuts
For regular discrete log (like in Diffie-Hellman), there are sub-exponential algorithms.
For ECDLP, the best known attacks are fully exponential. There’s no mathematical shortcut.
This is why ECC can use smaller keys than RSA for the same security.
The One-Way Function
| Direction | Operation | Difficulty |
|---|---|---|
| Forward | Compute | Easy (double-and-add) |
| Backward | Find from and | Practically impossible |
This asymmetry is the foundation of ECC security.