{
    "meta": {
        "title": "D-Central — Bitcoin Miniscript Reference (BIP-379)",
        "description": "The 23 BIP-379 Miniscript fragments with the Bitcoin Script each compiles to, its semantics and base type; plus the 10 wrappers, the B/V/K/W type system with correctness (z/o/n/d/u/k) and malleability (s/f/e) modifiers, and the resource limits. BIP-379 Status: Draft.",
        "generated": "2026-07-26T13:27:26+00:00",
        "version": "1.0",
        "as_of": "2026-07-26",
        "license": "https://creativecommons.org/licenses/by/4.0/",
        "license_name": "CC BY 4.0",
        "source": "https://d-central.tech/bitcoin-miniscript-reference/",
        "method": "Extracted from the canonical bitcoin/bips bip-0379.md (Status: Draft, raw, fetched 2026-07-26). Fragment scripts and semantics are transcribed from the spec table; [X] denotes the compiled Script of subexpression X. BIP-379 defines no \"m\" (nonmalleable) modifier and no upper key bound on multi_a — both reflected faithfully.",
        "provenance": "bitcoin/bips (github.com/bitcoin/bips) BIP-0379 (Requires: 380).",
        "record_count": 23
    },
    "rows": [
        {
            "expr": "0",
            "script": "0",
            "semantics": "Always false; pushes an exact 0 (the canonical dissatisfaction, no satisfaction exists).",
            "type": "B"
        },
        {
            "expr": "1",
            "script": "1",
            "semantics": "Always true; pushes a 1 (satisfied by empty input, cannot be dissatisfied).",
            "type": "B"
        },
        {
            "expr": "pk_k(key)",
            "script": "<key>",
            "semantics": "check(key): pushes the public key; a c: wrapper is still needed to CHECKSIG it.",
            "type": "K"
        },
        {
            "expr": "pk_h(key)",
            "script": "DUP HASH160 <HASH160(key)> EQUALVERIFY ",
            "semantics": "check(key): reveals the key matching HASH160(key) then requires its signature.",
            "type": "K"
        },
        {
            "expr": "pk(key) = c:pk_k(key)",
            "script": "<key> CHECKSIG",
            "semantics": "check(key): satisfied by a valid signature for key (sugar for c:pk_k(key)).",
            "type": "B"
        },
        {
            "expr": "pkh(key) = c:pk_h(key)",
            "script": "DUP HASH160 <HASH160(key)> EQUALVERIFY CHECKSIG",
            "semantics": "check(key): reveal the key hashing to HASH160(key) then satisfy with its signature (sugar for c:pk_h(key)).",
            "type": "B"
        },
        {
            "expr": "older(n)",
            "script": "<n> CHECKSEQUENCEVERIFY",
            "semantics": "nSequence >= n: satisfied when the relative timelock of n is met.",
            "type": "B"
        },
        {
            "expr": "after(n)",
            "script": "<n> CHECKLOCKTIMEVERIFY",
            "semantics": "nLockTime >= n: satisfied when the absolute timelock of n is met.",
            "type": "B"
        },
        {
            "expr": "sha256(h)",
            "script": "SIZE <0x20> EQUALVERIFY SHA256 <h> EQUAL",
            "semantics": "len(x)=32 and SHA256(x)=h: satisfied by revealing the 32-byte preimage x of h.",
            "type": "B"
        },
        {
            "expr": "hash256(h)",
            "script": "SIZE <0x20> EQUALVERIFY HASH256 <h> EQUAL",
            "semantics": "len(x)=32 and HASH256(x)=h: satisfied by revealing the 32-byte preimage x.",
            "type": "B"
        },
        {
            "expr": "ripemd160(h)",
            "script": "SIZE <0x20> EQUALVERIFY RIPEMD160 <h> EQUAL",
            "semantics": "len(x)=32 and RIPEMD160(x)=h: satisfied by revealing the 32-byte preimage x.",
            "type": "B"
        },
        {
            "expr": "hash160(h)",
            "script": "SIZE <0x20> EQUALVERIFY HASH160 <h> EQUAL",
            "semantics": "len(x)=32 and HASH160(x)=h: satisfied by revealing the 32-byte preimage x.",
            "type": "B"
        },
        {
            "expr": "andor(X,Y,Z)",
            "script": "[X] NOTIF [Z] ELSE [Y] ENDIF",
            "semantics": "(X and Y) or Z: if X is satisfied then Y must be, otherwise Z must be.",
            "type": "B/K/V (as Y and Z)"
        },
        {
            "expr": "and_v(X,Y)",
            "script": "[X] [Y]",
            "semantics": "X and Y: X (a V) is verified then Y is satisfied; both required.",
            "type": "B/K/V (as Y)"
        },
        {
            "expr": "and_b(X,Y)",
            "script": "[X] [Y] BOOLAND",
            "semantics": "X and Y: both X (B) and Y (W) satisfied, combined with BOOLAND.",
            "type": "B"
        },
        {
            "expr": "and_n(X,Y) = andor(X,Y,0)",
            "script": "[X] NOTIF 0 ELSE [Y] ENDIF",
            "semantics": "X and Y with else-false: if X holds require Y, else fail (sugar for andor(X,Y,0)).",
            "type": "B"
        },
        {
            "expr": "or_b(X,Z)",
            "script": "[X] [Z] BOOLOR",
            "semantics": "X or Z: satisfied if either X (Bd) or Z (Wd) is, combined with BOOLOR.",
            "type": "B"
        },
        {
            "expr": "or_c(X,Z)",
            "script": "[X] NOTIF [Z] ENDIF",
            "semantics": "X or Z (continuation): if X (Bdu) holds continue, else Z (V) must be verified.",
            "type": "V"
        },
        {
            "expr": "or_d(X,Z)",
            "script": "[X] IFDUP NOTIF [Z] ENDIF",
            "semantics": "X or Z: if X (Bdu) holds it stands, otherwise Z (B) must be satisfied.",
            "type": "B"
        },
        {
            "expr": "or_i(X,Z)",
            "script": "IF [X] ELSE [Z] ENDIF",
            "semantics": "X or Z: a witness-supplied selector (1/0) chooses the X or Z branch.",
            "type": "B/K/V (as X and Z)"
        },
        {
            "expr": "thresh(k,X_1,...,X_n)",
            "script": "[X_1] [X_2] ADD ... [X_n] ADD ... <k> EQUAL",
            "semantics": "X_1 + ... + X_n = k: satisfied when exactly k of n subexpressions are (X_1 is Bdu, the rest Wdu).",
            "type": "B"
        },
        {
            "expr": "multi(k,key_1,...,key_n)",
            "script": "<k> <key_1> ... <key_n> <n> CHECKMULTISIG",
            "semantics": "k-of-n multisig via CHECKMULTISIG (P2WSH only; 1 <= k <= n <= 20).",
            "type": "B"
        },
        {
            "expr": "multi_a(k,key_1,...,key_n)",
            "script": "<key_1> CHECKSIG <key_2> CHECKSIGADD ... <key_n> CHECKSIGADD <k> NUMEQUAL",
            "semantics": "k-of-n multisig via CHECKSIGADD (Tapscript only; 1 <= k <= n, no upper bound stated).",
            "type": "B"
        }
    ],
    "wrappers": [
        {
            "w": "a:",
            "transform": "TOALTSTACK [X] FROMALTSTACK",
            "meaning": "Runs X against the alt stack, converting a B into a W (reads its input one below the top of stack)."
        },
        {
            "w": "s:",
            "transform": "SWAP [X]",
            "meaning": "SWAPs the top two elements before running X, converting a Bo into a W."
        },
        {
            "w": "c:",
            "transform": "[X] CHECKSIG",
            "meaning": "Appends CHECKSIG, converting a K (key) expression into a B by requiring a signature."
        },
        {
            "w": "t:",
            "transform": "[X] 1",
            "meaning": "t:X = and_v(X,1): appends a 1 after X, turning a V into a B."
        },
        {
            "w": "d:",
            "transform": "DUP IF [X] ENDIF",
            "meaning": "Makes a Vz expression dissatisfiable (a B): a witness element selects whether X runs."
        },
        {
            "w": "v:",
            "transform": "[X] VERIFY (or the VERIFY form of X's last opcode)",
            "meaning": "Appends VERIFY, converting a B into a V (continues without pushing, cannot be dissatisfied)."
        },
        {
            "w": "j:",
            "transform": "SIZE 0NOTEQUAL IF [X] ENDIF",
            "meaning": "Makes a Bn expression dissatisfiable by supplying an empty (zero-size) input that skips X."
        },
        {
            "w": "n:",
            "transform": "[X] 0NOTEQUAL",
            "meaning": "Appends 0NOTEQUAL, normalizing X's nonzero output to an exact 1 (adds the u/unit property)."
        },
        {
            "w": "l:",
            "transform": "IF 0 ELSE [X] ENDIF",
            "meaning": "l:X = or_i(0,X): X sits on the ELSE branch (selected with a 0 witness)."
        },
        {
            "w": "u:",
            "transform": "IF [X] ELSE 0 ENDIF",
            "meaning": "u:X = or_i(X,0): X sits on the IF branch (selected with a 1 witness)."
        }
    ],
    "types": {
        "basic": [
            {
                "t": "B",
                "name": "Base",
                "meaning": "Takes inputs from the top of the stack; on satisfaction pushes a nonzero value, on dissatisfaction pushes an exact 0. Required for the top-level expression."
            },
            {
                "t": "V",
                "name": "Verify",
                "meaning": "Takes inputs from the top of the stack; on satisfaction continues without pushing anything and cannot be dissatisfied (it aborts instead)."
            },
            {
                "t": "K",
                "name": "Key",
                "meaning": "Takes inputs from the top of the stack but always pushes a public key, for which a signature is still required (convert to B with c:)."
            },
            {
                "t": "W",
                "name": "Wrapped",
                "meaning": "Takes inputs one below the top of the stack; every W is either s:B (SWAP) or a:B (TOALTSTACK ... FROMALTSTACK)."
            }
        ],
        "correctness": [
            {
                "t": "z",
                "meaning": "Zero-arg: always consumes exactly 0 stack elements."
            },
            {
                "t": "o",
                "meaning": "One-arg: always consumes exactly 1 stack element."
            },
            {
                "t": "n",
                "meaning": "Nonzero: always consumes at least 1 element; no satisfaction needs the top input to be zero."
            },
            {
                "t": "d",
                "meaning": "Dissatisfiable: a dissatisfaction can always be constructed (no signature, preimage or timelock required for it)."
            },
            {
                "t": "u",
                "meaning": "Unit: when satisfied, puts an exact 1 on the stack (not just any nonzero value)."
            },
            {
                "t": "k",
                "meaning": "No timelock mixing: does not mix a heightlock and a timelock of the same type."
            }
        ],
        "malleability": [
            {
                "t": "s",
                "meaning": "Signed: satisfying always requires a signature."
            },
            {
                "t": "f",
                "meaning": "Forced: dissatisfying always requires a signature."
            },
            {
                "t": "e",
                "meaning": "Expressive: a unique unconditional dissatisfaction exists, and all conditional dissatisfactions require a signature."
            }
        ]
    },
    "resource_limits": [
        "P2WSH scripts larger than 3600 bytes are invalid by standardness; Tapscript is only implicitly bounded by the ~1,000,000 vbyte block size.",
        "P2WSH: satisfactions where non-push opcodes plus the keys in all executed CHECKMULTISIG exceed 201 are invalid by consensus.",
        "Both contexts: satisfactions that make the stack exceed 1000 elements before or during execution are invalid.",
        "P2WSH: satisfactions whose witness has over 100 stack elements (excluding the script) are invalid by standardness.",
        "multi(): 1 <= k <= n <= 20 (CHECKMULTISIG key cap). multi_a(): 1 <= k <= n (BIP-379 states no explicit upper key bound)."
    ]
}