Beta notice: This package is currently in beta. Please test thoroughly in development environments before using in production.
Accept RGB asset payments (tokens, stablecoins) in BTCPay Server.
- Accept RGB20 token payments alongside Bitcoin
- Issue new RGB assets directly from BTCPay
- Two-step invoice settlement (Processing → Settled) matching BTCPay's native Bitcoin flow
- Full UTXO management for RGB allocations
- BTC transaction history for wallet operations
- Configurable minimum confirmations for payment settlement
- Native rgb-lib integration (no external RGB Node required)
- Secure local PSBT signing (mnemonic never leaves .NET)
- Go to your BTCPay Server Settings → Plugins
- Search for "RGB Payments"
- Click Install
- Restart BTCPay Server
- Download the latest release from the Plugin Builder
- Extract to your BTCPay Server plugins directory
- Restart BTCPay Server
# Electrum server for blockchain data
RGB_ELECTRUM_URL=ssl://electrum.blockstream.info:60002
# Directory for RGB wallet data (default: <btcpay-data-dir>/<network>/rgb-wallets)
RGB_DATA_DIR=/data/rgb-wallets
# RGB proxy endpoint for consignment exchange
RGB_PROXY_ENDPOINT=rpc://proxy.iriswallet.com:443/json-rpcAlternatively, create rgb.json in your BTCPay Server data directory:
{
"network": "mainnet",
"electrum_url": "ssl://electrum.blockstream.info:60002",
"rgb_data_dir": "/data/rgb-wallets",
"proxy_endpoint": "rpc://proxy.iriswallet.com:443/json-rpc"
}| Network | Default Electrum URL | Proxy Endpoint |
|---|---|---|
| Mainnet | ssl://electrum.blockstream.info:60002 | rpc://proxy.iriswallet.com:443/json-rpc |
| Testnet | ssl://electrum.blockstream.info:60002 | rpc://proxy.iriswallet.com:443/json-rpc |
| Regtest | tcp://127.0.0.1:50001 (local electrs) | rpc://regtest.thunderstack.org:3000/json-rpc |
- Open your BTCPay Server store
- In the left sidebar, click RGB Wallet
- You will land on the Setup page
- Enter a wallet name (e.g. "My RGB Wallet")
- Select the network (Mainnet, Testnet, or Regtest)
- Click Create Wallet
The plugin generates a new wallet with two keypairs: one for regular BTC transactions and one for RGB (colored) operations. The mnemonic is encrypted and stored securely within BTCPay.
RGB operations require on-chain Bitcoin for transaction fees and UTXO creation.
- On the RGB Wallet dashboard, copy the wallet address shown in the "Wallet Address" card
- Send a small amount of BTC to this address (0.01 BTC is enough for regtest/testnet)
- Wait for the transaction to confirm (30+ blocks on regtest)
- Click the Refresh button on the dashboard to update balances
You should see your BTC balance update in the "BTC Balance" card.
RGB assets are stored on special "colorable" UTXOs. You need to create them before you can receive any RGB payments.
- On the dashboard, click Manage UTXOs (or navigate to UTXOs in the sidebar)
- Click the Create UTXOs button
- Wait for the transaction to confirm (30+ blocks on regtest)
- Go back to the dashboard and click Refresh
The "Colorable UTXOs" card on the dashboard should now show a non-zero count. Each UTXO can hold multiple RGB allocations.
If you want to create your own token:
- On the dashboard, click Issue New Asset (or navigate to Assets → Issue New Asset)
- Fill in the form:
- Ticker — Short symbol, 2-8 characters (e.g. "USDT", "TOKEN")
- Name — Full name of the asset (e.g. "My Stablecoin")
- Amount — Total supply to issue
- Precision — Decimal places (0 = integer tokens, 2 = cents, 8 = like satoshis)
- Click Issue Asset
The new asset will appear on your Assets page and in the dashboard.
- Navigate to Settings (gear icon on the dashboard, or sidebar)
- Under Payment Configuration:
- Accepted Asset — Select which RGB asset customers must pay with
- Accept any RGB asset — Check this to accept any RGB asset (not recommended for production)
- Under UTXO Settings (optional):
- UTXO Count — How many colorable UTXOs to create at once (default: 4)
- UTXO Size — Size of each UTXO in satoshis (default: 1000)
- Max Allocations per UTXO — How many RGB allocations per UTXO (default: 10)
- Under Settlement:
- Min Confirmations — Number of blockchain confirmations required before marking a payment as settled (default: 1)
- Click Save Payment Settings
Once configured, RGB will appear as a payment method on your invoices:
- Create an invoice in BTCPay (via UI or API)
- On the checkout page, the customer will see an RGB payment option
- The customer copies the RGB invoice string (starts with
rgb:) - The customer pays using any RGB-compatible wallet (e.g. Iris Wallet, BitMask)
- The invoice will transition through these states:
- New — Waiting for payment
- Processing — Payment detected, waiting for blockchain confirmations
- Settled — Payment fully confirmed
- Dashboard — Overview of BTC balance, colored balance, UTXO count, and asset list
- Transfers — View all incoming and outgoing RGB transfers with status (Pending → Settled)
- BTC Transactions — View on-chain Bitcoin transactions (UTXO creation, RGB sends, etc.)
- UTXOs — See which UTXOs hold RGB allocations and which are available
- Go to Settings → scroll to Danger Zone
- Click Delete Wallet
- Confirm the action
This removes the wallet from BTCPay (DB records, assets, invoices) but leaves the wallet data directory on disk for backup purposes.
The plugin follows BTCPay's native two-step payment lifecycle:
Customer pays
│
▼
RGB transfer detected (status: WaitingConfirmations)
│
▼
BTCPay invoice → Processing
│
▼ (blockchain confirmations reach threshold)
│
RGB transfer confirmed (status: Settled)
│
▼
BTCPay invoice → Settled
The plugin polls for transfer updates every 10 seconds. The number of confirmations required is configurable in Settings (default: 1).
- .NET 8.0 SDK
- BTCPay Server source (as submodule)
git clone --recursive https://github.com/UTEXO-Protocol/rgb-btcpay-plugin
cd rgb-btcpay-plugin
dotnet buildThis plugin is designed for the BTCPay Plugin Builder:
- Fork this repository
- Register at https://plugin-builder.btcpayserver.org
- Add your repository
- Plugin Builder will build and publish automatically
BTCPayServer.Plugins.RgbUtexo/
├── Controllers/ # MVC controllers
├── Data/ # EF Core entities & migrations
├── Models/ # View models
├── PaymentHandler/ # BTCPay payment integration
├── Services/
│ ├── RgbLibService.cs # rgb-lib P/Invoke wrapper
│ ├── RgbLibWalletHandle.cs # Wallet lifecycle management
│ ├── RGBWalletService.cs # Wallet business logic
│ ├── MemoryWalletSigner.cs # Local PSBT signing (NBitcoin)
│ ├── RgbWalletSignerProvider.cs # Signer management
│ ├── MnemonicProtectionService.cs # Mnemonic encryption
│ └── RGBInvoiceListener.cs # Payment detection & settlement
└── Views/ # Razor views
┌─────────────────────────────────────────────────────────────────┐
│ rgb-lib-c-sharp (watch-only) │
│ │
│ Initialized with pubkey only (NO mnemonic!) │
│ │
│ • blind_receive() → RGB invoice │
│ • send_begin() → unsigned PSBT │
│ • create_utxos_begin() → unsigned PSBT │
│ • list_assets() → asset list │
└─────────────────────────────────────────────────────────────────┘
│
▼ Unsigned PSBT
┌─────────────────────────────────────────────────────────────────┐
│ MemoryWalletSigner (C# / .NET) │
│ │
│ Mnemonic stored ONLY here (encrypted at rest) │
│ SignPsbtAsync() → signed PSBT │
└─────────────────────────────────────────────────────────────────┘
│
▼ Signed PSBT
┌─────────────────────────────────────────────────────────────────┐
│ rgb-lib-c-sharp │
│ │
│ • send_end() → broadcast RGB transfer │
│ • create_utxos_end() → broadcast UTXO creation │
└─────────────────────────────────────────────────────────────────┘
Key principle: Mnemonic NEVER leaves C# code to native Rust.
- RgbLib v0.3.0-beta.9 - Native rgb-lib bindings
- NBitcoin - Bitcoin primitives and PSBT signing
- Npgsql.EntityFrameworkCore.PostgreSQL - Database persistence
Create more colorable UTXOs: go to RGB Wallet → UTXOs → Create UTXOs.
The wallet has the asset but no spendable balance on colorable UTXOs. Create new UTXOs and wait for confirmations.
The blockchain hasn't reached the required number of confirmations yet. Wait for more blocks to be mined, or reduce Min Confirmations in Settings.
- Check Electrum connection: Settings → Test Connection
- Ensure blocks are being mined (relevant for regtest/testnet)
- Click Refresh on the RGB Wallet dashboard to trigger a manual sync
Check BTCPay logs for errors:
docker logs btcpayIf the plugin was auto-disabled after a crash, delete the disable command:
rm ~/.btcpayserver/Plugins/commandsThen restart BTCPay Server.
Verify your Electrum server is reachable. Check RGB_ELECTRUM_URL environment variable or rgb.json configuration.
| Platform | Status |
|---|---|
| Linux x64 | Supported |
| macOS ARM64 (Apple Silicon) | Supported |
| macOS x64 (Intel) | Not supported (native library not included) |
| Windows | Not supported (native library not included) |
MIT License - See LICENSE file
- GitHub Issues: Create Issue
- BTCPay Server Community: https://chat.btcpayserver.org