TeachMeBitcoin - The Free Interactive Bitcoin Encyclopedia
TeachMeBitcoin
The Free, Developer-Grade Bitcoin Encyclopedia
Master Bitcoin from first principles. Explore 45 highly detailed, cryptographic, and network-grade educational modules complete with step-by-step stack visualizations, code emulation, and LaTeX math typesetting.
How Bitcoin Works
Learn how Bitcoin works in this simple, beginner-friendly guide. Understand the blockchain, digital scarcity, and the fundamentals of decentralized money.
Getting Started: Wallets
What is a Bitcoin wallet and how does it work? Learn how wallets manage cryptographic public and private keys to let you send and receive bitcoin.
Getting Started: Exchanges
A beginner-friendly guide explaining what a cryptocurrency exchange is, how order books work, and how to safely buy your very first bitcoin.
Sending Transactions
A step-by-step beginner's guide on how to safely send a Bitcoin transaction, scan QR codes, double-check addresses, and verify on-chain status.
Protecting Your Keys
Discover why a dedicated hardware wallet is your absolute best defense against online malware, keyloggers, and digital hacking attempts.
The Bitcoin Network
Deep dive into the peer-to-peer network layer. Understand node propagation, network latency, orphan blocks, and defense against Sybil attacks.
What is a Node?
Learn the critical role of transaction and block validation. Discover how to run a node, storage options (pruned vs. full), and why nodes don't receive payments.
Bitcoin Mining
A technical look at Proof of Work. Explore SHA-256 hashing, mining pool mechanics, mining rig hardware (ASICs vs. GPUs), and the block subsidy halving schedule.
The Blockchain
Understand the blockchain ledger structure. Learn how blocks are cryptographically chained and how Nakamoto Consensus (Longest Chain Rule) establishes trust.
Blocks
Break down block structures. Discover block size limits, block weight calculations, Merkle Trees, Coinbase transactions, and the blockspace bidding market.
Difficulty
Master the difficulty feedback loop. Learn how the two-week retarget rule regulates block speeds, protects hashrate, and debunks miner death spirals.
Transactions
The mathematical anatomy of transactions. Master serialized schemas, transaction inputs, Outputs, fees, and relative/absolute timelock consensus.
Outputs
Deep dive into the UTXO model. Understand how wallets track unspent outputs, change derivation paths, dust limit policies, and UTXO consolidation strategies.
Locks
Explore the smart-contracting capabilities of Bitcoin Script. Master scriptPubKey locking, scriptSig unlocking, stacktraces, and multisig OP_CHECKMULTISIG execution.
Keys & Addresses
An introduction to Bitcoin keys and addresses. Master private and public keys, secp256k1 math, compressed coordinates, and address derivation formats.
Private Keys
Explore the secrets of raw private key numbers. Learn about entropy generation (coin-flipping, dice-rolling, and CSPRNGs), WIF formats, storage setups, and BIP 39 HD mnemonic seeds.
Public Keys
Dive into the mathematical geometry of public key coordinates. Master point addition and doubling arithmetic, coordinate compression algebra, pure Python derivation, Hash160, and 32-byte Schnorr public keys (BIP 340).
Digital Signatures
Understand the authorization layers of Bitcoin. Explore the mathematical mechanics of ECDSA, DER signature serialization, strict BIP 66 parsing, fatal nonce-reuse and bias lattice-attacks (HNP), and the evolution of linear Schnorr signatures.
SegWit
Master Bitcoin's most critical scaling upgrade. Explore witness segregation mechanics, Block Weight Units (WU), the 4:1 witness discount, Nested vs. Native Bech32 layouts, malleability fixes, and P2WPKH/P2WSH script bytecode.
Technical: Networking
Deep dive into Bitcoin peer-to-peer connection protocols. Master TCP port bindings, 24-byte packet header layouts, and the bi-directional handshake exchange.
- Node Connections & Ports
- P2P 24-Byte Message Header
- The P2P Version Message Payload
- The P2P Handshake State Machine
- Custom Python P2P Handshake Client
- Magic Bytes across Networks
- Cryptographic Design of Magic Bytes
- P2P TCP Stream Demultiplexing
- Disk Serialization of Block Data
- Custom Python TCP Stream Parser
Technical: Mining & Mempool
Master the design architectures of the Bitcoin mempool. Explore time/size limit dynamic thresholds, ancestral dependency DAG structures, and package evaluation (CPFP) miners' math.
- Mempool Architecture & Eviction
- Mempool Ancestors & Descendants
- Child Pays For Parent (CPFP)
- Replace-By-Fee (RBF) & BIP 125
- Mempool Configurations & RPC
- Candidate Block Assembly
- GetBlockTemplate & Stratum
- Enforcing Weight & SigOps Limits
- Merkle Tree & Merkle Root Math
- Custom Python Block Builder
- The Mining Target
- Target vs. Difficulty Math
- The 'Bits' Compact Format
- Hash Verification & PoW
- Custom Python Target Calculator
- The Coinbase Transaction
- The Null Input outpoint
- BIP 34: Block Height Rules
- SegWit Witness Commitments
- Custom Python Coinbase Serializer
- The Block Reward: Subsidy Decay
- Consensus Reward Enforcement
- Transaction Fee Economics
- The Underpaying Miner
- Custom Python Reward Simulator
Technical: Consensus & Blockchain
Master the chronological coordinate of the ledger. Learn about the Genesis Block (height 0), its unspendable outputs, and block height relative clocks.
- Understanding Block Height
- Height versus Chain Work
- Blockchain Reorganizations (Reorgs)
- BIP 34: Coinbase Height Rules
- Custom Python Reorg Simulator
- The Most Work Rule
- Solving the Byzantine Generals' Problem
- Game Theory: Why Miners are Honest
- Probabilistic Finality Math
- Custom Python Consensus Simulator
- Natural Forks & Latency
- The Block Tree Structure
- UTXO Rollback Mechanics
- Reorg Economics & Attack Cost
- Custom Python UTXO Reorg Simulator
- 51% Attack Theory
- Double Spend & Shadow Mining
- Censorship & Minority Suppression
- Hardware & Energy Costs
- Custom Python Attacker Simulator
- Hard Fork Definition & Mechanics
- The Chain Split Phenomenon
- Replay Protection (BIP 143)
- Historical Hard Forks
- Custom Python Fork Validator
Technical: Soft Forks
Master the mechanics of backward-compatible upgrades. Learn how rule tightening and forward compatibility allow Bitcoin to upgrade without splitting.
Technical: Block Structure
Master the six fields of the Bitcoin block header. Learn about little-endian serialization and the efficiency of the 80-byte header design.
- The 80-Byte Block Header
- Version Field Evolution (BIP 9)
- ASICBoost & Version Rolling
- Version Field Validation Rules
- Custom Python Header Serializer
- The Hash Chain Connection
- Double-SHA256 Linkage
- Immutability & Domino Effect
- Genesis Block (The Null Anchor)
- Custom Python Chain Linker
- Merkle Tree Fundamentals
- Merkle Path & Proofs
- Handling Odd TX Counts
- Merkle Tree Malleability
- Custom Python Merkle Builder
- The Unix Timestamp Field
- Median Time Past (MTP)
- The 2-Hour Future Rule
- Timejacking & Manipulation
- Custom Python Time Auditor
- The Bits Field Overview
- Exponent-Mantissa Logic
- Bits to Target Conversion
- Precision & Consensus Limits
- Custom Python Bits Tool
- The Nonce Field Overview
- The 4-Billion Nonce Limit
- Nonce Overflow & Extra Nonce
- Nonce Distribution Analysis
- Custom Python Nonce Miner
- The Block Hash Definition
- Calculating Hash Endianness
- Leading Zeroes Requirement
- Block ID vs. Block Hash
- Custom Python Hash Verifier
Technical: Disk Storage
Understand how Bitcoin Core persists the blockchain to silicon. Learn about the 128MB blk.dat file structure and the role of flat binary storage.
Technical: Transaction Inputs
Deconstruct the structure of a Bitcoin input. Learn how inputs reference previous outputs to unlock and redistribute satoshis across the network.
Technical: VOUT Indexing
Understand the zero-based indexing of Bitcoin outputs. Learn why a TXID alone is insufficient to identify specific coins and how VOUT slots solve the ambiguity.
Technical: Unlocking Scripts
Analyze the 'Key' of the Bitcoin protocol. Learn how the ScriptSig field provides the cryptographic credentials required to satisfy the conditions of previous outputs.
Technical: Sequence & Timelocks
Deconstruct the 4-byte nSequence field. Learn its original purpose for high-frequency trades and its modern role in enabling RBF and relative timelocks.
Technical: Locking Scripts
Examine the foundation of Bitcoin's programmable ownership. Learn how ScriptPubKey defines the mathematical conditions required for any future spending of an output.
Technical: The Witness (SegWit)
Analyze the segregated proof area of Bitcoin. Learn how the Witness field stores signatures outside the main transaction structure to fix malleability and increase capacity.
Technical: Transaction Locktime
Examine the temporal bounds of the Bitcoin protocol. Learn how the 4-byte nLockTime field prevents transactions from being mined until a specific block height or date.
Technical: Transaction Fees
Understand the implicit accounting of the Bitcoin network. Learn how fees are derived from the difference between input and output values without a dedicated fee field.
Technical: Transaction Size & Weight
Master the physics of blockspace. Learn the difference between raw bytes and weight units, and how SegWit fundamentally changed how Bitcoin measures transaction size.
Technical: The UTXO Model
Explore the stateless architecture of Bitcoin. Learn why the Unspent Transaction Output (UTXO) model was chosen over accounts for massive parallelism and cryptographic security.
Technical: wTXID (Witness Transaction ID)
Explore the dual identity of SegWit transactions. Learn how the Witness Transaction Identifier (wTXID) protects the network from signature malleability while maintaining backward compatibility.
Technical: PSBT (BIP 174)
Introduction to Partially Signed Bitcoin Transactions. Learn how BIP 174 standardized the communication between multisig coordinators and offline signing devices.
Technical: P2PK (Pay-to-Public-Key)
Explore the original script type used by Satoshi Nakamoto. Learn how P2PK locks coins directly to raw public key bytes and why it was the foundation of the network.
Technical: P2PKH (Pay-to-Public-Key-Hash)
Explore the standard legacy address format. Learn how P2PKH improved space efficiency and security by locking coins to a 20-byte RIPEMD160 hash instead of raw keys.
Technical: P2MS (Pay-to-Multisig)
Introduction to collaborative ownership. Learn how the M-of-N multisig model works in its rawest form and why it was the first way joint accounts were created on Bitcoin.
Technical: P2SH (Pay-to-Script-Hash)
Introduction to the '3' address format. Learn how P2SH shifted the burden of complex script execution from the sender to the receiver using cryptographic hashes.
Technical: P2SH-P2WPKH (Nested SegWit)
Explore the bridge between legacy and modern Bitcoin. Learn how Nested SegWit allowed users to access the benefits of the 2017 upgrade while maintaining compatibility with old '3' addresses.
Technical: P2SH-P2WSH (Nested SegWit Multisig)
Introduction to multi-layered collaborative custody. Learn how P2SH-P2WSH enabled institutional multisig wallets to utilize SegWit benefits while remaining backward compatible.
Technical: P2WPKH (Native SegWit)
Explore the native SegWit standard. Learn how P2WPKH removed the legacy P2SH wrapper entirely, resulting in 'bc1q' addresses and the maximum possible fee efficiency for single keys.
Technical: P2WSH (Native SegWit Multisig)
Introduction to native SegWit multisig. Learn how P2WSH provides the maximum possible fee discount and utilizes 32-byte SHA256 security for complex collaborative custody scripts.
TeachMeBitcoin is an ad-free, open-source educational repository curated by a passionate team of Bitcoin researchers and educators for public benefit. If you found our articles helpful, please consider supporting our hosting and ongoing content updates with a clean donation: