Passer au contenu

Bitcoin accepté au paiement  |  Expédié depuis Laval, QC, Canada  |  Soutien expert depuis 2016

Miniscript

Network & Protocol

Definition

Miniscript is a language for expressing a well-defined subset of Bitcoin Script in a structured way, designed so that scripts can be reliably analyzed, composed, and signed for by general-purpose software. It was designed by Pieter Wuille, Andrew Poelstra, and Sanket Kanjalkar at Blockstream Research and is specified in BIP379. The insight is that wallets do not need to handle arbitrary Script — they need a disciplined fragment of it whose properties a machine can prove. Every Miniscript expression maps to real, consensus-valid Script; the language just refuses the dark corners where analysis becomes impossible.

Policy language and compilation

Alongside Miniscript sits a higher-level policy language. A developer writes down the conditions under which coins may move — combinations of keys, thresholds, timelocks, hashlocks: "either my key, or after 90 days, 2-of-3 among these recovery keys" — and a compiler translates that intent into the most efficient equivalent Miniscript, and from there into valid Script assembled from ordinary opcodes. The separation matters: humans state what must be true, tooling decides how to encode it optimally and correctly. Different policies with the same meaning compile to the same battle-tested constructions instead of each developer hand-rolling a novel script and hoping.

Why it matters

Hand-written Script is where funds go to die. A subtle mistake can create an unspendable output, an unintended spending path, or a script whose witness cannot be estimated — and Script's flexibility makes such errors easy to write and hard to spot. Miniscript makes scripts machine-checkable: a wallet can determine whether it is able to satisfy a given script, exactly which signatures and preimages the witness needs, what the worst-case witness size and fee will be, and whether any timelock combination is contradictory. That turns advanced multisig and timelocked recovery setups from artisanal cryptography into engineering with guarantees. It composes, too: because every fragment carries known correctness and malleability properties, complex policies are built from verified parts rather than reinvented monoliths.

The notation is compact enough to read. A policy like or(pk(A),and(pk(B),older(12960))) says: key A can spend at any time, or key B after roughly ninety days — a complete inheritance fallback in one line. The compiler turns it into optimal Script, and because the expression nests inside an output descriptor, the entire wallet — keys, paths, and policy — restores from a single string of text.

The plumbing cooperates end to end: descriptors carry the policy, PSBTs carry the partially signed transaction between wallet and signer, and Miniscript's analysis fills in the piece coin selection always needed — an accurate worst-case witness size, and therefore an accurate fee, computed before signing rather than discovered after. For anyone building a serious custody setup by hand, that predictability is the difference between hoping a script works and knowing exactly what it will cost to spend under every branch, years from now, on a fee market nobody can foresee.

Adoption and the sovereignty angle

Miniscript integrates with output descriptors — the modern standard for describing wallets — and support has landed in Bitcoin Core and in hardware wallets, letting a signing device display and enforce a complex policy it can actually parse rather than blindly approving an opaque blob. It extends naturally to Taproot, compiling policies into script-path leaves under Tapscript rules. For the sovereign holder, the payoff is concrete: inheritance plans, decaying multisig (full quorum now, fewer keys after a delay), and vault-like recovery paths become configurations you can audit and reproduce from a text string — self-custody policies with the rigor of software instead of the fragility of folklore. Miniscript is quiet infrastructure, but it is a large part of why sophisticated Bitcoin custody keeps getting safer to do yourself.

In Simple Terms

Miniscript is a language for expressing a well-defined subset of Bitcoin Script in a structured way, designed so that scripts can be reliably analyzed, composed,…

Explore the Full Glossary

Browse all Bitcoin mining terms from A to Z. Whether you are a beginner or expert, deepen your understanding of the mining ecosystem.

Glossaire du minage

ASIC Miner Database

Compare 500+ miners with real-time profitability data, home mining scores, and detailed specs.

Comparer les mineurs