Miniscript



Summary:

Miniscript is a language for writing a subset of Bitcoin Scripts in a structured way that enables analysis, composition, generic signing and more. The project has been worked on by Pieter Wuille, Andrew Poelstra and Sanket Sanjalkar for the past year or so. With Miniscript, it is possible to write descriptors for addresses for scripts that implement things more complicated than multisig, make software that can deal with composition of policies, compile complex spending policies to efficient scripts, figure out under what necessary and/or sufficient conditions a script can be satisfied, and given signatures for a sufficient set of keys (and hash preimages, if needed), generically construct a witness for arbitrary scripts, without metadata apart from the script itself and public keys appearing in it. This means generic PSBT signers are possible for this class of scripts. Static analysis is possible with Miniscript, which can make a huge difference for new Bitcoin applications such as JoinMarket, Wasabi wallet, and Arwen all suffer from a problem of having novel bitcoin scripts. Miniscript can significantly reduce the barrier for novel application writers to convince both themselves and others that the code they wrote does not risk user funds being lost. A hardware wallet with a Miniscript analyzer may not be able to tell you that a transaction is a CoinJoin transaction, but it will be able to tell you that under all possible scenarios, you end up with just as many coins in your addresses that you started with, modulo some transaction fee. Miniscript is designed for Bitcoin as it exists today (primarily P2WSH), and does not need any consensus changes. Two implementations of Miniscript exist: a C++ one and a Rust library. Through large scale randomized tests, the team has confidence that the language design and associated witnesses are compatible with the existing consensus and standardness rules. While Miniscript is not a complete solution, its widespread use would be a huge boon to the Bitcoin ecosystem.


Updated on: 2023-06-13T21:05:01.910570+00:00