Writing Bitcoin Smart Contracts Is About to Get Easier With New Coding Language

Bitcoin smart contracts are a tricky beast to tame, but a new language is making them easier to write, democratizing them in a sense.

Smart contracts can (among other things) allow users to set extra rules on their bitcoin, requiring these rules be met before the funds can be unlocked. Minsc, created by Bitcoin developer Nadav Ivgi, is a new programming language that makes it easier for developers to create these kinds of contracts so they can build them into bitcoin wallets and other apps more smoothly.

One of the goals of Minsc is to make smart contracts “more accessible to more people,” Ivgi told CoinDesk. That means both developers and users alike are able to take advantage of tools built by developers.

Tier one: ‘Script’ smart contracts

Smart contracts were first described by Nick Szabo in the 1990s. He theorized a way of automating legally binding contracts made between people.

Typical examples of smart contracts on Bitcoin include not allowing 0.1 BTC to be spent until 2021, or requiring more than one person to sign off on a transaction before the money can actually move. Smart contracts also power second layers on the Bitcoin protocol, such as the Lightning Network, which could help Bitcoin expand to reach more users.

Thus far, Bitcoin Script is the language that makes these contracts possible. 

The problem is it’s tricky to work with Bitcoin Script. It is unlike other, more popular programming languages developers are used to, making it harder to wrap their heads around and compose in. This lack of understanding also makes it easier to make a mistake, potentially putting Bitcoin at risk. 

The unwieldiness of Bitcoin Script was one of the factors that led Vitalik Buterin to design the Ethereum platform in the first place. Solidity, Ethereum’s first smart-contract language, was designed to be much easier for developers to read and thus use. And it has paid off: Ethereum has grown to become the go-to platform for smart contract developers.

Read more: How Do Ethereum Smart Contracts Work?

Tier two: Miniscript

Miniscript, released in 2019 by Pieter Wuille, Andrew Poelstra and Sanket Kanjalkar at Blockstream Research, chips away at this issue for bitcoin. 

Read more: Pieter Wuille Unveils ‘Miniscript,’ A New Smart Contract Language for Bitcoin

“One reason that we’re not anywhere close to using Script’s full potential is that actually constructing scripts for nontrivial tasks is cumbersome. It’s hard to verify their correctness and security, and even harder to find the most economical way to write things,” Wuille and Poelstra wrote in a blog post introducing Miniscript in September of last year.

Miniscript offers a language that’s easier to understand than Script, with built-in security guarantees. 

Additionally, if there are two different ways of writing the same contract in Script, Miniscript is able to assess which one is “more economical.”

The computer eventually compiles (or converts) Miniscript to Bitcoin Script, which is what the code ultimately needs to be written in to successfully lock up real bitcoin with these extra restrictions.

Tier three: Minsc

Minsc is the third tier of the cake. It builds on top of Miniscript, taking advantage of its security properties but creating a language that is even easier for developers to read and think about than Miniscript.

“Minsc’s focus is on usability and making it easier to express, comprehend and reason about scripts, using a simple and familiar syntax. It adds additional convenience features and ‘syntactic sugar,’” Ivgi told CoinDesk. 

“Syntactic sugar” is a programming term for adding into a language another easier, shortcut way of executing a task that is usually harder to write.

So Minsc doesn’t add anything new to Script, it just makes it easier to use.

“It doesn’t let you do anything that Miniscript doesn’t already, similarly to Miniscript itself in relation to Bitcoin Script,” Ivgi said.

Bitcoin smart contracts and Minsc: Where will they go next?

Minsc could make it easier for developers to add support for various smart contracts. “The main intended target audience is developers looking to build apps that utilize Bitcoin Script in interesting, advanced ways,” Ivgi added.

Read more: RIF Launches ‘Layer 3’ Network to Scale Bitcoin-Based Smart Contracts, Tokens

If more developers can eventually add support for these smart contracts, more users will (perhaps even unknowingly) be able to use these more-complex contracts as well.

“Initially, however, I anticipate the usage to be primarily experimental and educational. Minsc can be a great tool for people looking to gain a better understanding of Bitcoin Script, as well as for educators teaching the technical aspects of Bitcoin,” Ivgi said.

Ivgi is still in the process of adding other features to the language. Bitcoin’s smart contracting abilities are likely to expand even further, such as with Taproot, a likely upgrade on Bitcoin’s horizon. Minsc will be there to make these contracts easier to create.

Disclosure

The leader in blockchain news, CoinDesk is a media outlet that strives for the highest journalistic standards and abides by a strict set of editorial policies. CoinDesk is an independent operating subsidiary of Digital Currency Group, which invests in cryptocurrencies and blockchain startups.

Original

Spread the love

Related posts

Leave a Comment