Miniscript: A new programming language for Bitcoin Smart Contracts

The miniscript that has just been released may change the situation. Pieter Wuille, Blockstream co-founder and one of the most renowned Bitcoin developers around, recently presented the new language for Bitcoin scripts on the Bitcoin developers mailing list and on his website. Miniscript is "a language to write (a subset of) Bitcoin scripts in a structured way that allows them to be analyzed, composed, genetically signed, and more."
On his side, Wuille also explains in more detail the shortcomings in the actual Bitcoin script that prompted him to develop Miniscript. The functionality of script is limited, but many things that are taken for granted with other languages are "not trivial". As an example, Wuille mentions analysis problems - which script is most efficient to accomplish a certain task? How can you predict the cost of execution in BitQH? Which issue conditions are prohibited? - but also the composition, for example if you have a multisig contract with 4 participants, but the coins of one participant are interwoven in another smart contract. Such cases are probably incredibly difficult to construct with script.
"Miniscript acts as a representation of the scripts that make such operations possible," writes Wuille. “It has a structure that allows compositions and makes it very easy to carry out static analyzes for various properties.” So Miniscript is a tool for composing and analyzing scripts better. It's more of a surface for the actual code; to be executed, a miniscript is compiled into a bitcoin script.
An example: The script to check the signature of a transaction and discard it if the signature is not valid, looks like this in Bitcoin: OP_CHECKSIGVERIFY OP_CHECKSIG. Pieter Wuilles Miniscript, on the other hand, represents it like this: and_v (vc: pk (K), c: pk (A)). That doesn't necessarily look less complicated, but it is shorter.Especially with more complex scripts, Miniscript should help to make them more readable and editable for people.
According to you can do a lot of interesting things with Miniscript. For example, you can form complex multisig contracts in which certain subconditions are defined for the individual parties. The collective safekeeping of money can be made much finer and more detailed. In addition, it becomes more transparent which resources - for example for fees - the issue of a coin tied by a special script requires.
Wuille's idea is not new. Ethereum has won smart contract developers by storm with its high-level language Solidity and has become the epitome of the programmable blockchain. Solidity is its own programming language developed for Ethereum, which is reminiscent of JavaScript and is therefore quickly familiar to web developers. Similarly, a bitcoin cash developer released Cashscript, a scripting language based on JavaScript syntax, a few months ago, and a language called sCrypt was announced for Bitcoin SV just a few days ago and will soon be tested. It is also close to JavaScript.
The parallelism of the development is amazing. Bitcoin has almost stagnated in the field of scripts for a good 10.5 years.Now suddenly there are innovations on three incarnations of Bitcoin (BTC, BCH, BSV), all of which are trying to break the Bitcoin scripts out of their rigid corset and bring them into a form in which users and developers can write, read, edit and analyze.
Compared to Cashscript and sCrypt, Blockstream's Miniscript seems to be the most mature. Wuille and his colleagues Andrew Poelstra and Sanket Sanjalkar have been working on the project for over a year. The current implementation is far from complete, "but after having passed broad, randomized tests, we are confident that the design of the language and the associated witnesses [signatures] are compatible with the existing consensus and standard rules," writes Wuille in the mailing list. In other words: Miniscript is ready for production for standard applications.
There are already two implementations, in Rust and in C . Above all, the two languages shine through their speed and are usually used more for locally running software. In this case, that could be wallets. The Wallet Green, also developed by Blockstream, should be a good candidate for bringing Miniscript to the user first. In contrast, the two languages are rather unusual - or rather bulky - in web development. These should address the JavaScript-related projects such as Cashscript and sCrypt better. However, if Miniscript is a success, it will only be a matter of time before it is implemented in JavaScript. And in PHP. And in Perl, Ruby, Python and so on.