How Can RGB Improve Bitcoin? – Bitfinex blog
21 Jun How Can RGB Improve Bitcoin?
RGB is a smart contract layer and off-chain protocol built on the Bitcoin blockchain, which allows for the minting and issuing of Bitcoin-based digital assets. With RGB, users will be able to issue stablecoins, tokens, Non Fungible Tokens (NFTs), and create client-validated confidential smart contracts on Bitcoin.
Why Doesn’t Bitcoin Have Web3-Style Smart Contracts Yet?
With the success of Ethereum’s Web3 smart contract ecosystem, and the recent hype surrounding Ordinals and Inscriptions, BRC-20 tokens, Stamps, and other methods to create tokenised assets on Bitcoin, it’s clear that crypto users really want smart contracts and tokens on Bitcoin.
One of the key philosophical differences between Bitcoin and Web3 blockchains like Ethereum, is the desire in Bitcoin, to push unnecessary data off-chain, to keep the base layer blockchain simple, nimble, and scalable. The less data that needs to be stored on-chain, the easier it is for a user to run their own node, helping with the network’s overall decentralisation and censorship-resistance.
Bitcoiners have long disagreed with Ethereum’s design choices of having the computational logic of smart contracts, tokens, and more elaborate use cases like Decentralised Finance (DeFi), or Decentralised Exchanges (DEXs) on-chain on the base layer blockchain.
By adding this complexity to layer one, it makes it harder for normal users to run their own node which adds a vector for centralisation, as it becomes much harder to scale the network as it consumes more bandwidth and computational resources.
It also makes the chain easier to attack or censor, as there are less nodes, and they are more often run by companies or individual blockchain projects who utilise data centres, like Infura, rather than average users on their own personal computers. Public organisations like a blockchain startup or foundation have a much larger regulatory attack surface than a random anon running a node at home.
With the advent of the Lightning Network, as a cheap and instant settlements layer, with its vast improvements to scalability, Bitcoiners now have a viable path forward to implement smart contracts, tokens, and other Web3-style features. Better yet, they can be implemented in a way that could address the perceived flaws of adding smart contracts and complexity to the base layer blockchain.
Lighting’s scalability benefits allow for smart contracts and associated data to be stored off-chain, and its high transaction throughput and instant settlement make for more performant smart contracts, done “the right way” from a design perspective.
With the more recent attempts at tokenisation and smart contracts on Bitcoin, like Ordinals, which have been in the news a lot recently, the approach has been accused of being sloppily hacked and slapped together.
Inscriptions are created by including an arbitrary blob of data in the SegWit witness data using Taproot spend scripts, which were never intended to be used in this way. This creates more on-chain data, making operating a node resource intensive, and making it harder to scale Bitcoin.
As a result, Ordinals, Inscriptions, and BRC-20 tokens suffer from technical limitations that Ethereum’s ERC-20, ERC-721, and ERC-1155 token standards do not.
With RGB however, smart contracts and tokenised assets will have several notable advantages over Ethereum’s current tokenisation schemes.
What is RGB and How Does it Work?
Simply put, RGB is a layer two network for asset tokenization and smart contracts on Bitcoin and Lightning Network using the client side validation model.
RGB, which stands for Red, Green, Blue, paying homage to Bitcoin’s coloured coins which laid the foundation for the project’s research. RGB is based on research by Peter Todd which was later adapted and repurposed by Giacomo Zucco to create the design for RGB.
After several years of continuous improvements and development, RGB is now represented by a diverse ecosystem of entities and individuals who build on top of the protocol and contribute to it.
The way RGB works is quite innovative. RGB employs client-side validation which means that all the data associated with transactions and smart contracts is kept off-chain and verified by the user. Client side validation has two principal advantages.
First, it enables Lightning Network compatibility without any additional changes to the Lightning Network protocol. Second, it lays a strong base for more scalability, privacy, and programmability, since it keeps all the validation logic outside the blockchain.
This means that on-chain fees are minimised, blockchain observers cannot violate the privacy of RGB users, and there is no need for a global consensus to update the protocol and its validation logic.
This client side validation model employs single-use seals defined over Bitcoin transaction outputs (UTXO) which provides the ability to fully leverage Bitcoin’s double spending protection and censorship resistance without any trust compromise.
An asset is always allocated to a Bitcoin output (which has the role of single-use seal in the protocol), and when it is transferred to a new owner such outputs needs to be spent, meaning that a Bitcoin transaction is created with that UTXO as an input, and the off-chain RGB transfer data will define which UTXO is the new owner of the asset.
To issue a new asset, a user needs to create an issuance contract, which will define all the parameters of the token, such as total supply, metadata, media attachment and transaction validation rules.
The user can define these parameters for each smart contract in a “Schema”, which can be seen as a template to create new issuance contracts. Different Schema can be used for different use cases, for example, issuing tokenised assets that are fungible uses one Schema, issuing NFTs use another Schema, while a digital identity may use yet another Schema.
Each RGB smart contract operates independently, as its own “shard” or segment, which means it’s fully independent of other contracts, and they never interact directly, meaning that, unlike other token protocols, each user needs to validate only the contracts that are relevant for him, keeping the hardware requirement for full validation low.
Thanks to the compatibility with the Lightning Network, it is possible to send and receive RGB assets with the same speed and costs of Bitcoin Lightning Network payments, while retaining all the security of the Bitcoin blockchain. This represents a paradigm shift compared to other asset protocols which usually achieve fast and cheap transactions only by sacrificing network decentralisation, security and censorship resistance.
Moreover the Lightning Network can be leveraged also to enable DEX functionalities, letting users swap assets against Bitcoin directly on Lightning. Compared to liquidity pool based DEXes, this model offers lower latency, lower fees, more privacy, no risk of front-running by miners or flashbots and certainty on the execution price, all elements that contribute to developing a more efficient market with better prices for all the participants.
When Will RGB Make it to Bitcoin Wallets and Users?
RGB, while extremely exciting, is still in its final stages of development and testing. Many developer tools and wallets have already been created, but at the time of writing they are still only used in testnet. RGB can be compared to the early days of the Lightning Network, where using it was considered “reckless” and the protocol may still have bugs and users could potentially lose funds if they are not very careful.
That being said, for the brave and adventurous, there’s already a great educational website for users who want to start understanding and playing around with the protocol, and for developers interested in building with RGB.
As it stands currently, there are several RGB wallets that users can start using to issue, send, and receive tokenised assets via RGB. While many Bitcoin wallets have not implemented support for RGB, it can be expected that they will as the protocol matures.
The current wallet offerings include Iris, Bitmask, MyCitadel, and Shiro, and new teams that want to build on top of RGB can leverage the rgb-lib library for faster development without having to dive too deep in the protocol’s technicalities. Interested users can also elect to run their own RGB compatible Lightning Network node, which can be used to create Lightning channels denominated in RGB assets and send payments through them .
RGB is a very promising protocol that can solve many of the problems currently faced by the digital assets ecosystem. This is why Bitfinex is actively supporting RGB with an entire team dedicated full-time to advancing its development. Bitfinex’s RGB team is contributing to RGB not only by contributing to the protocol itself, but also by releasing several developer tools, launching the Iris Wallet and the Lightning Node. Tackling ecosystem-wide problems with new approaches is the best way to enable progress and advance the whole industry.