What Is the RGB Protocol? A Beginner's Guide
October 9, 2023
More and more building is taking place on Bitcoin as developers seek to unlock the potential of the most secure blockchain network in the world. This guide will explore RGB, one of the projects building on the Bitcoin blockchain.
Read on to learn what RGB is, how it works, and discover its use cases.
What is RGB?
RGB is a smart contract-enabled Layer-2 (L2) and Layer-3 (L3) protocol built on top of the Bitcoin base layer (LNP/BP) and the Lightning Network.
The RGB protocol aims to scale Bitcoin transactions and provide enhanced transactional privacy. RGB stands for “Really Good for Bitcoin.”
RGB was initially proposed by Peter Todd and Giacomo Zucco in 2016. Since mid-2019, the main contributors to the project have been Dr. Maxim Orlovsky and Pandora Core AG. RGB is based on a set of standards maintained by a Swiss non-profit called the LNP/BP Standards Association, established by Dr. Orlovsky and Zucco in 2019. The protocol launched on the mainnet in June 2023.
The protocol is Turing-complete, just like Ethereum. That means developers can build complex smart contracts, enabling the issuance of fungible and non-fungible tokens and the creation of decentralized applications (dApps) and decentralized autonomous organizations (DAOs).
The RGB team’s original goal was to improve Colored Coins. Colored Coins was a 2012 project that introduced a way of representing real-world assets on the Bitcoin blockchain, similar to what the Bitcoin Ordinals community is working on building today.
However, after a few weeks of research, the project deviated so far from this goal that it had nothing to do with Colored Coins anymore.
How Does RGB Work?
RGB is built on Bitcoin and leverages it for its own security. It can also operate on L2 protocols, including sidechains. Currently, it only runs on top of Lightning as a Layer-3. The protocol is compatible and interoperable with all Bitcoin technologies and the Lightning Network. Therefore, it doesn’t require any hard forks on these networks.
RGB is a form of directed acyclic graph (DAG), which means no one can see the complete state of the network. Only smart contract participants can access transaction data unless they make this information publicly known. DAG is a kind of distributed ledger technology (DLT) used to improve the scalability challenges blockchains face.
Here are the core elements powering the operation of RGB:
Client-Side Validation
RGB smart contracts use client-side validation, a paradigm proposed by Peter Todd in 2016. The paradigm is based on the concept that state validation doesn’t have to be performed by all participants of a decentralized network. Instead, only the participants involved in a specific state transition need to carry out the validation.
In other words, token transfer verification isn’t handled by a global consensus layer but is moved off-chain and validated by the client involved and receiving the payment. This reduces data storage needs on the base layer, improving scalability.
Validation rules are defined by the Schema, a blueprint, or standard for RGB assets.
Single-Use Seals
Transactions are not published on the base layer. Rather, assets on RGB are assigned to a Bitcoin unspent transaction output (UTXO) in the form of a short cryptographic commitment known as a single-use seal. To put it another way, RGB uses Bitcoin transactions to store commitments on-chain. This commitment prevents double spending, making sure the same funds cannot be used to make two payments.
The commitment includes a message that defines the input, the Bitcoin UTXO, where the tokens will be sent, the amount, the asset ID, and the spending conditions. Commitments do not require any additional storage, keeping the Bitcoin ledger congestion-free.
On the other hand, payment data from the payer to the receiver is transmitted off-chain. Therefore, a blockchain observer cannot view these details, enabling users to conduct private transactions. The receiver gets all the transaction history of the asset sent since it was issued, permitting them to validate that the spending conditions have been respected and the asset hasn’t been inflated.
RGB provides further privacy by blinding the UTXO where the receiver will get the tokens from the payer.
Algorithmic Logic Unit Virtual Machine (AluVM)
A virtual machine is an engine that handles smart contract deployment and execution. Designed by Dr. Maxim Orlovsky, RGB’s AluVM is vital to developing advanced smart contracts that can support use cases like creating algorithmic stablecoins on RGB and building DeFi protocols.
The following is a comparison between AluVM and other virtual machines and smart contract solutions:#
RGB Smart Contracts Explained
An RGB smart contract is represented by a genesis state created by the issuer and a DAG of state transitions held in the form of client-verified data. The state is assigned to Bitcoin UTXOs that are used as single-use seals.
Moving assets on RGB entails opening an old seal to close a new one. This is similar to DAGs, which reference older transactions to confirm new ones.
State refers to the rights being operated within a smart contract, such as asset issuance and transfer. On the contrary, the state transition is the process that moves the protocol from one state to another.
A smart contract issuer sets validation rules in the genesis state. These rules or schema define the metadata, global and owned states, and seals allowed within the state transitions. Therefore, smart contracts can have different states, guidelines, and types of single-use seals.
The party that spends the corresponding transaction output owns the state and has the right to change the smart contract state.
RGB smart contracts operate in shards, similar to the Ethereum sharding solution proposed to scale that blockchain. Sharding means splitting a large database into smaller portions called shards. This helps a network support more data. This increases efficiency, proficiently scaling the network.
RGB Protocol Use Cases
Now, let’s take a look at possible use cases on RGB.
Issuance of Fungible and Non-Fungible Tokens
RGB’s advanced smart contracts allow projects to issue fungible tokens like stablecoins, utility tokens, security tokens, and tokenized shares. Also, anyone can mint and issue digital art, digital collectibles, music, videos, and other assets represented by NFTs on RGB. The token standards for fungible and non-fungible tokens on RGB are RGB-20 and RGB-21, respectively.
DeFi
The RGB virtual machine allows developers to build decentralized exchanges, lending protocols, liquid staking platforms, and yield farming protocols, thereby contributing to the growing Bitcoin DeFi ecosystem where people can lend, borrow, trade, earn yields, mint stablecoins, and provide liquidity to liquidity pools.
DAOs
Complex RGB smart contracts can power decentralized autonomous organizations, enabling crypto projects to become more decentralized by giving their communities voting power over key development decisions.
Benefits and Drawbacks
Benefits
- RGB can scale L1 and L2 protocols.
- It leverages the DAG model, allowing it to offer partially confidential transactions.
- Smart contract data is taken off-chain, and only commitments are recorded on-chain.
- RGB supports complex smart contracts.
- The protocol is compatible and interoperable with Bitcoin updates such as Taproot, SegWit, and Schnorr signatures.
- It uses shards to enhance data storage.
- The Bitcoin blockchain secures RGB smart contracts.
Drawbacks
- The state of RGB smart contracts isn’t publicly accessible, which could limit some use cases.
- The confidentiality of users’ past transaction activities degrades over time as the tokens are progressively exchanged between parties. This happens because a token’s complete history has to be revealed for receivers to verify a payment. As a result, future token owners can see all the UTXOs related to previous transfers.
The Bottom Line
Although RGB has a strong value proposition for significantly promoting asset issuance and DeFi within the Bitcoin ecosystem, it’s still in the early stages of development, and time will tell how it will compare to the more popular L2 smart contract-focused Bitcoin protocols like Stacks and RSK.
FAQs
How is RGB Protocol Different from Lightning?
RGB is a Layer-3 protocol that operates on the Bitcoin base layer and Lightning, while Lightning solely operates as a Layer-2 protocol. Moreover, RGB supports advanced smart contracts that enable asset issuance and the creation of DeFi protocols, whereas Lightning supports simple smart contracts only. Therefore, fungible tokens, NFTs, and DeFi protocols can’t run on it.
What Can You Build on RGB Protocol?
RGB’s advanced smart contracts and the Algorithmic Logic Unit Virtual Machine (AlumVM) enable developers to build a diverse range of DeFi applications, such as decentralized exchanges, lending protocols, stablecoin protocols, and liquid staking platforms. Additionally, developers can create and issue both fungible and non-fungible tokens on RGB and run decentralized autonomous organizations (DAOs).
Does RGB Protocol Have a Token?
No, RGB doesn’t have its own token since it is not a token protocol. However, users can issue fungible and non-fungible tokens on it thanks to advanced smart contract support and virtual machine availability. The token standard for fungible tokens on RGB is RGB-20, while the token standard for NFTs is RGB-21. The protocol also has other token standards for digital identities, audit logs, and domain names.