CryptoNetHub

Commit-Reveal vs Dual-Layer Scripts: The Real Architecture of Bitcoin Script

Companion notes to my bookMastering Taproot. HODLing is the beginning. But Bitcoin was meant to be programmed. "Not Just HODLing: Real Bitcoin Script Engineering" starts here. Enter fullscreen modeExit. . .

· 3 min read

Commit-Reveal vs Dual-Layer Scripts: The Real Architecture of Bitcoin Script

Companion notes to my bookMastering Taproot. HODLing is the beginning. But Bitcoin was meant to be programmed. "Not Just HODLing: Real Bitcoin Script Engineering" starts here. Enter fullscreen modeExit fullscreen modeBitcoin Script looks like a single program. It isn’t. Underneath, two different architectures coexist:a philosophicalcommit–revealmodel shared by all address typesan engineeringdual-layerstructure introduced only in P2SH, P2WSH, and Taproot script-pathMost confusion comes from mixing these two. This essay separates them cleanly. 1. The Universal Truth: Commit → RevealEvery Bitcoin output — P2PKH, SegWit, Taproot — follows one rule:Lock: commit to a condition Unlock: reveal a proof satisfying itEnter fullscreen modeExit fullscreen modeP2PKH commits to a pubkey hashP2SH commits to a script hashP2WSH 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 ScriptsCommit–reveal is universal. Dual-layer execution is not. Bitcoin has exactly two script architectures:Single-Layer ScriptsUsed by:P2PK / P2PKHP2MS (bare multisig)P2WPKHTaproot key-pathStructure:scriptSig / witness pushes data ↓ scriptPubKey (or implicit logic) executes directlyEnter fullscreen modeExit fullscreen modeNo script hash. No script extraction. No inner vs outer. P2WPKHWitness only carries data. Nodes recognizeOP_0 , then execute an implicit P2PKH-equivalent program. This is not dual-layer because there is no script hash and no revealed script. Taproot key-pathPure single-layer: a single Schnorr signature verifies the tweaked key. No script execution at all. Dual-Layer ScriptsUsed only by:P2SHP2WSHTaproot script-pathArchitecture:Outer layer: verify a commitment (hash / tweaked key) Inner layer: execute the revealed scriptEnter fullscreen modeExit fullscreen mode┌─────────────────────────────┐ │ Outer Commit Layer │ │ (scriptPubKey commitment) │ └───────────────┬─────────────┘ │ ▼ ┌─────────────────────────────┐ │ Inner Execution Layer │ │ (redeemScript / witnessScript / tapscript) └─────────────────────────────┘Enter fullscreen modeExit fullscreen modeOnly 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 TypesP2SHscriptPubKey:OP_HASH160OP_EQUALredeemScript:(actuallogic,e. g. OP_CHECKSIG)Enter fullscreen modeExit fullscreen modeP2WSHscriptPubKey:OP_0witnessScript:(actuallogic)Enter fullscreen modeExit fullscreen modeTaproot script-pathscriptPubKey:OP_1witness:Enter fullscreen modeExit fullscreen modeThecontrol_blockcontains the internal key and Merkle path. The outer script never encodes logic — only a fingerprint of logic. 4. Why This Distinction MattersFailing to distinguish these two layers leads to confusion:Why P2SH’s scriptPubKey has no OP_CHECKSIGWhy SegWit moves scripts into the witnessWhy P2WSH and Taproot require revealing full scriptsWhy Taproot must reconstruct the tweaked keyWhy 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 EvolutionP2PK → commit(pubkey) P2PKH → commit(hash(pubkey)) P2SH → commit(hash(script)) P2WSH → commit(sha256(script)) Taproot → commit(internal_key + tweak(merkle_root))Enter fullscreen modeExit fullscreen modeCommitments grow more abstract. Privacy improves. Scripts expose less and less. But the core remains unchanged:Commit → Reveal → ExecuteEnter fullscreen modeExit fullscreen modeThis is the true architecture of Bitcoin programmability. ByAaron RecompileonDecember 2, 2025. Canonical linkExported fromMediumon July 3, 2026.

Source: dev.to

More Bitcoin news