Progress pill
Building on RGB

DIBA and the Bitmask project

RGB programming

DIBA and the Bitmask project

  • From JavaScript to Rust, and into the Bitcoin ecosystem
  • The appeal of RGB and building on layers
  • The foundations of the RGB protocol
  • The token function (RGB20) and unique assets (RGB21)
  • The Bitmask solution: a wallet for RGB
  • Security and distributed architecture
  • Towards a broader ecosystem: marketplace, interoperability and new functions
  • Conclusion
This final section of the course is based on presentations made by various speakers at the RGB bootcamp. It includes testimonials and reflections on RGB and its ecosystem, as well as presentations of tools and projects based on the protocol. This first chapter is moderated by Hunter Beast, and the next two by Frederico Tenga.

From JavaScript to Rust, and into the Bitcoin ecosystem

At first, Hunter Beast worked mainly in JavaScript. Then he discovered Rust, whose syntax seemed unappealing and frustrating at first. However, he came to appreciate the power of the language, the control over memory (heap and stack), and the security and performance that come with it. He emphasizes that Rust is an excellent training ground for in-depth understanding of how a computer works.
Hunter Beast recounts his background in various projects in the altcoin ecosystem, such as Ethereum (with Solidity, TypeScript, etc.), and later Filecoin. He explains that he was initially impressed by some of the protocols, but ended up feeling disillusioned by most of them, not least because of their tokenomics. He denounces the dubious financial incentives, the inflationary creation of tokens that dilutes investors, and the potentially exploitative aspect of these projects. So he ended up adopting a Bitcoin maximalist stance, not least because some people opened his eyes to Bitcoin's sounder economic mechanisms, and to the robustness of this system.

The appeal of RGB and building on layers

What definitively convinced him of Bitcoin's relevance, in his words, was the discovery of RGB and the concept of layers. He believes that existing functionalities on other blockchains could be reproduced on higher layers, above Bitcoin, without altering the basic protocol.
In February 2022, he joined DIBA to work specifically on RGB, and in particular on the Bitmask wallet. At the time, Bitmask was still at version 0.01 and was running RGB at version 0.4, only for the management of single tokens. He notes that this was less self-custody-oriented than today, as the logic was partly server-based. Since then, the architecture has evolved towards this model, much appreciated by bitcoiners.

The foundations of the RGB protocol

The RGB protocol is the most recent and most advanced embodiment of the colored coins concept, already explored around 2012-2013. At the time, several teams were looking to associate different bitcoin value on UTXOs, which led to multiple scattered implementations. This lack of standardization and the low demand at the time prevented these solutions from gaining a lasting foothold.
Today, RGB stands out for its conceptual robustness and unified specifications via the LNP/BP association. The principle is based on client-side validation. The Bitcoin blockchain only stores cryptographic commitments (commitments, via Taproot or OP_RETURN), while the majority of data (contract definitions, transfer histories, etc.) is stored by the users concerned. In this way, the storage load is distributed and the confidentiality of exchanges is reinforced, without weighing down the blockchain. This approach enables the creation of fungible assets (RGB20 standard) or unique assets (RGB21 standard), within a modular and scalable framework.

The token function (RGB20) and unique assets (RGB21)

With RGB20, we define a fungible token on Bitcoin. The issuer chooses a supply, a precision, and creates a contract in which he can then make transfers. Each transfer is referenced to a Bitcoin UTXO, which acts as a Single-use Seal. This logic ensures that the user will not be able to spend the same asset twice, since only the person capable of spending the UTXO actually holds the key to update the state of the client-side contract.
RGB21 targets unique assets (or "NFT"). The asset has a supply of 1, and can be associated with metadata (image file, audio, etc.) described via a specific field. Unlike NFTs on public blockchains, data and their MIME identifiers can remain private, distributed peer-to-peer at the owner's discretion.

The Bitmask solution: a wallet for RGB

To exploit RGB's capabilities in practice, the DIBA project has designed a wallet called Bitmask. The idea is to provide a non-custodial, Taproot-based tool, accessible as a web application or browser extension. Bitmask manages both RGB20 and RGB21 assets, and integrates various security mechanisms:
  • The core code is written in Rust, then compiled in WebAssembly to run in a JavaScript environment (React);
  • Keys are generated locally, then stored encrypted locally;
  • State data (stash) is held in memory, serialized and encrypted via the Carbonado library, which performs compression, error correction, encryption and stream verification using Blake3.
Thanks to this architecture, all asset transactions take place on the client side. From the outside, the Bitcoin transaction is nothing more than a classic Taproot spending transaction, which nobody would suspect is also carrying a transfer of fungible tokens or NFTs. The absence of on-chain overloading (no publicly stored metadata) guarantees a certain degree of discretion and makes it easier to resist possible censorship attempts.

Security and distributed architecture

Insofar as the RGB protocol requires each participant to retain its transaction history (to prove the validity of the transfers it receives), the question of storage arises. Bitmask proposes to serialize this stash locally, then send it to several servers or clouds (optional). The data remains encrypted by the user via Carbonado, so a server cannot read it. In the event of partial corruption, the error correction layer can reconstitute the content.
The use of CRDT (Conflict-free replicated data type) enables different versions of the stash to be merged, should they diverge. Everyone is free to host this data wherever they wish, as no single full node carries all the information linked to the asset. This exactly reflects the Client-side Validation philosophy, where each owner is responsible for storing evidence of the validity of their RGB asset.

Towards a broader ecosystem: marketplace, interoperability and new functions

The company behind Bitmask is not limiting itself to the simple development of a wallet. DIBA intends to develop:
  • A marketplace for exchanging tokens, particularly in RGB21 form;
  • Compatibility with other wallets (such as Iris Wallet);
  • Transfer batching techniques, i.e. the possibility of including several successive RGB transfers in a single transaction.
At the same time, we're working on WebBTC or WebLN (standards enabling websites to ask the wallet to sign Bitcoin or Lightning transactions), as well as on the ability to "teleburn" Ordinals entries (if we want to repatriate Ordinals to a more discreet and flexible RGB format).

Conclusion

The whole process shows how the RGB ecosystem can be deployed and made accessible to end-users through robust technical solutions. The transition from an altcoin perspective to a more Bitcoin-centric vision, coupled with the discovery of Client-side Validation, illustrates a fairly logical path: we understand that it is possible to implement various functionalities (fungible tokens, NFT, smart contracts...) without forking the blockchain, simply by taking advantage of cryptographic commitments on Taproot transactions or OP_RETURNs.
The Bitmask wallet is part of this approach: on the blockchain side, all you see is an ordinary Bitcoin transaction; on the user side, you manipulate a web interface where you create, exchange and store all kinds of off-chain assets. This model clearly dissociates the monetary infrastructure (Bitcoin) from the issuing and transfer logic (RGB), while ensuring a high level of confidentiality and better scalability.
Quiz
Quiz1/5
How does RGB ensure confidentiality in digital asset management?