30.10.2023
Bitcoin smart contracts: the next big thing?
Bitcoin's potential for adoption hinges on its scalability. Some initiatives have undertaken the mission of serving as complementary technologies to augment bitcoin's capabilities and address the challenges posed by network expansion.
Bitcoin is known for many things, including being a digital currency, a financial asset, a safe haven, a volatile asset, a decentralized network, and an innovative technology. It is also commonly associated with the terms "crypto" and "blockchain". However, it is less well-known as a smart contract platform. This honor currently resides in ethereum, the second-largest blockchain.
But what if bitcoin could enhance its capabilities to support smart contracts? Could this lead to other blockchains with more intricate and complex architectures becoming obsolete?
Is bitcoin already a smart contract blockchain?
First things first: bitcoin is already capable of deploying smart contracts. Its network enforces the execution of smart contracts without relying on a single central authority. The bitcoin blockchain itself is the arbitrator.
Bitcoin smart contracts are observable, verifiable, and enforceable like any smart contract. However, they lack privacy because all of the terms of a bitcoin smart contract are public for all to see. Additionally, bitcoin smart contracts have limitations in terms of the complexity of contracts that they can enforce trustlessly.
Nonetheless, several initiatives are in progress to construct novel smart contract platforms integrated with the bitcoin blockchain. These platforms aim to empower developers in crafting intricate smart contracts that can be executed securely within the bitcoin network. Enhancing bitcoin's capabilities requires expanding its language.
The simplicity of language.
Austrian philosopher Ludwig Wittgenstein once stated that “the limits of my language are the limits of my world”, underlining the role of language not only as a tool for communication but also as our main source of knowledge. Expanding one's language is what shapes our perception of the world.
Bitcoin's scripting language was created for simple tasks like transaction verification and fundamental scripting functions. As a result, it is less suitable for complex and intricate operations such as developing decentralized applications (dApps). In contrast, a blockchain like ethereum offers more potent scripting languages, empowering developers to build sophisticated and more complex applications. However, these enhanced scripting languages can pose greater challenges in terms of auditing and security due to their increased complexity.
The simplicity of the bitcoin language is one of its strengths, but it also has limitations. Developers have proposed enhancements that can overcome these limitations and improve the functionality of bitcoin without changing the language. At times, bitcoin's scripting language may feel akin to employing a machete when one requires the precision of a scalpel for intricate operations. Below are two attempts to increase the bitcoin network’s programmability, as well as its scalability.
Two ways to enhance bitcoin.
To elevate and, more significantly, enhance bitcoin's capabilities and features, we took a look into two initiatives that have proposed white papers to improve its functionalities without the need for a hard fork. These enhancements encompass bitcoin's ability to deploy smart contracts, embrace NFTs, and enter the DeFi ecosystem, an arena where bitcoin has not ventured thus far.
Stacks, a smart contract platform, has proposed a white paper that aims to bring smart contracts to bitcoin through a sidechain. This sidechain will also support DeFi and NFTs applications.
The BitVM white paper proposes a way to deploy smart contracts on the bitcoin blockchain without requiring a soft fork. This would allow bitcoin to support "any computable function to be verified on bitcoin," according to its creator.
Stacks, a platform to move bitcoin.
Stacks is proposing a new way to use bitcoin that makes it easier to move bitcoin between different layers and use it to enable smart contracts with more complex architecture. It’s something similar to Wrapped Bitcoin (WBTC), a 1:1 peg that can move through ERC-20 network and be used in the ethereum blockchain, and as any other token that moves through it can be used as collateral on DeFi platforms.
A problem of bitcoin's layer solutions is the absence of a decentralized mechanism for users to transfer their BTC in and out of smart contracts within these layers. Stacks proposes a decentralized two-way bitcoin peg system secured by 100% of the base layer security, as well as a decentralized, non-custodial way to move bitcoin in and out of different bitcoin layers. This is called sBTC, pegged to bitcoin 1:1. This means that users can mint sBTC from BTC and burn sBTC to receive BTC.
The minting of sBTC unlocks bitcoin's full potential as a programmable asset. It happens via a novel Proof of Transfer approach (PoX), which is based on paying BTC to “mine” STX, the Stacks token. Stacks emphasizes that offering this native token makes it more trustless than other bitcoin layer 2 propositions such as Liquid, which are federated, i.e. require putting trust in a group of individuals that, if coordinated, could steal the funds. With sBTC, bitcoin can be used in decentralized finance (DeFi) applications and smart contracts on the Stacks platform.
In other words, sBTC is a way to use bitcoin in more ways than just as a store of value or a medium of exchange. For example, sBTC can be used to:
Lend and borrow bitcoin in DeFi applications
Create new financial products and services with smart contracts
Make bitcoin apps more user-friendly and accessible
What would layer 2 DeFi applications on Stacks be built on? The Stacks blockchain is programmable with a smart contract language called Clarity. This language allows for the ecosystem in the layer 2 to develop, and interactions between this layer 2 and the bitcoin network that ultimately secures it happens via a “peg-in peg-out” mechanism of BTC to sBTC and vice versa.
Source: Stacks sBTC whitepaper
BitVM, a bitcoin-based Virtual Machine.
As previously mentioned, bitcoin encounters challenges due to limitations in its scripting language when it comes to deploying sophisticated smart contracts. Script language, being Turing-incomplete, lacks the capability to perform the full spectrum of computations. BitVM, an abbreviation for bitcoin-based Virtual Machine, is designed to provide a solution for executing Turing-complete smart contracts on the bitcoin network without compromising its decentralization and security.
BitVM proposes a framework where computations are implemented off-chain, reducing congestion on the network, and then validating the results on-chain. BitVM involves two parties: a prover and a verifier. The prover claims that a particular function can produce a specific output when given certain inputs. They sign a sequence of transactions in advance, setting up a challenge-response protocol between the two parties.
Source: BitVM whitepaper
A NAND gate is a logic gate that can be obtained by the NOT and AND operators. BitVM’s whitepaper uses it as an example of how such a gate can be expressed in bitcoin’s opcode. By combining these simple gates together, it is possible to create more complex circuits that can perform more sophisticated computations and form sort of a Turing-complete meta language building on the Turing-incomplete bitcoin opcode.
The “advanced smart contract” using this language superimposed on bitcoin opcode is stored off-chain, but a merkle root of the content is stored on-chain. Once the contract is activated by making on-chain deposits to a bitcoin address, the prover and verifier exchange data off-chain. The verifier can claim the prover's deposit if the prover makes any inaccurate claims. This design ensures that attackers are always penalized.
Making bitcoin more programmable and scalable, what for?
Aristotle argued that the ethical inquiry revolves around the question of "what is this for," rather than solely concerning itself with the "what" or the "why". In essence, his insight suggests that the true worth of an action lies not merely in the action itself or its inherent qualities, but primarily in the practical purpose it pursues. As bitcoin explores the possibility of integrating more intricate and advanced smart contracts, a question arises: What is the driving force behind this evolution? Is it primarily a matter of enhancing programmability and scalability, or might these developments potentially deviate from bitcoin's core purpose?
From our perspective, bitcoin encompasses the different roles often attributed to it: a digital currency, a financial asset, a store of value, and even the most revolutionary financial technology of its kind. However, its paramount distinction lies in its decentralization and constrained supply. What truly sets bitcoin apart, rendering it unparalleled and impossible to replicate, is its fundamental virtue: the combination of decentralization and security it affords. We must always review whether these core virtues may be endangered in the pursuit of scalability and programmability.
Bitcoin's potential for adoption hinges on its scalability, but is this the kind of scalability bitcoin needs?
Finally, while limited programmability was part of bitcoin’s original design, Stacks documentation references a quote from Satoshi Nakamoto that shows that these layer 2 protocols may not have been all that unwanted. Satoshi Nakamoto, referring to BitDNS, an early dAPP proposal that would be secured by the bitcoin network:
"I think it would be possible for BitDNS to be a completely separate network and separate block chain, yet share CPU power with Bitcoin… Instead of fragmentation, networks share and augment each other's total CPU power. This would solve the problem that if there are multiple networks, they are a danger to each other if the available CPU power gangs up on one..."