132 / 691MINI

Miniscript

Structured Bitcoin Script language

Miniscript is a structured, typed representation of a constrained subset of Bitcoin Script. It lets software compose spending conditions, analyze their properties, and construct a valid satisfaction without custom logic for every script.

Miniscript is not a new opcode, consensus rule, or general-purpose programming language. It is an intermediate layer between a human spending policy and concrete Bitcoin Script, usually embedded in a wsh() or Taproot output descriptor.

Miniscript structures only a selected subset of Bitcoin Script for signatures, hashlocks, timelocks, and their combinations. It changes no consensus rule and adds no opcode; coins are secured by the resulting Script, while Miniscript is the analyzable representation software compiles or recognizes.

A spending policy states intent, such as “A, or B after 144 blocks.” A compiler chooses a concrete Miniscript, which translates to Bitcoin Script. An Output Descriptor additionally binds the script to keys, derivation, network context, and checksum, for example wsh(...).

Fragments such as pk(), older(), after(), sha256(), and_v(), or_d(), and thresh() have exact semantics. Wrappers such as v: alter type or behavior without changing intent. Types B, V, K, and W enforce stack interfaces so only compatible expressions compose.

A satisfaction is witness data that makes a branch true; a dissatisfaction is a canonical false result needed to combine AND, OR, and threshold fragments. A generic signer selects paths from available signatures, preimages, and timelocks. Miniscript creates no private key and bypasses no missing condition.

after(n) uses absolute nLockTime, while older(n) uses relative nSequence under BIP 68. Height-based and time-based locks must remain compatible and transaction fields must be set correctly; consensus Bitcoin Script, not the policy text, ultimately validates the spend.

Static analysis can bound Script and witness size, operation and signature-check counts, stack elements, and the cost of alternative satisfaction paths. Results depend on the P2WSH or Tapscript context and must satisfy both consensus and standardness resource limits.

Type correctness guarantees safe composition, not a wise custody policy. Malleability analysis asks whether a third party can alter a valid satisfaction without breaking the conditions. Guarantees rely on stated assumptions, such as equal hash-preimage access, and duplicate keys may be forbidden.

One policy can compile to several equivalent Miniscripts with different Script and witness sizes. The compiler optimizes a cost model; branch weights such as 9@ are probability hints, not consensus rules. A different compilation normally creates a different Script and therefore different addresses.

In a descriptor wallet, Miniscript sits inside wsh() or a Taproot script path together with key origins. A PSBT can carry transaction and derivation data to signers, but the device must support that descriptor and policy. Verify keys, threshold, timelocks, and unexpected branches on its display.

Preserve the exact checksummed descriptor, key map, derivation paths, network, receive/change branches, range, and scan birthday. Run parser and analyzer checks, derive several addresses, and exercise every intended satisfaction on regtest or signet. Test watch-only recovery and signing before funding. Sources: BIP 379 — Miniscript; Miniscript Reference — Specification and Analyzer; Bitcoin Core — Output Descriptors; Bitcoin Core 24.0 — Miniscript Support; BIP 388 — Wallet Policies for Descriptor Wallets.

For the clearest picture, read this entry together with Bitcoin Script, Output Descriptor, Multisig, Andrew Poelstra, Timelock, Bitcoin. The reverse links also lead from Output Descriptor, Bitcoin Script opcode, Dead Man’s Switch, Pieter Wuille.

DOC · 001BIP 379 — MiniscriptSpecificationDOC · 002Miniscript Reference — Specification and AnalyzerSpecificationDOC · 003Bitcoin Core — Output DescriptorsDocumentationDOC · 004Bitcoin Core 24.0 — Miniscript SupportDocumentationDOC · 005BIP 388 — Wallet Policies for Descriptor WalletsSpecification
Reviewed 1 August 2026Source-first · No investment advice