This New Coding Language Could Help Unlock Bitcoin’s Smart Contract Potential


    Bitcoin Core contributor Jeremy Rubin has revealed his work on a new smart-contract language for Bitcoin, which he hopes will increase the “financial self-sovereignty” of users.

    Rubin demoed the new language, Sapio, on Saturday 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 blockchain, which is very flexible, making stateful smart contracts easy to write.

    Read more: How Do Ethereum Smart Contracts Work?

    It’s lesser-known though that Bitcoin also supports several different types of more complex smart contracts, such as requiring more than just one person to sign off on 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 – that is, the conditions are met either all at once or not at all. Thus far, this has meant that there have been fewer options for developing smart contracts on Bitcoin.

    Rubin hopes to further expand the smart contract use cases for Bitcoin to give users even more control over what they can do with their money. 

    New possibilities for Bitcoin smart contracts

    Sapio could work for Bitcoin smart contracts today. But most of the types of smart contracts Rubin envisions aren’t available on Bitcoin yet.

    He built Sapio specifically around CHECKTEMPLATEVERIFY (CTV), a change that, if adopted, could bring more smart contract features to the Bitcoin network, namely allowing users to secure their bitcoin in new ways.

    In his talk, Rubin described CTV as a “a simple covenanting system for bitcoin.” The idea of covenants, which has been around for a long time, is to add security measures, such as baking in extra rules to a batch of bitcoin, preventing the owner of the bitcoin 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 once a private key is taken, a malicious actor can scurry away 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 said, adding that this technology opens up the opportunity for users to do this by themselves without a third-party service provider.

    Read more: The ‘Great Lockdown’ Is Boosting Demand for Bitcoin Custody Solutions

    Vaults are currently possible in bitcoin, but could be much easier to create with CTV, Rubin argued.

    While Rubin is most excited about vaults, CTV opens up a variety of 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 created 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 focus on this bundle of technologies. It plans to release tools it hopes will “massively expand the Bitcoin economy,” Rubin told CoinDesk in an email. 

    The word “Judica” is Latin for “judgment”: Rubin sees Bitcoin as 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,” he said.

    But he argues 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,” Rubin added.

    As a part of Judica, Rubin plans 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 unclear 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. 

    “If you ask each developer when [CTV will be deployed], you’ll get a very different answer,” Rubin said in his lecture. “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 add these abilities to Bitcoin. Most changes to Bitcoin – large or small – are implementation details or local policies. However, because CTV changes a global consensus rule, it would be delivered via a “soft fork,” even though the actual code changes required for CTV are small. As such, it would require enough network participants to support it in order to activate smoothly. So, Rubin isn’t sure when the change will become available.

    Read more: Hard Fork vs Soft Fork

    Many bitcoin developers are more cautious, only giving their blessings to changes that have been vetted to a certain degree. 

    But, in Rubin’s opinion, 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 made quickly while Bitcoin is still in its early stages 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.”

    Rubin thinks that this sort of change is important to Bitcoin’s future. 

    As he said in his presentation, “We need a lot of new [features], so that when we say ‘Bitcoin fixes this,’ it actually means what we think it does.”


    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.