Learn Bitcoin by building it.

Books, research and tools for learning and building Bitcoin, made by Aaron Zhang.

Every idea comes as code you can run.

I rebuild Bitcoin piece by piece until I understand it. Everything here is what that work leaves behind. — Aaron Zhang

Books

Every chapter is a notebook. Read it, run it, change a line and see what breaks.

Bitcoin from Scratch cover

Bitcoin from Scratch

Build your own Bitcoin chain, from a single byte to a working network. Standard library only, so you write every piece yourself.

Runs in your browser18 chaptersBeginner → intermediate
Mastering Taproot cover

Mastering Taproot

Taproot script engineering for developers: keys and addresses, P2SH, SegWit, then real Taproot contracts and script trees, verified on testnet.

Local Python · testnet8 chaptersDevelopers

Booklets

Frontier mechanisms made visible: small books, Feynman-style, with the experiments behind them.

Series · two volumes

Covenants from First Principles

Hard mechanisms explained Feynman-style, from one question up: can a coin carry rules about where it goes next? Volume I asks what a signature can see. Volume II asks where Bitcoin can grow new rules.

Vol. I · Sight · playground

What a Signature Can See

Sighash from the ground up, with a playground where you flip the flags and watch what a signature commits to.

sighash.bitcoincoding.dev
Vol. II · Slots · field guide

The Grammar of Extensibility

Bitcoin's reserved upgrade slots at the byte level: which one CAT, CSFS, CTV and APO plug into, on real signet bytes.

slots.bitcoincoding.dev
History · standalone

How People Pushed Data into Bitcoin

A reproducible engineering history of every technique for embedding data in Bitcoin, with testnet implementations.

github · early draft

Research

Papers from research at Bitcoin's protocol frontier, with code and on-chain evidence.

Paper · Jun 2026

Is CSFS+CAT already a general covenant primitive?

Three on-chain demonstrations, and an observation for discussion.

Experiments

Open problems posed by other builders, answered in working code.

Builds on Christian Decker · eltoo

APO from scratch, then an eltoo chain

An independent BIP-118 signer, cross-validated by Inquisition's consensus code: one APO signature spends two coins without re-signing. Then a three-round eltoo state chain built on it, settled with CTV.

Answers Robin Linus · BitVM bridges

Spend A only if B is co-spent

A new tapscript construction: one signature passes both CSFS and CHECKSIG, so the script can read sha_prevouts and demand a specific second UTXO. The input check a BitVM bridge connector needs.

Builds on Jeremy Rubin · CSFS rekey ladder

Rekey ladder theory

An implementation of Rubin and Rearden's CSFS rekey ladder, attacked in four stages: where joint state binding holds, and the exact condition that breaks it.

Answers Bob McElrath · Braidpool

Rolling coinbase aggregation

An answer, on chain, to Bob McElrath's covenant challenge for Braidpool: each new coinbase joins the pool through a two-input APO update, and only the latest CTV payout can settle.

Writing

Articles that take one mechanism apart at a time, collected and searchable.

Article index

Recompile Archive

Every technical article in one place: Taproot, Script, covenant opcodes on signet, grouped into series and searchable.

Tools

The libraries and analyzers the books and research are built on.

Python library

btcaaron

Pragmatic Taproot toolkit, with templates for Inquisition opcodes. The library behind Mastering Taproot.

Analyzer

RootScope

Taproot script-path analyzer: fetch the witness, rebuild the Merkle proof, check the address.

Dev tool

btcrun

Bitcoin chain manager and regtest dev tool.

About

Aaron Zhang
Aaron Zhang

Author of Mastering Taproot and Bitcoin from Scratch.

Bitcoin Developer, Educator and Investor.