This New Programming Language Could Unlock Bitcoin’s Smart Contract Potential
This New Programming Language Could Unleash Bitcoin’s Smart Contract Potential
Bitcoin Core contributor Jeremy Rubin has presented his work on a new smart-contract language for Bitcoin (BTC), which he hopes will enhance the “financial self-sovereignty” of users.
Rubin demonstrated the new language, Sapio, on July 11 at a RecklessVR meetup presentation in virtual reality, with many audience members joining the talk in VR headsets. He plans to release the programming language as a part of his new research organization, Judica.
Stateful smart contracts allow users to lock up money so funds can’t be spent until certain conditions are met or a series of interactive steps have been taken. These contracts are most commonly associated with the Ethereum (ETH) blockchain, which is very flexible, making stateful smart contracts easy to write.
It’s lesser known that Bitcoin also supports a range of more complex smart contracts, such as requiring more than just one person to sign off a transaction before it can be spent. But compared to Ethereum, Bitcoin smart contracts are much more complicated and unwieldy to create, or they are stateless, which means that the conditions are met either all at once or not at all. This way, there have been fewer options for creating smart contracts on Bitcoin.
Rubin hopes to further expand the smart contract use cases for Bitcoin to give users even more control over their funds.
New possibilities for Bitcoin smart contracts
Sapio could work for Bitcoin smart contracts today. But most of the types of smart contracts Rubin envisions can’t be created on Bitcoin yet.
He built Sapio specifically on CHECKTEMPLATEVERIFY (CTV), a change that, if adopted, could introduce more smart contract features to Bitcoin network, namely letting users secure their Bitcoin in new ways.
In his presentation, Rubin said that CTV is a “a simple covenanting system for Bitcoin.” The idea of covenants, which has been around for a long time, is about adding security measures, such as adding extra rules to a batch of Bitcoin, preventing the owner of the BTC from sending to all but a few addresses.
“In practice, it means it allows you to do some more complex smart contracting [determining] how Bitcoin can be spent when a coin is created,” Rubin said.
One use case for covenants is Bitcoin “vaults.” Usually when a private key is taken, a malicious actor can escape with the associated coins. But locking up your funds in such a vault adds restrictions on the movement of Bitcoin in the case of a mistake or another security issue.
“I think vaults are one of the most important use cases that CTV is going to bring to the table. They bring an immense amount of financial sovereignty tools to a wide audience,” Rubin stated, adding that this technology gives users the opportunity to do this by themselves without a third-party service provider.
Vaults are now available for Bitcoin, but could be much easier to create with CTV, Rubin stated.
While Rubin is most excited about vaults, CTV opens up several other use cases, such as congestion control. CTV could help Bitcoin users wait out high fees for a time where the blockchain has less transaction traffic, and, as such, lower fees.
Now that Rubin has built Sapio, a smart contract language specifically for CTV, these use cases will become easier for developers to program and thus, easier for everyday users to implement.
Bitcoin as a “judiciary”
Rubin’s newly born research organization Judica will work with this bundle of technologies. It is going to release tools it hopes will “massively expand the Bitcoin economy.”
The word “Judica” is Latin for “judgment”: Rubin considers Bitcoin a judiciary, and he wants to push it to grow in this role.
“If you look at the relationship between the market and the government, usually free-market absolutists will say that the government merely is an interfering agent and will go away. But if you take a closer look, the functionality of the courts is actually critical to the development of the economy. Without reliable courts or some judicial system (private arbitration counts, too), transacting with relative strangers is far too risky which severely limits economic activity.” Bitcoin comes in and makes this all easier. “The ability to enforce contacts through a legal system (rather than through personal force) enables an economy to flourish,” Rubin said.
But he argues that Bitcoin is too limited in what it can do today:
“The Bitcoin blockchain serves the role as a judiciary, but right now the types of contracts it can resolve is fairly limited and it’s difficult to develop more advanced contracts.”
As a part of Judica, Rubin is going to release Sapio “along with designs for a myriad of smart contracts” implemented in the smart contract language. As Judica is still in its early stages, Rubin said he’s looking for grants, funds and fellow team members to join in.
Shipping CTV and Sapio
But it’s yet to be determined when (and if) CTV will be deployed, Rubin explained in his talk. It’s a bigger Bitcoin change, so it might take time before the opcode is usable.
“I don’t know exactly when it’s going to happen. I’d like to see it sooner rather than later,” Rubin said.
Because Bitcoin is decentralized, there is no central authority to make decisions. As such, developers don’t always agree about the way forward. Rubin said:
“If you ask each developer when [CTV will be deployed], you’ll get a very different answer. There are a reasonable amount of people who say it’s three years from now – at least.”
Rubin has been championing CTV, which, if successfully activated, would bring these features to Bitcoin. Most changes to Bitcoin — large or small — are implementation details or local policies. However, since CTV alters a global consensus rule, it would be delivered via a “soft fork,” even though the actual code changes needed for CTV are small. This way, it would need enough network participants to support it in order to activate smoothly. So, Rubin isn’t sure when the change takes place.
Many Bitcoin developers are more cautious, only agreeing to changes that have been vetted to a certain degree.
But Rubin believes that a timeline of three years is far too lengthy. He called this timeline “sad” and said, “It’s hard for me to make the case that this is important stuff to work on if it’s not really usable until at least three years from now.”
“Some people are, like, ‘Ship it and see if we can get it in in six months.’ I fall more in that camp,” he said, suggesting that changes should be implemented quickly while Bitcoin is still young and is more malleable. “I argue that Bitcoin is so early and experimental that we need to be pushing really quickly. Other people feel that Bitcoin is more ossified and needs to move really slowly.”
And he went on to say, “We need a lot of new [features], so that when we say ‘Bitcoin fixes this,’ it actually means what we think it does.”