A curated guide to understanding Bitcoin from first principles — with a hands-on Rust implementation you can run, read, and hack on.
Learning Path | Resources | Hands-on Implementation | Quick Start | 中文
"The best way to understand Bitcoin is to build it."
This repo has two parts:
- A curated reading list — papers, books, courses, and tools from foundations to mastery
- A complete Bitcoin implementation in Rust (SimpleBTC) — 7,900+ lines of production-quality code you can run locally with a Web UI
| Phase | Focus | What to Read / Do |
|---|---|---|
| 1. Why Bitcoin? | Big picture | 3Blue1Brown video, Nakamoto whitepaper |
| 2. How Bitcoin works | Protocol fundamentals | Mastering Bitcoin Ch. 1-6, learnmeabitcoin.com |
| 3. Build it yourself | Code-level understanding | Programming Bitcoin (Python) or SimpleBTC (Rust, this repo) |
| 4. Go deeper | Consensus, Script, crypto | Chaincode Labs curriculum, Bitcoin Optech |
| 5. Contribute | Open source | Bitcoin Core, BIPs, Chaincode BOSS |
| Paper | Authors | Year | Why It Matters |
|---|---|---|---|
| Bitcoin: A Peer-to-Peer Electronic Cash System | Satoshi Nakamoto | 2008 | The 9-page paper that started it all |
| The Byzantine Generals Problem | Lamport, Shostak, Pease | 1982 | Seminal allegory for consensus with faulty actors |
| A Certified Digital Signature | Ralph Merkle | 1979 | Introduces hash trees (Merkle trees) |
| Practical Byzantine Fault Tolerance | Castro & Liskov | 1999 | Efficient BFT consensus — foundational for PoS chains |
| Hashcash - A Denial of Service Counter-Measure | Adam Back | 2002 | Proof-of-work precursor cited by Nakamoto |
| Book | Author | Level | Notes |
|---|---|---|---|
| Mastering Bitcoin, 3rd Ed. | Andreas Antonopoulos & David Harding | Beginner-Advanced | Free on GitHub. The definitive technical intro — covers keys, UTXO, Script, SegWit, Taproot |
| Programming Bitcoin | Jimmy Song | Intermediate | Build a Bitcoin library from scratch in Python. Elliptic curve math to networking |
| Bitcoin and Cryptocurrency Technologies | Narayanan et al. | Beginner | Princeton textbook. Companion to the Coursera course |
| Grokking Bitcoin | Kalle Rosenbaum | Beginner | Visual, diagram-heavy approach to Bitcoin fundamentals |
| Rust for Blockchain Application Development | Akhil Sharma | Intermediate | From Rust basics to building your own chain |
- But how does bitcoin actually work? — 3Blue1Brown. Best single-video intro (26 min), visual and intuitive.
- Bitcoin and Cryptocurrency Technologies — Princeton / Coursera. Free 11-week course.
- Blockchain and Money (MIT 15.S12) — Gary Gensler's MIT course with full lecture videos.
- Cyfrin Updraft — Free beginner-to-advanced blockchain dev courses.
- Learn Me A Bitcoin — Best free website for Bitcoin internals. Clear diagrams, real data, covers keys to Script to P2P.
- Bitcoin Optech — Weekly newsletter on Bitcoin/LN protocol development. The single best way to stay current.
- Bitcoin Developer Reference — Comprehensive reference for transactions, blocks, P2P, and RPC.
- Bitcoin Wiki: Script — Complete reference for all opcodes and standard transaction types.
- Bitcoin Improvement Proposals (BIPs) — The official spec repo. Key BIPs: 141 (SegWit), 340-342 (Schnorr/Taproot), 174 (PSBT).
- River Learn: What Is Taproot? — Clear explanation of P2TR, Schnorr, MAST.
- River Learn: What Is SegWit? — Witness separation, malleability fix, and how it enabled Lightning.
| Tutorial | Language | Description |
|---|---|---|
| SimpleBTC (this repo) | Rust | Complete Bitcoin implementation — UTXO, PoW, Merkle/SPV, multisig, Script, Web UI |
| Building Blockchain in Go | Go | Classic 7-part series. PoW, persistence, UTXO, addresses, P2P |
| blockchain-from-scratch | Rust | Tutorial repo with exercises |
| How to Build a Blockchain in Rust | Rust | Mining, consensus, P2P in ~500 lines |
| Programming Bitcoin | Python | Build a full Bitcoin library chapter by chapter |
| Reference | What It Covers |
|---|---|
| SEC 2: Recommended Elliptic Curve Domain Parameters | Defines secp256k1 (Section 2.4.1) |
| SEC 1: Elliptic Curve Cryptography | ECDSA signing/verification algorithms |
| Bitcoin Wiki: secp256k1 | Curve parameters, implementations, performance |
| Miniscript | Structured language for composing Bitcoin Scripts |
- btcdeb — Step through Bitcoin Script execution op-by-op. Supports SegWit and Taproot.
- Blockstream Explorer — Open source explorer for mainnet, testnet, and Liquid.
- Signet Explorer — Explorer for Bitcoin's Signet test network (BIP 325).
- Signet Faucet — Free sBTC for the stable Signet test network.
- Jameson Lopp's Developer Tools — Comprehensive list of libraries, APIs, and dev tools.
- Chaincode Labs — Bitcoin Protocol Development — Study guide for aspiring Bitcoin Core contributors.
- Chaincode Labs — Bitcoin & Lightning Seminars — Weekly seminar topics with reading lists.
- Chaincode BOSS Challenge — Month-long programming exercises for Bitcoin open source.
- awesome-bitcoin — Bitcoin services and tools for developers.
- awesome-blockchain — Blockchain development resources.
- awesome-blockchains — Open distributed databases with crypto hashes.
This repo includes a complete Bitcoin implementation in Rust — not a toy demo, but a production-quality educational system with real cryptography.
Most "blockchain in X" tutorials stop at a toy chain with SHA256 hashing. SimpleBTC goes further:
- Real Bitcoin cryptography — secp256k1 ECDSA, not mock signatures
- Complete UTXO model — the way Bitcoin actually tracks balances
- Advanced features — multisig, RBF, timelocks, Script engine, SPV light client
- Visual Web UI — see blocks, transactions, and balances in your browser
- Production-grade infra — RocksDB storage, parallel mining, REST API, CI/CD
Level 1: Foundations Level 2: Transactions Level 3: Advanced
┌─────────────────────┐ ┌─────────────────────┐ ┌─────────────────────┐
│ block.rs │ │ transaction.rs │ │ multisig.rs │
│ blockchain.rs │ --> │ wallet.rs │ --> │ advanced_tx.rs │
│ parallel_mining.rs │ │ utxo.rs │ │ script.rs │
└─────────────────────┘ │ crypto.rs │ │ spv.rs │
Blocks, PoW, chains └─────────────────────┘ │ mempool.rs │
UTXO, signing, keys └─────────────────────┘
Multisig, RBF, SPV
| Feature | SimpleBTC | Real Bitcoin |
|---|---|---|
| UTXO Model | Yes | Yes |
| Proof of Work (SHA256) | Yes | Yes (Double SHA256) |
| Merkle Trees + SPV | Yes | Yes |
| Multi-Signature (M-of-N) | Yes | Yes (P2SH/P2WSH) |
| Replace-By-Fee | Yes (BIP125) | Yes (BIP125) |
| TimeLock | Yes | Yes (CLTV/CSV) |
| ECDSA Signatures | Yes (secp256k1) | Yes (secp256k1/Schnorr) |
| Script System | Simplified | Full Script |
| P2P Network | Simulated | Distributed |
src/
├── Core Blockchain
│ ├── block.rs # Block structure, PoW
│ ├── blockchain.rs # Chain logic, validation
│ ├── transaction.rs # TX inputs/outputs, UTXO
│ ├── wallet.rs # Key management, addresses
│ ├── utxo.rs # UTXO set tracking
│ └── crypto.rs # Real secp256k1 ECDSA
├── Advanced Features
│ ├── merkle.rs # Merkle tree + SPV proofs
│ ├── multisig.rs # M-of-N multi-signature
│ ├── advanced_tx.rs # RBF + TimeLock
│ ├── mempool.rs # Transaction pool
│ ├── script.rs # Bitcoin Script engine
│ ├── spv.rs # SPV light client
│ └── parallel_mining.rs # Multi-threaded PoW
├── Infrastructure
│ ├── storage.rs # RocksDB persistence
│ ├── network.rs # P2P protocol
│ ├── security.rs # Validation rules
│ └── ... # config, logging, indexer, error
├── bin/server.rs # REST API + Web UI
└── bin/node.rs # P2P network node
examples/
├── enterprise_multisig.rs # Corporate 2-of-3 multisig
├── escrow_service.rs # Trustless escrow
└── timelock_savings.rs # Time-locked savings
git clone https://github.com/GeoffreyWang1117/Awesome-Bitcoin-Internals.git
cd SimpleBTC
cargo run --bin btc-server --releaseOpen http://localhost:3000 — click "Run Demo" to see mining, transactions, and balance updates.
cargo run --bin btc-demo --releasecurl -X POST http://localhost:3000/api/wallet/create
curl http://localhost:3000/api/wallet/balance/ADDRESS
curl -X POST http://localhost:3000/api/transaction/create \
-H "Content-Type: application/json" \
-d '{"from_address":"ADDR1","to_address":"ADDR2","amount":50,"fee":5}'
curl -X POST http://localhost:3000/api/mine \
-H "Content-Type: application/json" \
-d '{"miner_address":"ADDRESS"}'cargo run --example enterprise_multisig # Corporate 2-of-3 multisig
cargo run --example escrow_service # Trustless escrow
cargo run --example timelock_savings # Time-locked savingscargo test # 101 tests
cargo bench # Performance benchmarks
cargo clippy --all-targets --all-features # Lint (0 warnings)
cd docs && mdbook serve --open # Browse documentationContributions welcome! Some areas where help is needed:
- P2P networking layer — real TCP/UDP node communication
- SegWit support — witness data segregation
- Lightning Network — Layer 2 payment channels
- More Script opcodes — expand the script engine
- More resources — know a great paper or tutorial? Open a PR!
See CONTRIBUTING for guidelines.
本仓库包含两部分:
- 精选学习资源清单 — 从零开始学习比特币内部原理的论文、书籍、课程和工具
- 完整的 Rust 比特币实现 (SimpleBTC) — 7,900+ 行代码,配有 Web UI,可本地运行
- UTXO模型 — 比特币原生的未花费交易输出模型,防双花
- 工作量证明 — SHA256挖矿,可配置难度
- Merkle树 — 高效交易验证,支持SPV证明
- 多重签名 — M-of-N多签钱包(企业级安全)
- RBF — BIP125交易替换(加速确认)
- 时间锁 — 基于时间/区块高度的锁定
- Bitcoin脚本 — 脚本执行引擎
- SPV轻客户端 — 简化支付验证
- 内存池 — 手续费优先级排序的交易池
- 真实密码学 — secp256k1 ECDSA签名
- Web界面 — 内置浏览器界面,无需额外依赖
git clone https://github.com/GeoffreyWang1117/Awesome-Bitcoin-Internals.git
cd SimpleBTC
cargo run --bin btc-server --release
# 打开浏览器访问 http://localhost:3000- 入门: 运行
btc-demo,阅读docs/src/guide/目录 - 进阶: 学习高级特性(多签、RBF、TimeLock),研究
examples/ - 深入: 阅读核心源码
blockchain.rs、transaction.rs、block.rs
cargo install mdbook
cd docs && mdbook serve --open15,000+ 字系统化中文文档,涵盖从入门到精通的所有内容。
Awesome Bitcoin Internals — Learn Bitcoin by building it.
If this helped you, a star means a lot.