Skip to content

Practicing RGB Swaps on RGB Dex ​

Bitlight Labs describes the protocol-side workflow and API in RGB Swaps in Practice. This post uses two wallets to show how that capability lands on RGB Dex as a complete Buy / Sell swap.

I. Feature description ​

RoleWalletResponsibility
AliceLSPPrepare BTC and matching RGB assets, provide liquidity as an LSP, set fees
BobUserHold BTC (or RGB to sell) and buy from / sell assets to the LSP

LSP (Lightning Service Provider) note: An LSP is the liquidity provider in RGB + Lightning Network. RGB uses client-side validation: asset state is maintained locally by the holder and cannot be custodied into a global contract pool, so liquidity can only be provided by independent nodes over their own Lightning channels. The LSP runs an rgbldkd node with funds always staying in its own channels; the platform only matches and routes, holding no assets; swaps settle atomically over Lightning — both sides succeed together or both roll back.

1. Prepare two wallets ​

As the LSP, Alice prepares BTC and matching RGB assets in her wallet and configures Swap fees and channel-rental fees.

Alice as LSP: prepare BTC and RGB, configure liquidity parameters

As the user, Bob's wallet needs enough BTC to buy (or RGB to sell for the Sell direction).

Bob as user: BTC balance ready to swap

2. Open / rent channels ​

Both sides need usable channels before a Swap. RGB Dex provides:

  • Auto-recommend: recommends the best LSP by fee, online status, and available liquidity;
  • Manual selection: pick a specific LSP directly;
  • Long-term rental: rent channels by the hour or day to avoid opening/closing a channel per trade and save on-chain Gas;
  • Follow RGB Lightning node upgrades: once nodes support JIT, channels open and close instantly on demand, and users no longer manage the lifecycle manually.

When renting for the Buy direction, Bob locks BTC to open a channel while the LSP injects RGB liquidity on the other side — the user does not need to hold the asset beforehand.

Rent a channel: request liquidity from an LSP, set capacity and duration

Once channels are established, you can inspect the BTC channel and BTC/RGB channel state. The LSP side holds most of the RGB liquidity; the user side holds BTC for payment. Channels must be READY / USABLE before swapping.

Channels ready: BTC and BTC/RGB channels Active

The product-side flow — get quote → confirm → wallet authorize — maps to the protocol-side offer → accept → execute, with both sides polling until Settled.

3. Buy: buy RGB with BTC ​

Select BUY on the TRADE panel and enter the RGB amount or sats to pay:

  1. Click Get Quote;
  2. Review unit price, total cost, slippage, price impact, and quote validity period;
  3. Click CONFIRM BUY;
  4. Review the atomic-swap details in the Stash Wallet extension and Authorize Swap.

Buy: fetch and confirm the quote

Buy: authorize the atomic swap in the wallet extension

Authorization only registers the swap on the local node; funds transfer only after both sides settle. Quotes have a countdown — if they expire, get a new quote.

4. Sell: sell RGB for BTC ​

Switch to SELL and enter the RGB amount to sell:

  1. Click Get Quote;
  2. Confirm expected sats received, fees, and slippage;
  3. Click CONFIRM SELL;
  4. Authorize Atomic Swap in the wallet extension.

Sell: fetch and confirm the sell quote

Sell: authorize in the wallet extension

The wallet popup shows the RGB amount sent, expected sats received, carrier fee, contract ID, and payment_hash; balances update after both sides settle.

5. Swap success and order history ​

After both sides settle, the page shows Swap Complete; the SWAP ORDERS list at the bottom immediately shows the record, including direction, RGB / BTC amounts, counterpart LSP, and Completed status.

Swap complete

Completed Buy / Sell records in SWAP ORDERS

The features below are not demos — they are real implementations. They are currently open to users in the invite testing program, and we iterate and optimize based on their real testing feedback.

II. What's next? ​

Below is Stash Labs' R&D roadmap for the second half of 2026. We will focus on application-layer product development, moving from "usable" to "good to use." Multiple product iterations have already completed 0-to-1 application-layer work, but honestly, there is still a long way to go before things are truly good to use. We will therefore focus on the following directions:

  1. Continuously upgrade RGB Lightning node — keep participating in node-side testing, actively report related issues, and commit to good communication and collaboration with ecosystem partners, resisting any harmful form of fork or split, and fostering a healthy ecosystem development environment. This is a patient, long-term commitment.
  2. Increase R&D investment in K8s-based cloud nodes — advance dynamic scaling of rgbldkd nodes developed by Bitlight Labs from millions toward tens of millions, to address potential large-scale applications in the future.
  3. Simplify RGB Dex operational flows — optimize the UI, remove unnecessary flows, and reduce user cognitive load so trading feels smoother and more fluid.
  4. Start Flash Dex development — Flash Dex carries Stash Labs' end vision for the BTC ecosystem: deliver spot and perpetual futures trading with an experience equivalent to Hyperliquid in the BTC ecosystem. The product's first phase will land as spot + order book.
  5. Open-source the Stash Wallet extension — Stash Wallet is a Chrome extension purpose-built for cloud node scenarios. We will provide an open-source version of the extension so that the extension itself is transparent and auditable (note: RGB Dex integration and mobile code remain commercially closed-source; whether they are open-sourced later depends on future development).
  6. Cloud nodes compatible with self-hosted — in the future, users will be allowed to download node data and import it into other open-source software (such as RGB-LDK-CONTROL-PANEL developed by Bitlight Labs), so they have final control over their own node data without depending on any single infrastructure service provider.

Trade and secure your RGB assets | Unlock the full potential of the RGB protocol