Bitcoin Protocol

Reading Bitcoin Core — Use the Source, Luke
2026-02-24 · Jon’s Notes

Part 0 Opening: Use the Source, Luke (5 min)

Why Read Bitcoin Core?

The Philosophy of the Core Codebase

See also: BIPs (Bitcoin Improvement Proposals), Bitcoin Core, and libsecp256k1.

Part 1 Entry Point & Chain Params (10 min)

How it Starts: bitcoind & init

Part 2 Transactions, Scripts, Serialization (20 min)

The Atomic Unit: CTransaction

The Script Engine: src/script/

Serialization

Part 3 Blocks, Merkle Trees, PoW (15 min)

The Block Header

The Merkle Proof

How Merkle Trees Work in Bitcoin

Difficulty & PoW

Part 4 Validation & The UTXO Set (20 min)

Validation Pipeline: src/validation.cpp

The Coins Database (UTXO): src/coins.h

Soft Fork Logic

Part 5 P2P Network & Message Flow (15 min)

Lower-level Network: src/net.cpp

Higher-level Message Processing: src/net_processing.cpp

The Handshake

Part 6 Mempool & Block Assembly (10 min)

The Mempool: src/txmempool.cpp

Mining Logic: src/node/miner.cpp

Part 7 Architecture Map & Next Steps (10 min)

Directory Overview

src/consensus/ — Logic that requires 100% agreement
src/policy/ — Node-local rules (e.g., relay rules)
src/wallet/ — The built-in wallet logic

Next Steps

Bitcoin Core: The “Top 10” Source Files

File Path Role Key Functions / Classes
src/validation.cpp Most important file in the repo: block and transaction validation logic. AcceptToMemoryPool(), CheckBlock(), ConnectBlock()
src/net_processing.cpp Bridges the P2P network and the validation engine. Decides what to do with messages from peers. ProcessMessage(), SendMessages()
src/script/interpreter.cpp Executes the Bitcoin Script for every transaction input. EvalScript(), VerifyScript()
src/primitives/transaction.h Defines the basic structure of a transaction: inputs, outputs, and outpoints. CTransaction, CTxIn, CTxOut
src/primitives/block.h Defines the 80-byte block header and the full block structure. CBlockHeader, CBlock
src/coins.h Manages the UTXO set, specifically the in-memory cache. CCoinsViewCache, Coin
src/txmempool.cpp Manages transactions validated but not yet in a block. CTxMemPool, addUnchecked()
src/net.cpp Low-level P2P networking: sockets, connection limits, and bans. CConnman, ThreadMessageHandler()
src/node/miner.cpp Selecting transactions from the mempool to build a new block. BlockAssembler, CreateNewBlock()
src/init.cpp The Ignition. Startup sequence, background threads, and graceful shutdowns. AppInitMain(), Shutdown()

Key Takeaways