Author: Echo | Infinitas; Leo | LK Venture
Guidance: Hong Shuning
This article is jointly produced by Infinitas and LK Venture
Introduction
While most people associate Bitcoin with money, it has another lesser-known important use case—smart contracts. Smart contracts are the foundation of Bitcoin and were first proposed by Nick Szabo in 1995. It is a computer protocol designed to facilitate, verify, or enforce the negotiation or performance of a contract, essentially being a contract rather than code. Smart contracts allow for trusted transactions without the need for a third party, enabling automatic trust and execution of agreements without the assistance of a central authority, thus providing a more secure and convenient way to execute contracts than traditional contracts.
Before delving into the potential role of Bitcoin's RGB protocol in smart contracts, it is worth mentioning that the concept of smart contracts itself is controversial. Ethereum's co-founder Vitalik Buterin expressed regret in 2018 for using the term "smart contract" to describe Ethereum's core functionality. Buterin believed that a more technical and mundane name, such as "persistent script," should have been chosen to more accurately reflect its nature as a continuously executing program. This reflects the differing viewpoints on how to define and understand smart contracts even among pioneers in the blockchain field.
In this article, we will uncover the world of Bitcoin smart contracts and discuss how they have evolved into a vast ecosystem built on the network.
What limits the development of smart contracts?
The concept of the blockchain trilemma was proposed by Ethereum's founder Vitalik Buterin, referring to the inability to simultaneously achieve decentralization, security, and scalability on the blockchain. Smart contracts also face a similar trilemma: decentralization, scalability, and Turing completeness. While Bitcoin and Ethereum share many similarities, they have become two distinct blockchain networks due to long-term differences in vision and limitations.
Comparison of Bitcoin and Ethereum
Ethereum has long struggled with scalability. Its low throughput and slow processing speed are due to prioritizing decentralization and security over scalability (the scalability trilemma). Because of Ethereum's scalability bottleneck, even with its Turing completeness, it is still difficult to be considered the ultimate form of smart contracts.
How does Bitcoin overcome the scalability challenge of smart contracts?
Scalability on the Bitcoin blockchain has been a long-standing challenge. To implement smart contract solutions on Bitcoin, they can either be created on the Bitcoin main chain or on Bitcoin's layer-two solutions. Layer-two scalability solutions on the Bitcoin blockchain, such as the RGB protocol, have emerged in recent years, enabling rapid iteration of Bitcoin's smart contract functionality and addressing the scalability limitations of the trilemma.
Blockchain trilemma
Smart Contracts on the Bitcoin Main Chain
Bitcoin's script language, Script, is too simple, making it difficult to deploy complex smart contracts at the base layer. Since its inception, Bitcoin has been designed to be simple and relatively unmodifiable to ensure the integrity and persistence of the blockchain. While protocol upgrades occur regularly, they do not entail a fundamental change to the blockchain, but rather provide marginal improvements.
The underlying layer of Bitcoin still possesses many fundamental smart contract functionalities.
- Pay-to-Public-Key-Hash (P2PKH)
Pay-to-Public-Key-Hash is a common contract used for Bitcoin transactions, where the script creates a contract executed by a public key and signed by the corresponding private key.
- Multisig
Multisig is a type of Bitcoin address that requires multiple parties to approve a transaction, commonly used for executing agreements among parties where a predefined number of signatures must be collected to release funds or perform other operations.
- Hash Time-Locked Contracts (HTLC)
HTLC is a conditional Bitcoin transaction with a time limit for unexpected circumstances. These time limits are hardcoded, and BTC is only released at specific times and dates (or blocks). If certain requirements in the contract are not met before a preset deadline, the transaction is canceled.
- Discreet Log Contracts (DLC)
DLC utilizes oracles to execute trustless peer-to-peer transactions. These oracles can assess the outcome of real-world events and provide on-chain information for Bitcoin smart contracts. DLC is most commonly used when two parties commit to a monetary agreement based on future outcomes.
- Pay-to-Taproot (P2TR)
Pay-to-Taproot is a script for sending Bitcoin that introduces Merkle trees and Schnorr signatures. These transactions offer improved security, lower transaction fees, and greater flexibility. This form of contract has been implemented recently due to the Taproot upgrade.
Advantages of Layered Execution of Bitcoin Smart Contracts
The uniqueness of Bitcoin's layers lies in their ability to introduce new features to the network without modifying the main chain. By introducing innovations and other experimental developments without altering the Bitcoin code, the core of Bitcoin can remain simple and unaffected by what is built on top of it.
All Bitcoin layer transactions ultimately settle on the Bitcoin base layer, meaning the history of each transaction is written into Bitcoin's ledger. The level of verification is what sets blockchain apart from any other network, as changing layer transactions requires changing base layer transactions.
Layered execution of Bitcoin smart contracts offers several key advantages.
- Enhanced programmability: Layered smart contracts overcome the limited functionality of Bitcoin's script language by accessing their own global state, expanding the possibilities of building on top of Bitcoin.
- Improved scalability: Deploying smart contracts on scalable solutions means transaction processing speed can be significantly increased. Currently, the base layer can only process about 5-7 transactions per second. Layered solutions can bundle transactions before sending them for final settlement on the main chain, greatly increasing Bitcoin's throughput and the feasibility of it being a scalable network with millions of daily transactions.
- Increased efficiency: Improved scalability, faster transactions, and lower costs go hand in hand. Shorter block times can speed up confirmation, and transaction costs for layered transactions are significantly lower compared to the base layer. Additionally, layered transactions reduce the chaos occurring at the base layer and improve the overall network performance.
In contrast to the Bitcoin ecosystem, after completing Segregated Witness, it has fully focused on developing Layer2 solutions such as the Lightning Network and sidechains. The complexity of Bitcoin Layer1 scaling solutions is more accepted to be based on building new Layer2 solutions on Bitcoin Layer1, which is both compatible and does not affect the Bitcoin system, while solving on-chain congestion. Thus, the imaginative space for Bitcoin smart contracts falls on Turing completeness.
Why might the RGB protocol be the ultimate form of smart contracts?
As a form of Bitcoin layer-two solutions, the RGB protocol has erupted with enormous potential to realize future large-scale applications in the field of smart contracts. In Bitcoin layer-two solutions, the RGB protocol and BitVM are the only two that can achieve a balance of "scalability," "Turing completeness," and "decentralization."
RGB is an open-source protocol based on the Bitcoin protocol and leverages the Lightning Network (LN) to execute smart contracts. RGB is a protocol built on top of the Bitcoin blockchain's proof-of-work (PoW) consensus layer. It utilizes the Lightning Network without the need for modifications to the protocol, and allows for the issuance and management of programmable assets and private assets. RGB addresses scalability issues by executing private smart contracts between two parties (e.g., LN channels). Its development aims to improve colored coins and tokenize digital assets on the Bitcoin blockchain.
Client-side Validation
One of the core features of RGB is client-side validation, a concept proposed by Peter Todd. Client-side validation is supported by the RGB schema, which is the way users create smart contract protocols among parties. This validation method leverages the strength and security of the Bitcoin blockchain's consensus mechanism while taking the smart contract code and data off-chain with RGB. Due to Bitcoin's limited support for smart contract execution environments, RGB brings execution and validation off-chain, and RGB transactions are not included in Bitcoin or Lightning transactions, allowing participants to benefit from the security of the Bitcoin consensus layer while increasing flexibility and scalability.
In addition to off-chain storage of transaction data, RGB transactions are also assigned to UTXO sets using disposable seals to close Bitcoin transaction outputs as an additional security measure. Seals prevent different versions of the same data from being provided by different parties. Therefore, they allow conditional parties to verify the history of smart contract states.
RGB Smart Contracts, Architecture, and Validation
RGB smart contracts consist of operations that update the state, owners, and participants. The Schema of RGB defines validation rules for each state at the genesis level, ensuring that each consecutive state owner uses the same Schema to validate the history. Therefore, the schema guarantees social consensus, validation, and smart contract states.
The core validation logic uses Rust, a deterministic smart contract language equivalent to a Turing machine. All contract-specific validation logic runs on the Alluvium Virtual Machine (AluVM)—a highly deterministic and exception-free VM—to provide a platform-independent instruction set.
Other Bitcoin smart contracts that can achieve Turing completeness:
- BitVM: Released in the whitepaper in October 2023, BitVM executes complex programs off-chain using a similar approach to Rollups, then puts critical evidence on-chain. It also aims to bring Turing-complete smart contracts to Bitcoin, but BitVM has extremely high requirements for computational power and is only theoretically executable. Further understanding is needed for its scalability and commercial implementation.
Overcoming the "impossible trilemma" of smart contracts with RGB and BitVM
Conclusion
Bitcoin is decentralized "digital gold" and also a platform for executing smart contracts. Currently, a large amount of Bitcoin is idle, with approximately 76% of the Bitcoin supply lacking liquidity and no transaction history. Through the expansion of smart contracts, there is an opportunity to elevate the productivity of Bitcoin to new levels. With protocols in the Bitcoin ecosystem, such as the RGB protocol, that integrate Turing-complete smart contract functionality, developers can program more smart contracts into the network, accelerating Bitcoin's mainstream adoption as a store of value and financial services layer.
As a highly decentralized, secure, and persistent blockchain, Bitcoin has the potential to serve as the foundation for more on-chain economic activities in the future. It is believed that Bitcoin may soon become the top ecosystem for smart contracts, decentralized applications, and Web3 infrastructure. In this ever-changing field, the role and capabilities of Bitcoin may exceed our current imagination, just as our understanding of the meaning of "smart contracts" continues to evolve and deepen.
References
https://coinexsmartchain.medium.com/innovative-csc-to-challenge-an-impossible-trinity-in-blockchain-technology-9ff86aa0192e
https://bitcoinist.com/vitalik-buterin-ethereum-regret-smart-contracts/
https://zhuanlan.zhihu.com/p/264882173
https://www.plus500.com/zh/instruments/ethusd/what-is-the-difference-between-ethereum-and-bitcoin~2
免责声明:本文章仅代表作者个人观点,不代表本平台的立场和观点。本文章仅供信息分享,不构成对任何人的任何投资建议。用户与作者之间的任何争议,与本平台无关。如网页中刊载的文章或图片涉及侵权,请提供相关的权利证明和身份证明发送邮件到support@aicoin.com,本平台相关工作人员将会进行核查。