For affiliates
To support RGB USDT, the user needs an RGB-capable wallet. See Getting Started with RGB, the RLN Quick Start, or the Utexo SDK. The swap integration itself adds one step: the user pays the invoice returned with the intent.1
Quote and intent
Quote and create the intent as for any swap, with
deposit_type: "escrowed". user_source_public_key is required, as for other Bitcoin sources.2
Read the rgblock approval
The intent response returns
approval_mechanism: "rgblock":3
Pay the invoice
The user’s wallet pays Utexo accepts either the provided
witness_invoice for asset_amount of asset_id, and signs the resulting PSBT without broadcasting it. Submit it as a psbt approval:psbt signed by the user, or a PSBT built by the user’s wallet that pays the lock address.4
Track the swap
Track the intent as usual with Intent Status. If the swap is not fulfilled before the deadline, the RGB USDT is refunded to the user.
For resolvers
An RGB-source swap follows the Bitcoin settlement lifecycle — lock, fulfill, claim — with RGB-specific work in the lock and the claim. It happens in two phases:- Escrow: the RGB allocation is bound to the HTLC output. It is not in your wallet yet.
- Ownership: after fulfillment, you spend the HTLC into an RGB receive output of your own wallet, which moves the allocation to you.
rgb-lib exposes the required calls (htlc_prepare, htlc_apply, htlc_abort), with Go bindings in rgb-lib-go.
1. Lock: answer the deposit PSBT callback
Utexo calls your Bitcoin deposit PSBT callback as for a BTC swap.- Build the HTLC exactly as for Bitcoin: NUMS internal key and the three leaves (resolver withdraw with
OP_HASH256, timelock refund, fast refund). - Load the asset and amount from the quote. The callback request does not include them.
- Create your claim destination: call
witness_receivefor the asset and amount, then convert the recipient ID into a script withscript_hex_from_recipient_id. It must be a witness receive; a blinded receive cannot be used as a claim destination. - Build the lock PSBT with
OP_RETURN(intent tag) at output0and the P2TR HTLC at output1, at least dust. - Return the usual fields plus
destination_script_hex(the claim destination script, not the HTLC).
2. Fulfill
Unchanged from Bitcoin settlement: deliver the destination asset and report the fulfillment. Nothing RGB-specific happens in this step.3. Claim: move the RGB into your wallet
After the swap is fulfilled and the secret is revealed:1
Accept the lock consignment
Call
fetch_and_accept_transfer_by_recipient_id for the lock invoice, then check the amount on the HTLC outpoint with contract_assignments_for_outpoints. The HTLC is not a wallet UTXO, so accept first, then read.2
Build the claim PSBT
Input: the HTLC outpoint, with the withdraw leaf, control block, and witness UTXO. Outputs: an empty
OP_RETURN at 0, and your claim destination (destination_script_hex) at 1. Do not sign yet.3
Color it
Call
htlc_prepare with the PSBT, the asset mapped to output 1, and the HTLC as the input carrying RGB. Color before signing.4
Post, sign, broadcast, apply
Post the consignment produced by
htlc_prepare to the RGB proxy, sign the HTLC input with [signature, secret, script, control block], broadcast, then call htlc_apply and refresh. If you never broadcast, call htlc_abort.Coloring rules
Do not register the HTLC as a wallet output and do not treat the lock as a wallet UTXO.