Recently Peter Wuille introduced a new smart contract language for the Bitcoin code called Miniscript. Peter, who is known for creating the SegWit code, says he has been working on this for about a year.
In recent news, Peter Wuille, the creator of SegWit has come out with a new work. This time it is a completely new programming language called Miniscript, which is meant for creating smart contracts on the Bitcoin network. Peter posted this new idea on the Bitcoin developer mailing list on Monday, this week. In general, he and two other programmers Andrew Poelstra and Sanket Sanjalkar were working on this code for about a year. When asked – “Why post only now?” – he replied that the project has reached the point where it needs some public attention.
“Miniscript is a language for writing (a subset of) Bitcoin Scripts in a structured way, enabling analysis, composition, generic signing and more,” it’s defined on their website.
So what Peter actually did? Let’s try to understand. So to understand, we’ll need to revisit what is Script – the current Bitcoin smart contract programming language. That is a Bitcoin code feature which allows you to specify certain conditions under which the spending of Bitcoins can actually occur. Whether you want the beneficiary to receive it after a specific period of time or you just want your transaction to be a part of a multi-sig system which requires the signatures of multiple participants in the transaction. So far, this is what Script offered to the Bitcoin network.
However, Miniscript – the new language written by Peter, is built on top of Script and is designed to optimize it by shortening the code and making it more “readable”. So, for example, if in the Script programming language the code looks like this:
OP_CHECKSIG OP_IFDUP OP_NOTIF OP_DUP OP_HASH160 <hash160 (B)>
OP_EQUALVERIFY OP_CHECKSIGVERIFY <144> OP_CSV OP_ENDIF
Then in Miniscript it looks like this:
or_d (c: pk (A), and_v (vc: pk_h (B), older (144)))
So as you can see, the code is optimized by being shorter and more structured. According to Wuille, Miniscript is a completely new way of writing structured scripts that provides the ability to conduct various types of static analysis, generate generic signatures and a modifiable set of conditions for executing smart contracts.
“Suppose a company wants to protect funds stored in cold storage using a 2-of-3 multi-signature system with three members. One of the participants, however, has its own good set based on two-factor authentication, multi-signature and time lock. Why not make the entire company system one of the multi-signature participants,” Peter writes in his Twitter account.
At the moment, Miniscript is available in two programming languages – C++ and Rust. While the coders are still in works on developing this new language, they say that with all the tests they had, now they feel safe that the code can be implemented within the Bitcoin network. Moreover, in the future, they plan to develop a structure which would support future script changes for Bitcoin.
All-in-all, Peter believes this is a very useful feature for Bitcoin and hopes that the developer community will accept his innovation.