Elementary Bitcoin

A Mathematical Introduction from First Principles

✦ ✦ ✦

Volumes I, II & III

Being a rigorous exposition of the algebraic structures, elliptic curves, cryptographic protocols, protocol architecture, and scaling technologies upon which Bitcoin is founded, presented in the manner of classical mathematical texts for the edification of the diligent reader.

"The mathematician does not study pure mathematics because it is useful; he studies it because he delights in it and he delights in it because it is beautiful."

— Henri Poincaré

The Complete Work

Preface

The purpose of this work is to present the mathematical foundations of Bitcoin in a rigorous yet accessible manner. We assume no prior knowledge of cryptography or advanced mathematics, but expect familiarity with basic algebra and a willingness to engage with precise definitions.

Each concept builds upon those that precede it, forming a complete chain of understanding—much like the blockchain itself. The reader who masters Volume I will possess the tools necessary to verify, from first principles, every cryptographic claim made about Bitcoin.

We follow the tradition of classical mathematical exposition: definition, theorem, proof, example. This approach, though demanding, rewards the patient reader with genuine comprehension rather than mere familiarity.

Contents

Part I · Algebraic Foundations

Sets and binary operations · Group axioms · Abelian and cyclic groups · Generators and order · The discrete logarithm problem

Clock arithmetic · Prime fields · The extended Euclidean algorithm · Fermat's little theorem · Multiplicative inverses

Part II · Elliptic Curves

The Weierstrass equation · Geometric point addition · The chord-tangent method · Point doubling · The point at infinity

Discrete curves · The group law in 𝔽ₚ · Order and cofactor · Hasse's theorem · The elliptic curve discrete logarithm problem

Bitcoin's elliptic curve · The curve parameters · The generator point G · Scalar multiplication · Why secp256k1?

Part III · Cryptographic Protocols

Cryptographic hash functions · SHA-256 internals · RIPEMD-160 · Double hashing (HASH256, HASH160) · Tagged hashes · The random oracle model

The signing equation · Key generation · Signature creation · Verification · The nonce k and its dangers · Signature malleability

The Schnorr identification protocol · BIP-340 signatures · Batch verification · Key aggregation · MuSig and MuSig2 · Adaptor signatures

Volume II · Protocol Architecture

Part IV · Keys and Transactions

Private keys · Public key derivation · Address formats (P2PKH, P2SH, P2WPKH, P2TR) · Base58Check · Bech32 and Bech32m · WIF encoding

The UTXO model · Transaction structure · Inputs and outputs · Segregated Witness · Sighash types · Transaction fees · The coinbase

11. Script

Stack-based execution · Opcodes · Standard templates (P2PKH, P2SH, multisig) · Time locks · OP_RETURN · Tapscript

Part V · Blocks and Mining

Binary hash trees · Computing the Merkle root · Merkle proofs · SPV foundations · Witness commitment

13. Blocks

Block structure · The 80-byte header · Block weight · Validation rules · The genesis block · Chain structure

Hash puzzles · Difficulty and target · The difficulty adjustment algorithm · Mining economics · Security analysis

Part VI · Consensus and Upgrades

The 21 million cap · Block subsidy and halvings · Timing parameters · Block limits · Coinbase maturity · Economic design

Policy vs consensus · Hard forks vs soft forks · Activation mechanisms (BIP-9, BIP-8) · Major soft forks · Future upgrade paths

Appendices

A. Mathematical Notation
B. Selected Proofs
C. Reference Implementations

Volume III · Scaling and Verification

Part VII · Light Clients and SPV

Whitepaper Section 8 · The SPV data model · What SPV proves · Security assumptions · Fraud proofs · The gap between theory and implementation

Bloom filter mathematics · BIP-37 protocol · The privacy catastrophe · DoS vulnerabilities · Why Bloom filters failed

Golomb-Rice coding · GCS construction · Filter header chains · Privacy-preserving light clients · Neutrino

The Electrum protocol · Block explorer APIs · Trust models · Hybrid approaches · Choosing an architecture

Part VIII · Node Optimization and Validation

Initial Block Download · AssumeValid · AssumeUTXO · Pruning · Utreexo · Trade-offs and recommendations

Single-use seals · Pay-to-contract · RGB protocol · Taproot Assets · Scalability and privacy analysis

Part IX · Payment Channels and Lightning

Unidirectional channels · The bidirectional channel problem · LN-Penalty · Revocation mechanisms · HTLCs · Watchtowers

Multi-hop payments · Onion routing · BOLT specifications · Invoices and offers · Pathfinding · Network topology

Part X · Analysis and Perspective

SPV security myths · Scaling misconceptions · Cryptographic concerns · Consensus myths · Economic fallacies · Methodology for evaluation