Smart contracts could soon get a boost in bitcoin as prominent programmer Pieter Wuille has unveiled a new coding language designed specifically for their use.
Posted to the bitcoin developer mailing list Monday, the âMiniscriptâ language aims to make it easier for programmers to write up âsmart contractsâ or conditions for spending bitcoins. Programmers Wuille, Andrew Poelstra and Sanket Sanjalkar have been working on the code for roughly a year, Wuille said.
Although itâs been shared around behind the scenes, Wuille said he is now posting it to the email list because itâs now itâs reached âa stage where Iâd like to get it some more attention.â
Backing up a bit, âScriptâ is the smart contracting language in bitcoin, which allows users to specify certain conditions need to be met before the bitcoin can be spent. Say, funds are locked up until a certain time before they can be spent. Or, two people need to sign off on a transaction before the money can be moved, a concept called âmulti-sig.â
This programmability is novel when it comes to digital money, since before bitcoin, it wasnât possible to implement such rules without trusting a bank or a similar type of intermediary in the middle.
âMiniscript,â on the other hand, builds on top of this programming language, improving on it in several ways. One is itâs a bit easier to look at and reason about, as Wuille argued with an example that âthat permits A to take the coins at any time, and B after [one] day.â
This are how these rules are implemented in bitcoinâs Script:
Then, the same thing in Minscript:
or_d(c:pk(A),and_v(vc:pk_h(B),older(144)))
Miniscript builds on top of Script, able to âcompileâ to bitcoinâs native language.
The new language is getting applause from developers in the community. Blockstream lightning engineer Rusty Russell, for example, tweeted: âThis will be one of those, âHow the hell did we do it before this?!â technologies. Unsexy and vital.â
There are many potential use cases, such as making it easier to implement such complex scripts in wallet, as Eric Lombrozo tweeted. Or, as bitcoin educator Jimmy Song described, it could even be used for underpinning the lightning network.
Thinking about it in the wider context of blockchain languages, Song commented that the smart contract language differs from ethereumâs Solidity language, because while ethereum makes it possible to write many more types of smart contracts, Miniscript actually reduces the possibilities.
Song argues this is better because it reduces the âcomplexityâ and âattack surface.â
Included in this release are two working implementations, in the programming languages C++ and Rust, which Wuille called a âwork in progress,â adding:
âThrough large scale randomized tests we have confidence that the language design and associated witnesses are compatible with the existing consensus and standardness rules.â
Wuille image via CoinDesk archives