Every Byte Tells a Story

A Complete Guide to Bitcoin Transaction Anatomy
Imagined by Brian Hirschfield
Magic Internet Math Academy · 2026
Web Edition — Interactive
Part I — Foundations
1The Raw Transaction
Satoshi → Hal Finney, 275 bytes parsed byte by byte. Version, inputs, outputs, locktime.
2The Script Machine
Bitcoin's stack-based VM. Opcodes, evaluation model, Script as predicate.
3Hashing and Signing
SHA-256d, sighash preimages, ECDSA, DER encoding, SIGHASH flags, ANYONECANPAY.
Part II — The Classic Era (2009–2017)
4Pay to Public Key (P2PK)
The original output type. Exposed keys, quantum implications, Genesis Block.
5Pay to Public Key Hash (P2PKH)
The "1-address" revolution. Hash160, Base58Check, the quantum firewall.
6Pay to Script Hash (P2SH)
BIP 16, "3-addresses," redeem scripts, two-phase evaluation.
7Multisig
OP_CHECKMULTISIG, the off-by-one bug, m-of-n combinations.
Part III — The SegWit Revolution (2017–2021)
8Segregated Witness
Malleability, marker/flag bytes, weight vs size vs vsize.
9P2WPKH: Native SegWit
bc1q addresses, empty scriptSig, Bech32 encoding.
10P2WSH: SegWit Script Hash
Witness scripts, P2WSH multisig, the witness stack.
Part IV — The Taproot Era (2021–present)
11Taproot: P2TR and Schnorr Signatures
BIP 340/341/342, 64-byte Schnorr sigs, x-only keys, key path spending.
12Tapscript: The Script Path
Merkle tree of scripts, control blocks, TapLeaf and TapBranch.
Part V — Special Transactions
13The Coinbase Transaction
Null input, block height, witness commitment, mining pool tags.
14OP_RETURN: Data on the Blockchain
Provably unspendable outputs, 80-byte data limit.
15Timelocks: Programming in Time
nLockTime, CLTV, CSV, relative timelocks, HTLCs.
16RBF and CPFP: Fee Market
Replace-by-fee, child-pays-for-parent, TRUC transactions, package relay.
Part VI — Protocol Layer Transactions
17Lightning Network
Funding, commitment, HTLC, cooperative close, force close, penalty.
18Ordinals and Inscriptions
Ordinal theory, the envelope protocol, commit/reveal, inscription #0.
19Runes: Fungible Tokens
Runestones, LEB128, etching, minting, edicts, cenotaphs.

Interactive Tools

🔬

Transaction Dissector

Paste any raw transaction hex — get instant color-coded byte-by-byte parsing with structure tree.

⚙️

Script VM

Step through Bitcoin Script execution with animated stack. P2PK, P2PKH, P2SH multisig, P2WPKH.

ANYONECANPAY Demo

Walk through the real Block 207,733 assurance contract — the first 0x81 transaction on mainnet.