Author: Jerry Luo
Reviewers: Mandy, Joshua
TLDR:
There are multiple smart contract solutions on the current Bitcoin network, among which the most mainstream are the Ordinals protocol and the RGB protocol.
- The emergence of the Ordinals protocol enables smart contract development on the Bitcoin network and binds its security with the Bitcoin blockchain. However, the confirmation and recording of Ordinals asset transfers are carried out on the Bitcoin mainnet, tied to a transfer of 1 sat. This results in high transaction fees and further congests the low TPS Bitcoin mainnet.
- In the RGB protocol, off-chain channels and batch transaction packaging methods are proposed, significantly reducing the transaction fees for asset transfers in RGB and improving speed. Additionally, the client-side validation method greatly reduces the amount of data required to maintain normal network operation, thereby improving network scalability.
- Although the RGB protocol has improved transaction speed and scalability through the above methods, it has also brought many new issues. Off-chain channels optimize transaction costs and speed but bring security issues with off-chain records. Client-side validation reduces the amount of recorded data but significantly slows down the verification speed.
This article compares the Ordinals and RGB protocols from the dimensions of security, scalability, transaction fees, transaction speed, and analyzes the possible future development of RGB.
Market Overview
Currently, BTC accounts for about 49% of the total market value of the cryptocurrency market. However, due to its non-Turing complete scripting language, the lack of mainnet smart contracts, and slow transaction speed, its long-term development is severely hindered. In order to address the above issues, Bitcoin developers have made a lot of attempts in terms of capacity expansion and speed improvement, mainly focusing on the following 4 solutions:
- RGB Protocol: RGB is a second-layer protocol built on the Bitcoin network, with its core transaction data stored on the BTC mainnet. RGB utilizes the security model of Bitcoin to support the creation of tokens with customized properties and smart contract functionality on the Bitcoin network. In 2016, the RGB protocol was initially proposed by Peter Todd; in 2023, during the hot development of smart contract ecology on Bitcoin, the RGB protocol received attention again.
- Segregated Witness: In August 2017, Bitcoin implemented the Segregated Witness (SegWit) upgrade. By separating transaction information from signature information, the effective block size was increased from 1M to 4M, alleviating congestion to a certain extent. However, due to the limitation of the Bitcoin block size itself, we cannot infinitely expand the storage information of a block. Therefore, the method of expanding block storage information to improve efficiency has reached its limit.
- Lightning Network: The Lightning Network is a second-layer scaling solution based on Bitcoin, allowing transactions to be conducted without accessing the blockchain, greatly increasing throughput. The Lightning Network has been implemented on the Bitcoin mainnet, and existing Lightning Network solutions include OmniBOLT, Stacks, etc., but the Lightning Network faces significant centralization risks.
- Sidechain Technology: Sidechain technology builds a sidechain outside the Bitcoin network, and the assets on the sidechain are anchored to BTC at a 1:1 ratio. The sidechain has significantly improved transaction performance compared to the mainnet, but it can never achieve the security of the BTC mainnet.
Since March of this year, the transaction fees on the Bitcoin network and the transaction volume of BRC20 protocol assets have experienced a sharp increase. In early May, BTC mainnet transaction fees reached their peak, and although transaction fees have since declined, the transaction volume of BRC20 assets has remained at a high level. This indicates that the development heat of the smart contract ecology on the Bitcoin network has not declined with the decline in the heat of the BTC ecology, and developers continue to seek the optimal solution for smart contract development on the Bitcoin network.
Ordinals Protocol
Satoshi Numbering
The Satoshi on the Bitcoin network is different from the wei on Ethereum in that it is calculated through the UTXO owned by each address. To differentiate between different sats, it is necessary to first distinguish between different UTXOs, and then differentiate between sats under the same UTXO. The former is relatively simple, as different UTXOs are recorded from the time they are mined, and each UTXO corresponds to a unique block on the Bitcoin network, and different block heights can be used to distinguish between different UTXOs.
- Differentiation of different UTXOs: BTC Builder records from the time the UTXO is mined, and each UTXO corresponds to a unique block on the Bitcoin network, with each block having a unique block height, which can be used to differentiate between different UTXOs.
- Differentiation of sats under the same UTXO: First, the block height can be used to determine the approximate range of sats under the UTXO. For example, the earliest block can mine 100 BTC, which is $$10^{10}$$ sats, so the sats numbering in the block with a height of 0 is [0, $$10^{10}$$-1], the sats numbering in the block with a height of 1 is [$$10^{10}$$, $$2*10^{10}$$-1], and the sats numbering in the block with a height of 2 is [$$2*10^{10}$$, $$3*10^{10}$$-1], and so on. If a specific sats under this UTXO needs to be specifically distinguished, it must be done through the spending process of the UTXO. The Ordinals protocol proposes a new solution, which is to number the sats based on the first-in-first-out principle.
Ordinals Inscription
Initially, the Bitcoin network provided a 80-byte storage space for each transaction by adding the OP_RETURN opcode. However, the 80-byte area cannot meet the needs of writing complex code logic, and writing data to the blockchain will increase transaction costs and the possibility of network congestion. To address this issue, the Bitcoin network has successively undergone two soft forks, SegWit and Taproot. Through a Tapscript script that starts with the OP_FALSE opcode and will not be executed, the Bitcoin transaction process provides a 4M space. In this area, ordinals inscriptions can be written to achieve on-chain text, image, or BRC20 protocol token issuance, etc.
Shortcomings of Ordinals
Ordinals greatly enhance the programmability of the Bitcoin network, breaking the limitations imposed on the narrative and development of the BTC ecosystem, and providing functions beyond transactions for the Bitcoin network. However, many issues with Ordinals are still criticized by BTC ecosystem developers.
- Centralization of Ordinals: Although the recording and modification of states in the Ordinals protocol are carried out on-chain, the security of the Ordinals protocol itself cannot be equated with the Bitcoin network. Ordinals cannot prevent the duplication of inscriptions on-chain, and the identification of invalid inscriptions needs to be done by the off-chain Ordinals protocol. This emerging protocol has not undergone long-term testing and has many potential issues. Additionally, if the underlying services of the Ordinals protocol encounter problems, it may also lead to the loss of user assets.
- Limitations of Transaction Fees and Transaction Speed: Because the inscription is carved through segregated validation areas, meaning that completing an Ordinals asset transfer requires corresponding UTXO spending. Due to the 10-minute block generation speed of the Bitcoin network, the transaction process cannot be accelerated. Additionally, on-chain inscriptions will also increase transaction costs.
- Damage to Bitcoin's Original Properties: Since the assets on Ordinals are tied to the valuable sats of the Bitcoin network, the use of Ordinals itself will cause the alienation of Bitcoin's original assets, while on-chain inscriptions will also lead to a sharp increase in mining fees. Many BTC supporters are concerned that this will damage Bitcoin's original payment function.
RGB Protocol
In the case of a surge in network transaction volume, the shortcomings of the Ordinals protocol are highlighted. In the long run, if this issue is not properly addressed, the smart contract ecology of Bitcoin will be difficult to compete with the Turing-complete public chain ecology. Among the many alternative solutions to Ordinals, many developers have chosen the RGB protocol, which has made significant breakthroughs in scalability, transaction speed, and privacy compared to Ordinals. Ideally, assets built on the Bitcoin ecology based on the RGB protocol can achieve a level of transaction speed and scalability similar to assets on Turing-complete public chains.
RGB Core Technology
Client Verification
Unlike the broadcast of transaction data on the Bitcoin mainnet, the RGB protocol places this process off-chain, with information only transmitted between the sender and receiver. After the receiver verifies the transaction, there is no need to synchronize with all nodes on the network, recording all transaction data. The receiving node only needs to record the data related to the transaction and meet the requirements for on-chain verification, greatly improving the network's scalability and privacy.
One-time Seal
In the actual material exchange process, materials often change hands multiple times, posing a significant threat to the authenticity and integrity of the materials. In real life, to prevent malicious tampering of materials before submission for verification, people use the method of adding seals to judge whether the contents inside have been tampered with based on the integrity of the seal. The role of a one-time seal in the RGB network is similar, specifically, the naturally one-time electronic seal in the Bitcoin network - UTXO.
Similar to smart contracts on Ethereum, the issuance of tokens under the RGB protocol also requires specifying the name and total supply of the tokens. The difference is that there is no specific public chain as a carrier in the RGB network, and each token in RGB must correspond to a specific UTXO on the Bitcoin network. If someone owns a specific UTXO on the Bitcoin network, they also own the RGB token corresponding to that UTXO recorded in the RGB protocol. To transfer RGB tokens, the holder needs to spend the UTXO. Once spent, the UTXO is gone, which corresponds to spending the RGB asset in the Ordinals protocol. This spending of the UTXO is the process of breaking the one-time seal.
UTXO Blinding
In the Bitcoin network, each transfer can be traced back to the input UTXO and output UTXO. This increases the efficiency of UTXO tracing on the Bitcoin network and effectively prevents double spending attacks. However, due to the completely transparent nature of the transaction process, the privacy of both parties is not considered. To enhance transaction privacy, the RGB protocol proposes the concept of blinding UTXO.
In the process of transferring RGB tokens, the sender A cannot obtain the specific address of the receiving UTXO, but only receives a result of the hash of the receiving UTXO address concatenated with a random password value. When the receiver B wants to use the received RGB protocol token, they need to inform the receiver C of the address corresponding to their UTXO and send the corresponding password value to the receiver C to verify that A did indeed send the RGB protocol token to B. This process enhances transaction privacy by blinding the UTXO.
Comparison of RGB and Ordinals
- Security: Every transaction or state transfer in Ordinals smart contracts needs to be achieved through spending a UTXO, while in RGB, this process heavily relies on the Lightning Network or off-chain RGB channels. The large amount of data storage in the RGB client (local cache or cloud server) during the RGB transaction process introduces a high degree of centralization and the possibility of centralized institution exploitation. Additionally, server downtime or local cache loss could result in customer asset loss. From a security perspective, Ordinals has an advantage.
- Verification Speed: Since RGB uses client-side verification, each verification of a transaction in the RGB protocol needs to start from scratch, significantly delaying the verification speed of each step of RGB asset transfer. Therefore, Ordinals has an advantage in verification speed.
- Privacy: The transfer and transaction verification processes of RGB assets occur off the blockchain, establishing a unique channel between the sender and receiver. Additionally, the blinding of UTXO prevents even the sender from tracing the UTXO's destination. In contrast, the transfer process of Ordinals assets is recorded through UTXO spending on the Bitcoin network, and the input and output of UTXOs can be queried on the Bitcoin network, offering no privacy. Therefore, from a privacy perspective, the RGB protocol has an advantage.
- Transaction Fees: The transfer of funds in RGB heavily relies on client-side RGB channels or the Lightning Network, resulting in almost zero transaction fees. Regardless of the number of intermediate transactions, only one UTXO needs to be spent and confirmed on the blockchain. However, each step of the transfer in Ordinals needs to be recorded in the tapscript, and combined with the cost of recording inscriptions, the transaction process will incur a significant fee. Additionally, the RGB protocol proposes a batch transaction packaging method, allowing multiple recipients of RGB assets to be specified in a single tapscript, while in Ordinals, the default output UTXO recipient is the recipient of the Ordinals asset, allowing only one-to-one transfers. RGB significantly reduces the cost of this process through sharing. Therefore, the RGB protocol has an advantage in transaction fees.
- Scalability: In RGB smart contracts, transaction verification and data storage are completed by the client (receiving node), not on the BTC chain, eliminating the need for broadcast and global verification on the mainnet. Each node only needs to confirm the data related to a specific transaction. In contrast, the inscription data in Ordinals needs to be recorded on-chain, and given the processing speed and scalability of the Bitcoin network itself, its capacity to handle transaction volume will be greatly limited. Therefore, the RGB protocol has an advantage in scalability.
RGB Ecosystem Projects
After the release of RGB v0.10.0, a more developer-friendly environment for development on the RGB network was provided. Therefore, the large-scale development of the RGB protocol ecosystem has only been half a year since its inception, and most of the following RGB ecosystem projects are still in the early stages of development:
- Infinitas
Infinitas is a Turing-complete Bitcoin application ecosystem that combines the advantages of the Lightning Network and the RGB protocol, supporting and complementing each other to achieve a more efficient Bitcoin ecosystem. It is worth mentioning that Infinitas also proposes a method of recursive zero-knowledge proof to address the inefficiency of client verification. If this method is effectively implemented, it will greatly solve the verification speed issue in the RGB network.
- RGB Explorer
RGB Explorer is the first browser to support the query of RGB assets and the sending of assets (Fungible token and Non-Fungible token), supporting three standard assets: RGB20, RGB21, and RGB25.
- Cosminmart
Cosminimart is essentially a Bitcoin Lightning Network compatible with the RGB protocol. It aims to create a brand new ecosystem for deploying smart contracts on Bitcoin. Unlike the single functionality of the above projects, Cosminmart provides a wallet, derivative trading market, and early project exploration market. It offers a one-stop service for the development, promotion, and trading of smart contracts on the Bitcoin network.
- DIBA
With the help of the Lightning Network and the RGB protocol, DIBA is dedicated to creating an NFT market for the Bitcoin network. It is currently running on the Bitcoin testnet and is expected to go live on the mainnet soon.
Future Prospects of RGB
With the release of RGB v0.10.0, the overall framework of the protocol program is becoming more stable, and the potential for large-scale incompatibility issues during version updates is gradually being addressed. Additionally, developer tools and various API interfaces are becoming more complete, reducing the difficulty for developers to use RGB for development.
Recently, Tether officially announced the deployment of USDT contracts on the Bitcoin Layer 2 network, transferring from OmniLayer to RGB. This move by Tether is seen as a signal of the crypto giant's attempt to enter the RGB network. RGB now has a mature development protocol, a large developer community, and recognition from crypto giants. Finally, RGB developers are currently attempting to use recursive zero-knowledge proofs to compress the volume of client verification. If this improvement can be achieved, the verification speed of the RGB network will greatly increase, thereby alleviating the network latency issues faced during large-scale usage.
References
- RGB protocol: https://rgb.tech/
- RGB-lightning-sample: https://github.com/RGB-Tools/rgb-lightning-sample
- RGB info: https://rgb.info/
- Infinitas official website: https://www.iftas.tech/#/home?id=about
- Cosminimart official website: https://cosminmart.com/#/
- DIBA official website: https://diba.io/
- RGB Explorer official website: https://rgbex.io/
- RGB ecosystem research report: Leading the large-scale adoption of Crypto, lighting up the future of Bitcoin*:*https://www.odaily.news/post/5189052
- ViaBTC Capital Insight丨A Brief Analysis of RGB: A Scalable, Confidential Smart Contract Protocol Built on Bitcoin: https://medium.com/@ViaBTC_Capital/viabtc-capital-insight丨a-brief-analysis-of-rgb-a-scalable-confidential-smart-contract-protocol-b449f7dbb323
- Interpreting the Bitcoin Oridinals protocol and BRC20 standard principles, innovations, and limitations: https://zhuanlan.zhihu.com/p/631275714
- BRC20 transaction data source: https://dune.com/cryptokoryo/brc20
免责声明:本文章仅代表作者个人观点,不代表本平台的立场和观点。本文章仅供信息分享,不构成对任何人的任何投资建议。用户与作者之间的任何争议,与本平台无关。如网页中刊载的文章或图片涉及侵权,请提供相关的权利证明和身份证明发送邮件到support@aicoin.com,本平台相关工作人员将会进行核查。