Companion notes to my book Mastering Taproot.
HODLing is the beginning.
But Bitcoin was meant to be programmed.
"Not Just HODLing: Real Bitcoin Script Engineering" starts here.
Bitcoin Script looks like a single program. It isnโt.
Underneath, two different architectures coexist:
a philosophical commitโreveal model shared by all address types
an engineering dual-layer structure introduced only in P2SH, P2WSH, and Taproot script-path
Most confusion comes from mixing these two.
This essay separates them cleanly.
1. The Universal Truth: Commit โ Reveal
Every Bitcoin outputโโโP2PKH, SegWit, Taprootโโโfollows one rule:
Lock: commit to a condition
Unlock: reveal a proof satisfying it
P2PKH commits to a pubkey hash
P2SH commits to a script hash
P2WSH commits to SHA256(script)
Taproot commits to a tweaked key (optionally hiding a Merkle tree)
This is a conceptual model, not an execution structure.
Commitโreveal is the language. Opcodes are the grammar.
2. Single-Layer vs Dual-Layer Scripts
Commitโreveal is universal. Dual-layer execution is not.
Bitcoin has exactly two script architectures:
Single-Layer Scripts
Used by:
P2PK / P2PKH
P2MS (bare multisig)
P2WPKH
Taproot key-path
Structure:
scriptSig / witness pushes data
โ
scriptPubKey (or implicit logic) executes directly
No script hash. No script extraction. No inner vs outer.
P2WPKH
Witness only carries data. Nodes recognize OP_0 <20 bytes>, then execute an implicit P2PKH-equivalent program.
This is not dual-layer because there is no script hash and no revealed script.
Taproot key-path
Pure single-layer: a single Schnorr signature verifies the tweaked key. No script execution at all.
Dual-Layer Scripts
Used only by:
P2SH
P2WSH
Taproot script-path
Architecture:
Outer layer: verify a commitment (hash / tweaked key)
Inner layer: execute the revealed script
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Outer Commit Layer โ
โ (scriptPubKey commitment) โ
โโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Inner Execution Layer โ
โ (redeemScript / witnessScript / tapscript)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Only these three structures follow: unlock โ reveal โ load script โ execute script.
This is why P2SH has no OP_CHECKSIG in its locking script. All logic lives in the inner script.
3. The Commitment Types
P2SH
scriptPubKey: OP_HASH160 <script_hash> OP_EQUAL
redeemScript: (actual logic, e.g. OP_CHECKSIG)
P2WSH
scriptPubKey: OP_0 <32-byte script_hash>
witnessScript: (actual logic)
Taproot script-path
scriptPubKey: OP_1 <32-byte output_pubkey>
witness: <stack> <tapscript> <control_block>
The control_block contains the internal key and Merkle path.
The outer script never encodes logicโโโonly a fingerprint of logic.
4. Why This Distinction Matters
Failing to distinguish these two layers leads to confusion:
Why P2SHโs scriptPubKey has no OP_CHECKSIG
Why SegWit moves scripts into the witness
Why P2WSH and Taproot require revealing full scripts
Why Taproot must reconstruct the tweaked key
Why key-path spend is โscriptlessโ
With the correct architecture, everything clicks:
Commitโreveal is the philosophy.Dual-layer is the mechanism.
P2PKH only follows the philosophy. P2SH / P2WSH / Taproot script-path implement both.
5. The Unified Evolution
P2PK โ commit(pubkey)
P2PKH โ commit(hash(pubkey))
P2SH โ commit(hash(script))
P2WSH โ commit(sha256(script))
Taproot โ commit(internal_key + tweak(merkle_root))
Commitments grow more abstract. Privacy improves. Scripts expose less and less.
But the core remains unchanged:
Commit โ Reveal โ Execute
This is the true architecture of Bitcoin programmability.
By Aaron Recompile on December 2, 2025.
Exported from Medium on July 3, 2026.
United States
NORTH AMERICA
Related News
Secret Claude Tracker Shocks Users After Anthropic's Anti-Surveillance Stance
12h ago
EV Batteries Defy Expectations, Last Hundreds of Thousands of Miles
1d ago
GBase 8a Performance Anomaly Case Study: How a Single Parameter Change Sparked a Chain Reaction
1d ago
Who Else Has Inherited a Codebase With Zero Comments and a Prayer?
1d ago
ๅฎ็พ็ๅนณๅบธ
4h ago