Is the Bitcoin RGB protocol the ultimate form of smart contracts?

Recommended Reading
2023-12-15 17:00:00
Collection
We will unveil the world of Bitcoin smart contracts and discuss how they have evolved into a vast ecosystem built on the network.

Authors: 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 important use case that is less known—smart contracts. Smart contracts are the foundation of Bitcoin, first proposed by Nick Szabo in 1995. They are computer protocols designed to execute, verify, or enforce the negotiation or performance of a contract, essentially contracts rather than code. Smart contracts allow for trustworthy transactions without third parties, 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 compared to traditional contracts.

Before exploring the RGB protocol of Bitcoin and its potential role in smart contracts, it is worth mentioning that the concept of smart contracts itself is somewhat controversial. Ethereum co-founder Vitalik Buterin expressed regret in 2018 about using the term "smart contracts" to describe Ethereum's core functionality. Buterin believes a more technical and mundane name, such as "persistent scripts," should have been chosen to more accurately reflect its nature as a continuously executing program. This reflects the differing views on how to define and understand smart contracts, even among pioneers in the blockchain field.

In this article, we will unveil 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 founder Vitalik Buterin, which states that it is impossible to achieve the following three goals simultaneously on a blockchain: decentralization, security, and scalability. Smart contracts also face an impossible trinity: decentralization, scalability, and Turing completeness. Bitcoin and Ethereum share many similarities, but due to long-term vision differences and limitations, they have become two distinct blockchain networks.

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 the bottlenecks in scalability, even though Ethereum has Turing completeness, it is still difficult to call it the ultimate form of smart contracts.

How Does Bitcoin Overcome the Scalability Challenge of Smart Contracts?

On-chain scalability for Bitcoin has been a long-standing challenge. To implement smart contract solutions on Bitcoin, they must either be created on the Bitcoin main chain or on Bitcoin's layer solutions. Recent layer solutions for Bitcoin's on-chain scalability, such as the RGB protocol, have enabled rapid iteration of Bitcoin's smart contract functionality, addressing the scalability limitations of the impossible trinity.

Blockchain Impossible Triangle

Smart Contracts on the Bitcoin Main Chain

Bitcoin's scripting 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 permanence of the blockchain. While protocol upgrades occur periodically, they do not signify a complete overhaul of the blockchain but rather provide minor improvements at the margins.

The underlying 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 before it can be completed, commonly used to execute agreements between parties where a predefined number of signatures must be collected to release funds or perform certain other actions.

  • Hash Time-Locked Contracts (HTLC)

Hash Time-Locked Contracts are conditional Bitcoin transactions with time-limited contingencies. These time limits are hardcoded, and BTC is only released at a specific time and date (or block). If certain conditions in the contract are not met before the preset deadline, the transaction will be canceled.

  • Discrete Log Contracts (DLC)

DLC utilizes oracles to execute trustless peer-to-peer transactions. These oracles can assess the outcomes 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 used to send Bitcoin that introduces Merkle trees and Schnorr signatures. These transactions offer better security, lower transaction fees, and greater flexibility. This form of contract was recently implemented due to the Taproot upgrade.

Advantages of Layered Execution of Bitcoin Smart Contracts

The uniqueness of Bitcoin layers lies in their ability to introduce new functionalities to the network without modifying the main chain. Innovations and other experimental developments can be introduced without changing the Bitcoin code, allowing the core of Bitcoin to 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 will be recorded in Bitcoin's ledger. The degree of verification distinguishes blockchain from any other network; to change a Bitcoin layer transaction, one must change the main chain transaction.

Layered execution of Bitcoin smart contracts has several key advantages.

  • Greater Programmability: Layered smart contracts overcome the limited functionality of Bitcoin's scripting language by accessing their own global state, allowing layers to broaden the possibilities of building content on Bitcoin.
  • Higher Scalability: Deploying smart contracts on scalable solutions means that transaction processing speeds can be significantly increased. Currently, the base layer can only handle about 5-7 transactions per second. Layered solutions can bundle transactions before sending them to the main chain for final settlement. This greatly enhances Bitcoin's throughput and its viability as a scalable network with millions of daily transactions.
  • Improved Efficiency: Enhanced scalability goes hand in hand with faster transactions and lower costs. Shorter block times can accelerate confirmation speeds, while the transaction costs of layered transactions are significantly lower compared to the main chain. Additionally, layered transactions reduce the congestion occurring at the base layer and improve the overall performance of the network.

