Elliptic Curves Explained — From Mathematics to Bitcoin
Why Elliptic Curves Matter
Elliptic curves are the mathematical backbone of modern cryptography.
They are used in:
- TLS 1.3 (HTTPS)
- Secure messaging
- SSH
- Bitcoin and many blockchains
- Digital signatures (ECDSA, EdDSA)
- Key exchange (ECDH)
Their power comes from a rare combination:
- Simple algebraic equations
- A rich group structure (see further for definition)
- Extremely hard inverse problems
This article builds elliptic curves from the ground up, adds diagrams, Go code, and finishes with a Bitcoin-specific deep dive.
The Elliptic Curve Equation
An elliptic curve over the real numbers is defined as:
with constants (a, b \in \mathbb{R}).
To ensure smoothness:
This avoids cusps and self-intersections.
Visual Shape (Over the Reals)
Key properties:
- Symmetry across the x-axis
- Smooth, continuous curve
- No corners or breaks
Elliptic Curves Form a Group
Points on an elliptic curve form an abelian group this is what enables cryptography.
Definition of a group
A group is a set together with a binary operation on here denoted “” that combines any two elements and of to form an element of denoted , such that the following three requirements, known as group axioms, are satisfied:
- Associativity
For all , , in one has . - Identity element
There exists an unique element in such that, for every in , one has and .
A such element is unique, it is called the “identity element” or “neutral element” of the group. - Inverse
For each in there exists an element in such that and , where is the identity element.
For each , the element is unique; it is called the inverse of and is commonly denoted .
It’s an abelian group because:
- it is an closed group (property of closure), which means that is an element of for every and in .
- it is commutative, which means that for every and in .
Point Addition (Geometric Intuition)
Elliptic curve “addition” has nothing to do with adding coordinates.
It is a definition of a binary operation on a set of points, chosen so that:
the set of points on the curve (plus one extra point) forms an abelian group.
The word addition is a convention, not a coordinate-wise sum.
Elliptic curve addition is a defined binary operation whose purpose is to turn the set of points on an elliptic curve into an abelian group.
Adding two points (P) and (Q)
- Draw the line through two points and
- It intersects the curve at a third point
- Reflecting (R) across the x-axis gives
Reflection is required to preserve group properties.
Algebraic Point Addition on an Elliptic Curve
In this section, we define the addition of two points on an elliptic curve in short Weierstrass form, fixing the curve equation, the field, and the mathematical origin of the formulas.
Elliptic Curve Under Consideration
Let be a field (for example or ).
We consider the elliptic curve as the set of elements verifying:
with , subject to the non-singularity condition:
This condition guarantees that the curve is smooth (no cusps or self-intersections).
There are some interesting properties of these odd sorts of curves, one of them is that if a (non-vertical) straight line crosses the curve at all, then it will cross it in exactly three places.
Points Considered
Let and be two distinct points on :
with .
The point is defined by:
Line Through and
The line passing through and has slope:
Important remark
Over a finite field, there is no division in the usual sense, denotes the multiplicative inverse in the field .
The equation of the line is:
Intersection with the Curve
Substitute this expression for into the curve equation:
After expansion, this yields a cubic polynomial in . Its three roots are exactly:
where corresponds to the third intersection point of the line with the curve.
Computing (Viète’s formulas)
By identifying coefficients in the cubic polynomial, Viète’s formulas give:
Therefore:
-Coordinate of the Intersection Point
The -coordinate of the intersection point is obtained by substituting into the line equation:
Definition of the Group Law
By definition of the group law on an elliptic curve, the sum is the reflection of across the x-axis:
Thus:
Summary of the Formulas for
For the curve:
we have:
with all operations performed in the field .
Bitcoin Case (Concrete)
Bitcoin uses the secp256k1 curve:
where:
The formulas above apply unchanged, with all operations carried out modulo .
The secp256k1 curve has a very large value for , so it resembles to the graph above, except there are about as many points on it as there are atoms in the universe!
Algebraic Point Addition
Let:
If :
So:
Point Doubling
When (P = Q), we use the tangent line.
Slope:
Same formulas apply afterward.
The Point at Infinity
Elliptic curves include a special element:
Called the point at infinity, it acts as the identity:
In diagrams, vertical lines meet the curve at (\mathcal{O}).
Scalar Multiplication
Scalar multiplication is repeated addition:
This is efficient even for huge (k) using double-and-add.
Finite Fields (Cryptography Reality)
Cryptography does not use real numbers.
Instead, elliptic curves are defined over finite fields:
Equation:
No smooth curve anymore — but the group structure remains intact.
Discrete Logarithm Problem (ECDLP)
Given:
Find (k).
- Easy → forward direction
- Infeasible → reverse direction
This asymmetry is the foundation of elliptic-curve cryptography.
Go Example: Scalar Multiplication
Using Go’s modern standard library:
package main
import (
"crypto/ecdh"
"crypto/rand"
"fmt"
)
func main() {
curve := ecdh.X25519()
priv, _ := curve.GenerateKey(rand.Reader)
pub := priv.PublicKey()
fmt.Println("Private key:", priv.Bytes())
fmt.Println("Public key :", pub.Bytes())
}
Run in the Go playground
Conceptually where is hiden in the private key.
Base Point (G)
Every curve defines a public base point (G):
- Fixed
- Known to everyone
- Large prime order (n)
Properties:
All keys derive from (G).
Bitcoin and Elliptic Curves
Curve used by Bitcoin
Bitcoin uses secp256k1 which has for equation:
Where:
Notable properties:
- No (a) term
- Simple structure
- High performance
Bitcoin Private & Public Keys
Private key
A random integer:
Public key
Where (G) is the secp256k1 base point with , where (hexadecimal base):
Bitcoin Diagram
flowchart LR
Priv[Private key k] -->|k × G| Pub[Public key K]
Pub --> Addr[Bitcoin address]
One-way only.
Bitcoin Signature (ECDSA)
Bitcoin uses ECDSA:
- Private key signs a transaction hash
- Public key verifies the signature
- No private key disclosure
Security relies entirely on ECDLP.
Why Bitcoin Chose secp256k1
- No unexplained constants
- Faster arithmetic
- Simple equation
- Transparent design
Modern alternatives (Schnorr / Taproot) still rely on elliptic curves.
Go Example: Bitcoin-Style Key Generation
package main
import (
"crypto/elliptic"
"crypto/rand"
"fmt"
_ "math/big"
)
func main() {
curve := elliptic.P256() // secp256k1 uses similar API
priv, x, y, _ := elliptic.GenerateKey(curve, rand.Reader)
fmt.Println("Private key:", priv)
fmt.Println("Public key X:", x)
fmt.Println("Public key Y:", y)
}
Run in the Go playground
(Bitcoin libraries use secp256k1 specifically, but the math is identical.)
Final Intuition
Elliptic curves are:
A mathematical system where multiplication is easy, division is impossible, and everyone agrees on the rules.
Bitcoin, TLS, and modern cryptography exist because of that asymmetry.
Further Reading
Elliptic curves sit at the intersection of algebra, geometry, and cryptography.
Depending on your background and goals, different resources will be appropriate.
Below is a curated selection, ordered from intuitive introductions to rigorous mathematical treatments and cryptography-focused references.
Intuitive and Conceptual Introductions
These focus on understanding rather than formal proofs.
- Kahn Academy – Elliptic Curves
Clear geometric intuition and motivation. - “A (Relatively Easy to Understand) Primer on Elliptic Curve Cryptography” – Andrea Corbellini
Excellent bridge between intuition and algebra, widely respected. - “Elliptic Curves and Cryptography” – Cloudflare Blog
A practitioner-oriented explanation of why ECC works. - Elliptic Curve - Greg Walker
An other practitioner-oriented explanation of ECC.
Cryptography-Focused References
These focus on elliptic curves as cryptographic groups.
- “Guide to Elliptic Curve Cryptography” – Darrel Hankerson, Alfred Menezes, Scott Vanstone
The reference book for ECC in practice.
Rigorous, but accessible with undergraduate math. ISBN: 978-0387952734 - RFC 7748 – Curve25519 and Curve448
Explains modern curve design and safe scalar multiplication. - “The Cryptopals Crypto Challenges” (ECC sections)
Hands-on perspective on ECC pitfalls and correct usage.
Bitcoin-Specific Elliptic Curve Material
Focused on secp256k1, signatures, and Bitcoin design choices.
- “Bitcoin and Elliptic Curve Cryptography” – Jimmy Song
Clear explanation of how ECC is used in Bitcoin. - SEC 2: Recommended Elliptic Curve Domain Parameters
Formal specification of secp256k1. - BIP-340: Schnorr Signatures for secp256k1
Modern Bitcoin signature scheme using elliptic curves.
Mathematical Foundations (More Rigorous)
For readers who want proofs and formal structure.
- Joseph H. Silverman – The Arithmetic of Elliptic Curves
The canonical mathematical reference.
Requires strong algebra background. - Washington – Elliptic Curves: Number Theory and Cryptography
A gentler mathematical approach with cryptographic motivation. - MIT OpenCourseWare – Elliptic Curves
University-level lecture notes and problem sets.
Practical Implementations and Code
Understanding the math is only half the story.
- libsecp256k1 (Bitcoin Core)
Industrial-grade elliptic curve implementation. - Go standard library:
crypto/ecdh,crypto/elliptic
Reference implementations of ECC primitives in Go. - Curve25519 paper – Daniel J. Bernstein
Shows how curve design impacts security and simplicity.