Trust Machines Logo

What is the RGB Protocol on Bitcoin?

Read Time 7 min
RGB Protocol on Bitcoin

The RGB network is a Bitcoin-based protocol that leverages the Lightning Network (LN). RGB addresses scalability by enabling the execution of private smart contracts between two parties (e.g., LN channels). It was developed to improve upon colored coins and tokenize digital assets on the Bitcoin blockchain.

It's one of the latest developments to come to the Bitcoin ecosystem as of late and has played its own part in helping show that the Bitcoin blockchain is, in fact, scalable, and that additional use cases can be built on top of Bitcoin.

Breaking Down the RGB Protocol

RGB (which stands for "Really Good Bitcoin," by the way) is a set of open-source protocols that enable the execution of smart contracts on a network. The motivation behind RGB is due to Bitcoin’s limited ability to support a smart contract execution environment. Bringing execution and validation off-chain allows participants to benefit from the security of the Bitcoin consensus layer while improving flexibility and scalability. 

Although the evolution of RGB can be attributed to an entire community, inspiration comes from Peter Todd’s early work on client-side validation and single-use seals. Peter’s work spurred Giacomo Zucco’s vision of RGB in 2016, which it was eventually implemented in 2017. Dr. Maxim Orlvosky and Giacomo formed the Lightning Network and Bitcoin Protocol (LNP/BP) Association in 2019 when Dr. Orlovsky also became the lead designer and contributor of the RGB protocol.

How RGB Works: Creating Smart Contract Agreements on Bitcoin

RGB is a protocol built over the Bitcoin blockchain’s Proof-of-Work (PoW) consensus layer. It leverages the Lightning Network and does not require tokens. However, it is capable of issuing and managing programmable and private assets. Using RGB requires no protocol changes to the Bitcoin blockchain or LN.

The protocol functions as a version of a Directed Acyclic Graph (DAG), where participants cannot see the complete state of the network. Each new transaction requires the confirmation of at least two earlier transactions before being recorded on the network. 

Client-side validation is powered by RGB schemas, which are how users create smart contract agreements between parties.

Client-side Validation

One of RGB’s core features is Client-side validation, a concept originated by Peter Todd. This validation method leverages the strength and security of the Bitcoin blockchain’s consensus mechanism while bringing RGB’s smart contract code and data off-chain. Since RGB transactions aren’t included in Bitcoin or lightning transactions, scalability and privacy are drastically improved. 

In addition to storing transaction data off-chain, RGB transactions are assigned to a UTXO set using single-use-seals, or seals, to close over bitcoin transaction outputs as another security measure. Seals prevent two different parties from providing different versions of what should be the same data. As such, they allow eligible parties to verify a smart contract's state history. 

RGB Smart Contracts, Schema, and Validation

RGB’s Schema at the genesis level defines each state validation rule, ensuring every consecutive state owner uses the same Schema to validate the history against it. Consequently, the Schema guarantees the social consensus, validation, and smart contract state.

RGB smart contracts comprise the state, owners, and operations participants can execute to update the state. 

  • By default, RGB contracts have well-defined parties with ownership rights over specific state atoms, which are referred to as owned states.
  • The state of the contract comprises state atoms of different data types, defined similarly to variable types in structural languages. (e.g., Rust)
  • Operations include the genesis operation, state transitions to update or add data, and state extension to enable public participation. 

RGB validation logic ensures that it always produces the same result, regardless of the platform or libraries used. This is achieved through two main components: 

  • The core validation logic utilizes Rust, a Turing-equivalent deterministic smart contract language.
  • All contract-specific validation logic runs on the Alluvium Virtual Machine (AluVM), a highly deterministic and exception-less VM that provides a platform-independent instruction set.

RGB Node

The RGB node has an identical architecture to LNP and BP nodes designed and maintained by the LNP/BP Standards Association. The node consists of multiple microservices designed to run as a single daemon process (e.g., a program that runs in the background without user intervention) on a desktop or a server, inside a single mobile app as threads, cloud-based systems, or as separate nodes combined in a single mobile app. Additionally, all peer-to-peer communications are end-to-end encrypted and work over the Tor network.

RGB Use Cases and Benefits

The RGB protocol offers a variety of use cases, including asset tokenization, digital identities, decentralized exchanges (DEXes), decentralized finance (DeFi), and non-fungible tokens (NFT) without relying on third parties. 

  • Asset tokenization allows for digitizing physical and virtual items, making storing, transferring ownership, and exchanging assets easier. 
  • The protocol also facilitates the tokenization and trading of securities like stocks and bonds on Bitcoin, providing added security, transparency, and liquidity. 
  • Regarding digital identities, the RGB protocol enhances user verification and transaction validation, ensuring secure and valid interactions. 
  • Build decentralized exchanges that offer faster transactions and lower fees, enhancing the efficiency of trading activities.
  • RGB network-enabled wallets allows you to send or transfer Bitcoin or RGB minted assets
  • LNP Node developers can issue and transfer RGB assets on top of LN channels and transact with other LNP Node operators.

By default, RGB transactions remain private unless users explicitly broadcast their smart contracts. Users also benefit from reduced fees and higher censorship-resistance due to off-chain settlement–additionally, the bitcoin blockchain benefits from less network congestion and data storage for miners.

RGB Digital Assets 

Fungible assets and non-fungible tokens (NFTs) are available on RGB. However, they follow the LNP/BP RGB specifications and are not ERC-20 compatible.

  • LNP/BP RGB-20 is the fungible asset specification that defines what is required to use the asset. These requirements are found in the asset data, also known as genesis data. Although a native burning mechanism doesn’t exist by default, users can opt to use a subschema to burn/mint fungible assets.
  • LNP/BP RGB-21 is the NFTs specification in RGB following a schema. Users can engrave custom data using a subschema to link directly to the token. This can also enable solutions like royalties. The RGB’s NFT utilizes a Lightning peer-to-peer Network extension called Bifrost.

The RGB Network and its Potential for Bitcoin

While smart contracts on Bitcoin have already been enabled to some degree thanks to layer solutions, the RGB protocol offers a novel solution for executing smart contracts off-chain while utilizing Bitcoin's secure settlement layer. The release of version 0.10 in April unlocks global states to smart contracts and programmability features based on the new AluVM comes at an opportune time as Bitcoin activity continues to capture headlines. 

Time will tell if this release will be a catalyst for RGB. However, seeing what kind of traction RGB achieves will be exciting, especially as the community continues to expand on how the protocol uses the Bitcoin blockchain.

Share This Article
Builder Tracking Pixel