Level 3 · Advanced
The cryptography
In short
Bitcoin uses elliptic-curve cryptography on the secp256k1 curve for keys and signatures (ECDSA, and Schnorr since Taproot), and SHA-256 for hashing. A private key is a huge random number; the public key is derived from it, but never the other way round.
05The cryptographysecp256k1, ECDSA vs Schnorr, HASH160, Base58Check, Bech32m.9 min
Bitcoin uses the elliptic curve secp256k1: y² = x³ + 7 over the prime field p = 2²⁵⁶ − 2³² − 977.
- Private key: a random integer
kwith1 ≤ k < n(the group order). Public key:K = k·G. Easy one way, infeasible to reverse. - Signatures: ECDSA for legacy and SegWit v0; Schnorr (BIP 340) for Taproot, which is linear and enables key aggregation such as MuSig2.
- Hashes: SHA-256 for proof of work and txids;
HASH160 = RIPEMD-160(SHA-256(x))for legacy and v0 addresses. Taproot outputs commit directly to a tweaked 32-byte x-only key. - Encodings: Base58Check for
1…and3…; Bech32 (BIP 173) forbc1q…; Bech32m (BIP 350) forbc1p…. - Security rests on good randomness. Never generate keys with home-made methods.
Learn Bitcoin with real people.
Find meetups and Bitcoiners in your city, and ask the questions you'd never post online. Free to download on iPhone and Android.