This guide covers browser applications. For Node.js, see the Node.js guide. For iOS and Android, see the React Native guide.
Prerequisites
- A modern browser with WebAssembly support
- A bundler that supports WebAssembly, such as Vite
- Bitcoin test funds for transaction fees
- A separately initialized sender wallet that already holds the RGB asset for an end-to-end transfer
Step 1: Install the SDK
@utexo/wdk-rgb-lightning or @utexo/rgb-sdk-rn.
Step 2: Initialize the Wallet
Initialize the RLN WebAssembly module once, generate keys, then create and unlock the wallet.getPasswordFromSecureInput() represents an application-owned password prompt. Do not hard-code the password, log the mnemonic, or store either value unencrypted in localStorage.
Step 3: Fund the Wallet
Get a Bitcoin address and send signet BTC to it for transaction fees.Step 4: Create RGB UTXOs
num and size are integers. size is denominated in satoshis.
Step 5: Resolve the Asset From the Sender
listAssets() returns an object grouped by asset schema. This guide uses an NIA test asset, which is in the nia array and uses the assetId field.
USDT on Bitcoin from the Utexo Mint uses the BFA asset schema.
@utexo/rgb-sdk-web 1.0.0-beta.12 does not list BFA assets yet. To hold or move Mint USDT, use the React Native SDK, @utexo/wdk-rgb-lightning, or rgb-lib (see Mint and Burn Integration).assets.find(...).id pattern.
Step 6: Create a Receive Invoice
Run this on the receiver wallet initialized in Step 2:amount is an integer in asset base units. One displayed unit is 10 ** precision base units.
Step 7: Send From the Funded Wallet
The current Web API usesonchainSend(), not send().
UTEXOWallet with sufficient signet BTC and a spendable balance of the asset.
Step 8: Refresh and Verify
Lightning Payments
Lightning requires usable peer and channel state in addition to an initialized wallet. For a BTC-only invoice, omit theasset field.
asset: { assetId, amount } when creating the invoice. Do not pass an empty asset object for a BTC-only invoice.
Web-Specific Notes
- Call
initRlnWasm()before constructing a wallet. - Persist wallet state and secrets according to the SDK’s backup guidance. Clearing site data can remove local wallet state.
- Use HTTPS in production so browser storage and secure-context APIs are available.
- Endpoint defaults are resolved by the
utexonetwork profile. Override them only when operating compatible infrastructure.
Troubleshooting
Implementation References
- Web wallet implementation
- Web network defaults
- Shared wallet models
- Shared on-chain transfer interface