Level 3 · Advanced
Script: from P2PKH to Taproot
In short
Bitcoin's spending conditions grew from P2PKH (one key) through P2SH and SegWit to Taproot, activated in 2021 with Schnorr signatures. With Taproot, complex conditions can look like an ordinary single-key payment on chain, which saves fees and improves privacy.
04Script: from P2PKH to TaprootP2SH, SegWit, Taproot, MAST and Tapscript.9 min
Script is stack-based and deliberately not Turing-complete: no loops, bounded execution, predictable cost. Each upgrade moved complexity off-chain or made it cheaper and more private.
- P2PKH (2009): pay to the HASH160 of a public key. The lab above runs this one.
- P2SH (BIP 16, 2012): pay to the hash of a script; the spender reveals and satisfies it. Made multisig practical.
- SegWit v0 (BIP 141, 143, 144; block 481,824, August 2017): moves signatures into the witness, fixes malleability, adds a new signature hash that commits to input amounts, and paved the way for Lightning.
- Taproot (BIP 340, 341, 342; block 709,632, November 2021): Schnorr signatures, a key-path spend that looks like any single-sig, and a tree of alternative scripts (MAST) where only the branch used is revealed. Tapscript adds
OP_CHECKSIGADDfor efficient threshold signatures.
Learn Bitcoin with real people.
Find meetups and Bitcoiners in your city, and ask the questions you'd never post online. Free to download on iPhone and Android.