In contrast, the Bitcoin ecosystem has been fully focused on developing towards Layer 2 solutions such as the Lightning Network and sidechains after completing Segregated Witness. The complexity of Layer 1 scaling solutions for Bitcoin is high, and what is more accepted by the community is building new Layer 2 solutions based on Bitcoin Layer 1, which are compatible and do not affect the Bitcoin system while addressing on-chain congestion issues. Thus, the imaginative space for Bitcoin smart contracts falls on Turing completeness.

Why RGB Protocol May Be the Ultimate Form of Smart Contracts?

As a form of Bitcoin's layered solution, the RGB protocol has immense potential for achieving large-scale applications in the field of smart contracts. Among Bitcoin's layered solutions, RGB 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 Bitcoin's protocol, utilizing the Lightning Network (LN) to execute smart contracts. RGB is a protocol built on top of Bitcoin's proof-of-work (PoW) consensus layer. It leverages the Lightning Network without requiring modifications to the protocol while allowing RGB to issue and manage programmable 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 functionalities of RGB is client-side validation, a concept proposed by Peter Todd. Client-side validation is supported by the RGB model, which is the way users create smart contract protocols between parties. This validation method leverages the strength and security of the Bitcoin blockchain's consensus mechanism while taking the RGB smart contract code and data off the blockchain. Due to Bitcoin's limited capability to support smart contract execution environments, RGB brings execution and validation off-chain, while RGB transactions are not included in Bitcoin or Lightning transactions, allowing participants to benefit from the security of Bitcoin's consensus layer while enhancing flexibility and scalability.

In addition to off-chain storage of transaction data, RGB transactions are also assigned to UTXO sets using one-time seals to close Bitcoin transaction outputs as another security measure. Seals prevent two different parties from providing different versions of the same data. Therefore, they allow qualified parties to verify the historical state of the smart contract.

RGB Smart Contracts, Architecture, and Validation

RGB smart contracts consist of states, owners, and operations that participants can execute to update the state. The RGB schema defines the validation rules for each state at the genesis level, ensuring that each successive state owner uses the same schema to verify the history. Thus, the model guarantees social consensus, validation, and the state of smart contracts.

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, Algorithm & Logical Unit Virtual Machine), which is a highly deterministic and exception-free VM that provides a platform-independent instruction set.

Other Bitcoin smart contracts that can achieve Turing completeness:

  • BitVM: Released in October 2023, BitVM adopts a Rollups-like approach to execute complex programs off-chain and then place critical evidence on-chain. It also aims to bring Turing-complete smart contracts to Bitcoin, but BitVM has extremely high requirements for computational power, with only theoretical executability. Scalability and commercial viability need further exploration.

RGB and BitVM Overcoming the "Impossible Triangle" of Smart Contracts

Conclusion

Bitcoin is a decentralized "digital gold," and it is also a platform for executing smart contracts. Currently, a large amount of Bitcoin remains idle. Approximately 76% of the Bitcoin supply lacks liquidity and has no trading history. Through the expansion of smart contracts, there is an opportunity to elevate Bitcoin's productivity to new levels. With Bitcoin ecosystem protocols like the RGB protocol that integrate Turing-complete smart contract functionalities, developers can program more smart contracts into the network, thereby accelerating Bitcoin's mainstream adoption as a store of value and a layer for financial services.

As a highly decentralized, secure, and durable blockchain, Bitcoin can 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-evolving field, Bitcoin's role and capabilities may exceed our current imagination, just as our understanding of the term "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

ChainCatcher reminds readers to view blockchain rationally, enhance risk awareness, and be cautious of various virtual token issuances and speculations. All content on this site is solely market information or related party opinions, and does not constitute any form of investment advice. If you find sensitive information in the content, please click "Report", and we will handle it promptly.
ChainCatcher Building the Web3 world with innovators