However, RGB is not a technology that solves all problems based on magic; It seems so. The reality is that behind the development of RGB there are both new and old ideas that converge to achieve a solution that many in the BTC community have long called for: Full Turing Smarts Contracts on Bitcoin.
However, before explaining how RGB works, it is necessary to have some clear concepts about BTC and its actual capabilities.
Bitcoin has smart contracts, it always has
First, let’s clear our notions of false information: Bitcoin has smart contracts. There are many newbies to the crypto world (and those who have been around for a long time) who think Bitcoin doesn’t have smart contracts. But the reality is, yes, Bitcoin has smart contracts and always has. More precisely, these smart contracts are called Bitcoin Script in Bitcoin and are responsible for us mobilizing value within the BTC network.
At this point you might be wonderingWhy is it said that BTC doesn’t have smart contracts? The reason is very simple: Bitcoin Script is capped. It’s so overwhelming that compared to Solidity (the smart contract language used in ETH) we could well say that Bitcoin Script is a tasteless joke. However, this has a very clear goal: make Bitcoin Script a very safe language. Bitcoin Scripts is so secure that in the more than 10 years of Bitcoin’s life we have never heard of Bitcoin script hacking but of smart contracts written in Solidity.
Of course, this doesn’t mean that Bitcoin Script is perfect either. In fact, it has flaws, many of which are well documented, but when compared to Solidity, we can say that Bitcoin Scripts has a near perfect balance sheet.
then What’s the problem with bitcoin scripts? Well, it is an incomplete Turing language and therefore limited in its possibilities. As opposed to Solidity, when it’s Full Turing and you can do whatever your mind imagines with it. To make it easier to illustrate, you can see Bitcoin Scripts as a propeller plane and Solidity as a jet plane. You can travel with both, but the possibilities of both are very different.
The above becomes even clearer when you compare a Bitcoin Script code to a Solidity code. Solidity is easy to human read and easy to use. Nevertheless, This is something that Bitcoin developers know and have constantly improved upon, and among these improvements, RGB offers unique advantages.
RGB, new possibilities for BTC
RGB initially works on the basis of a client-side validation scheme. RGB is designed in such a way that any user can see, execute, review and track its status at any time without having to be processed as a whole by the network in which the smart contract is located. As a result, the execution of each contract can only take place between the parties interested in it, without overloading the network. Further, RGB enables these smart contracts to be off-chain, so they can be stored off the blockchain to avoid overgrowth (which happens in Ethereum and many blockchains that follow its model).
The basic idea behind these functions is; that it is not necessary for the network to process smart contracts to avoid congestion. Simply the users who interact with the smart contracts access them. That way, they can use their computing resources to run it, and at the end of the run, they take the outputs and states from it to store on the blockchain. Once there, this data is a publicly verifiable record of the user’s interaction with the smart contract and the results of this interaction.
This eliminates complex structures such as distributed virtual machines (as with EVM), contracts become much more flexible, and the costs per interaction are significantly lower (goodbye to the gas nightmare). Smart contracts can even be updated on the fly without having to point in new directions, which makes DApps development and troubleshooting easier. All of this while maintaining the security of the system and avoiding undesired manipulation.
Undoubtedly, this opens up a whole host of new opportunities for BTC, potentially improving its technology to a level even higher than what Ethereum (and even Etheruem 2.0) can offer.
A scalable and compatible design
The great thing about RGB, however, is that everything builds on the current fundamentals of Bitcoin and the Lightning Network without necessarily having to change the fundamental fundamentals of those protocols. This means that RGB is 100% compatible with these protocols and their functional standards.
In fact, RGB structuring allows smart contracts to be added to Bitcoin without disrupting BTC or LN operations, and offers a high level of data protection thanks to technologies like MimbleWimble and Confidential Transactions from Liquid Blockstream. In addition, RGB uses a computational model SRM (State Replicated Machines or Replicated State Machines), which has tremendous advantages, as we can see in a consensus protocol like Tendermint or DiemBFT (the consensus protocol developed by Facebook for Diem-Libra). . . One of these advantages is the ability to restart from every point in time distributed in the network, which Erick Zhang (inventor of NEO and dBFT) explains very well in this paper.
The latter is important because it enables the Genesis state of an RGB smart contract to be displayed in the network for the first time. When this state develops, its data form a DAG (Directed Acyclic Graph) that can be verified by a user regardless of the time state they choose. Basically, the entire history of smart contracts and their interactions is summarized in a hash (a Merkle Tree or Merkle Tree) and the user can take this hash and check it very simply and easily. This prevents smart contracts from being forged or the user from manipulating their information.
In addition, all operations (such as moving coins from one address to another using the smart contract) are controlled by the UTXO model of Bitcoin and LN channel states. This means that the security of your coins (or tokens) relies on Bitcoin, its blockchain and a system of special cryptographic signatures that act as a commitment and witness to the information that the user mobilizes with this smart contract.
Another important element of RGB capabilities is the ability to work through sharding. This means that RGB clients can organize themselves in subnets, each of which keeps certain contracts and their statuses stored in a decentralized manner. Result? The computing capacity of RGB grows exponentially with the growth of its shards, until the generation of decentralized AI protocols and intensive distributed computing is possible.
RGB Core and RGB Node, the basic elements of RGB
To make RGB a reality, there are two basic parts, RGB Core and RGB Node. RGB Core is a collection of functions written in Rust that enables the implementation of all the functionalities already described above. The function of RGB Core is to create an integrable system with BTC and. to enable LN, make it safe (hence the use of Rust) and implement all RGB functionalities so that they can be used.
RGB Core is born into RGB Node, which is responsible for creating the RGB execution space, which makes it the heart of this technology. The node can act as a series of interconnected microservices that allow a P2P network to be built with end-to-end encryption and run on Tor networks. All of this with support for the mainnet BTC network, the LN protocol (LNP) and generalized LN channels (GLC). In addition, it is able to operate a Bitfrost node to connect to other services and to set up watchtowers in order to create additional infrastructures with this technology.