Overview

1.Creation of RGB Assets 🍭🍭

🌈Step 1:

XRGB Wallet users need to deposit BTC in advance. This is used to initiate a BTC transaction and create a new UTXO for the on-chain commitment of newly created RGB asset. The amount of Bitcoin required is not large; it just needs to be sufficient to prevent any output from becoming a dust transaction. XRGB Wallet suggests a minimum of 10,000 satoshis.

🌈Step 2:

To create RGB assets in the XRGB Wallet, users enter the asset's code or abbreviation, full name and total supply, setting the precision to 18. Upon successful creation, a Bitcoin transaction is initiated. The commitment for the newly created RGB asset is added to the OP_RETURN output or Taproot output of the Bitcoin transaction, directing the ownership of the asset to the UTXO newly created in this BTC transaction. In the following content, we will refer to this UTXO as UTXO_Genesis. As this BTC transaction is broadcasted on the Bitcoin network, whoever owns UTXO_Genesis becomes the owner of the newly created RGB asset.

🌈Note:

The use of the OP_RETURN field output is part of the BTC transaction, not a separate step post-creation. Therefore, the pre-deposited Bitcoin is used to make the BTC transaction, add the commitment to the OP_RETURN or Taproot output and create the UTXO_Genesis.

2.Send/Receive RGB Assets🍭🍭

🌈2.1.Userflow

(1) The recipient imports the RGB asset contract and generates an invoice containing the receiving amount.

(2) The sender verifies the invoice and sends the generated consignment to the recipient.

(3) The recipient signs the consignment, successfully transferring the RGB asset.

🌈2.2.Workflow

Step 1: the formation of a new state transition consignment and the corresponding witness transaction

The XRGB Wallet initially constructs a PSBT (Partially Signed Bitcoin Transaction) file, defining the underlying witness transaction structure. Based on this PSBT, the consumed output list is passed to the RGB node, along with a specific contract ID. The node prepares a state transition consignment, including the complete history of the consumed outputs.

This consignment is then used in the transfer preparation process. During this, a new state transition (or multiple bundled transitions) is arranged based on the consignment file, PSBT, beneficiary list, and available change addresses.

Next, the RGB node is requested to complete the consignment and prepare for disclosure. This involves

(1) extracting all other contracts affected by this operation and preparing "blank" state transitions for them;

(2) packaging the main contract's state transition with additional blank transitions of other affected contracts into an anchor;

(3) updating the consignment file with the newly formed anchor and state transitions;

(4) preparing a disclosure containing the remaining blank state transitions.

This completes the formation of a new state transition consignment and the corresponding witness transaction (e.g., transaction spending UTXO_Genesis).

Step 2: sign the consignment and broadcast on chain

The consignment is then sent to the recipient, who must return a signature.

Once the signature is received, the witness transaction from the PSBT (e.g., transaction spending UTXO_Genesis) should be signed by all signatories and released to the network. Simultaneously, the RGB node should attach the previously prepared disclosure in parallel to maintain the validity of the remaining smart contracts.

Note:

If only a portion of the RGB assets in UTXO_Genesis is transferred to the recipient, part of the RGB assets will be colored to UTXO_1, and the remainder to UTXO_2. Both UTXO_1 and UTXO_2 are created in the BTC transaction which spending UTXO_Genesis, with UTXO_1 sent to the BTC Mainnet recipient's address and UTXO_2 returned to the BTC Mainnet sender's address, allowing the recipient and sender to own UTXO_1 and UTXO_2, respectively.

3.RGB Asset Accounting 🍭🍭

If you possess UTXOs that have been colored by RGB20 or RGB21, XRGB Wallet can use client-side validation to confirm that you have received and can control your assets.

4.Bitcoin Address Format 🍭🍭

Deterministic Bitcoin Commitments (DBCs) offer a method to create provably unique commitments within Bitcoin transactions. The RGB protocol allows two types of DBCs: those based on taproot outputs (referred to as β€œtapret”) and those based on OP_RETURN outputs (referred to as β€œopret”).

To better support user management of RGB assets, and considering future scalability, XRGB Wallet provides comprehensive functionality for creating, importing, and using the β€œBech32m” Bitcoin address format in the first version. The Bech32m format is not only compatible with existing Segwit-support systems but also supports all new features included in the Taproot upgrade. It can support both types of DBCs, significantly enhancing transaction efficiency, security, and privacy. This improves the user experience and the future scalability of the wallet while reducing transaction costs.

Last updated