Miniscript is a simple language that helps you write Bitcoin spending rules in a way that is easier to read, check, and turn into Bitcoin Script. It gives developers basic building blocks to describe who can spend coins and under what conditions.
Miniscript lets programmers write common Bitcoin script patterns without having to create raw Script bytecode by hand. Instead of using low-level codes, you describe logical rules that are safe to combine, and a compiler turns them into standard Script. This helps prevent bugs and makes it easier to check the rules automatically.
Miniscript was developed at Blockstream Research by Pieter Wuille, Andrew Poelstra, and Sanket Kanjalkar. Their goal was to make Bitcoin scripting more modular and easier to analyze. The project started as research and tooling, and later gained documentation and adoption by wallets and developer tools.
Miniscript has two parts: a human-friendly policy layer and a concrete Miniscript form. Policies are easy-to-read descriptions of spending rules. A compiler turns these policies into Miniscript code, which can then be converted into Bitcoin Script. Each part of Miniscript has a clear meaning, so you can check costs, stack behavior, and safety before locking up funds.
The policy language uses simple parts like single signatures, thresholds, and timelocks. You combine these with operators to say things like “either A and B or C after a timeout.” A compiler turns this policy into Miniscript that follows strict rules. This Miniscript can then be turned into regular Script that Bitcoin nodes accept. Because the process is systematic, wallets can predict witness size and check if a script meets standard and safety requirements.
Miniscript is built so its parts can be safely combined. This makes automated analysis possible. Tools can check if a policy lets someone create a valid witness, estimate its size, and see what keys and conditions are needed. This helps developers avoid risky setups that could lock funds or leak private data. Many wallets use Miniscript for features like time-delayed recovery, complex multisig, and policy-based key management.
Developers often use Miniscript for tasks like multisignature wallets, where signing rules must be flexible and easy to check. Another use is time-locked access, where a guardian can spend funds at first, but the owner can access them after a timeout. Since Miniscript is easy to analyze, teams also use it to automate policy checks in wallet software and to estimate fees and witness sizes before signing.
One of Miniscript’s main strengths is the formal guarantees built into its design. The language lets you check if a script part is safe to use, what data it needs when spending, and how it will act with different witnesses. Tools based on Miniscript can spot nonstandard or risky constructs, making audits much easier than with custom Script.
There are reference implementations and libraries that can read policies, compile Miniscript, and create Script. Wallets and developer tools use these libraries so users can set high-level policies and let the software handle the technical details. You can find documentation and examples from many sources, including glossaries and the original project pages.
Miniscript works for many common cases but does not replace every Script pattern. Some custom or experimental scripts do not fit its safe rules and must be written by hand. Also, since Miniscript compiles to standard Script, you still need to understand the final Script and witness sizes for fee estimates and wallet or node compatibility.