@utexo/rgb-sdk-web package is the browser SDK for the Utexo stack. All operations run locally via an RGB Lightning Node (RLN) compiled to WebAssembly — no RGB server, no Node.js, no native binaries. UTEXOWallet mirrors the React Native SDK surface, so app code ports across web ↔ mobile with minimal change.
What You Can Do
- Run a full Lightning node in the browser via the RLN WASM SDK
- Open Lightning channels and send/receive BTC or RGB asset payments
- LSP integration: receive RGB via Lightning, send RGB to on-chain recipients, Lightning Address
- Async payments (APay): hash pool + Lightning Address via utexo-lsp
- Issue, transfer, and manage RGB assets (NIA, IFA, CFA)
- Manage UTXOs and BTC on-chain sends — atomic (
sendBtc) or 3-step begin → sign → end for external signers - Encrypted file backup (raw bytes, browser-download friendly) and VSS cloud backup
- HODL invoices: create, claim, cancel
Requirements
- Modern browser with WebAssembly and top-level
awaitsupport: Chrome, Firefox, Safari, Edge - ESM-only bundler: Vite, Webpack 5, Rollup, or esbuild — CommonJS is not supported
- At create time: an Esplora indexer, an RGB proxy (transport) endpoint, and — for Lightning — a WebSocket LN gateway. Known networks get defaults — see Default endpoints
Installation
Bundler setup (Vite)
The WASM module initialises asynchronously; exclude the package from Vite’s dependency pre-bundling and enable WASM + top-level-await support:Initialisation
The primary class isUTEXOWallet. The constructor is sync and cheap (params are only stored); init() does all local WASM work and returns the wallet LOCKED; unlock() brings it online.
init() and unlock() are idempotent and retryable after a thrown failure; unlock() throws unless init() ran first. Wallet/network methods throw until unlock() resolves. UTEXOWallet.create(params) is a one-call convenience for constructor + init() + unlock(). initialize() is an alias for that sequence.
UTEXOWalletCreateParams
Lifecycle
Theinit → unlock gap is the explicit VSS-restore window:
new UTEXOWallet(params)+await wallet.init()— loads WASM, derives keys, creates the wallet from local storage, creates the Lightning node handle (whenproxyUrlresolves), and configures VSS. The wallet is LOCKED: wallet/network ops throw; key reads (getXpub,getNodePubkey) and VSS restore APIs work.- Optional:
await wallet.restoreFromVss({ takeoverFence? })— explicit cloud restore on a new device. Restore is never automatic. await wallet.unlock()— validates the password, configures LDK/channel VSS replication, and auto-connects to the indexer non-fatally.isOnline()/goOnline(indexerUrl)— check the connection; retry when offline.goOnlineis idempotent.dispose()— release the WASM wallet/node handles. Check withisDisposed().
Networks
Utexo Network Faucet — To get test BTC and RGB assets on the Utexo network, use the Telegram bot @Utexo_RLN_bot.
Limited to 2 requests per 24 hours per user.
Default Endpoints
Used automatically when the corresponding create param is omitted (DEFAULT_RLN_URLS):
On networks without a
proxyUrl default, pass one explicitly to enable the Lightning node; without it the wallet is on-chain RGB only.
Vanilla vs Colored Addresses
The SDK operates two separate derivation paths, consistent with the React Native SDK:- Vanilla — standard Bitcoin derivation path for BTC receives, fee payments, and on-chain withdrawals.
getAddress()returns a vanilla bech32 receive address. - Colored — RGB-specific derivation path. Used internally when creating UTXOs for RGB asset allocations.
getBtcBalance() returns separate balances for each path, each with settled, future, and spendable fields. getXpub() returns { xpubVan, xpubCol }.
Wallet Methods
Key Generation
generateKeys(network?)— Generate new wallet keys. Returnsmnemonic, xpubs, and master fingerprint.restoreKeys(network, mnemonic)/deriveKeysFromMnemonic/deriveKeysFromSeed— Derive keys from existing material.initRlnWasm()— Explicit WASM init (singleton —create()calls it automatically).
Wallet State
Call
syncWallet() after funding or UTXO creation to update chain state. Call refreshWallet() after onchainSend() to update RGB transfer status on both sender and receiver sides.UTXO Management
Before issuing or receiving RGB assets, colored UTXOs must be created. CallcreateUtxos() after funding the vanilla address:
RGB Asset Methods
Issuing Assets
Receiving Assets
RGB receive flows support two invoice styles:- Blinded invoice — most common. The receiver creates a blinded endpoint; the sender pays directly.
- Witness invoice — the receiver binds the transfer to witness data. The sender must provide
witnessData(at minimumamountSat) inonchainSend().
onchainReceive() is the single entry point. Witness invoices are the default; pass witness: false for a blinded invoice. blindReceive() and witnessReceive() remain available as the underlying primitives.
Sending Assets
Lightning Methods
Lightning requires a resolvedproxyUrl (set or defaulted, e.g. utexo) and usable peer/channel state.
openChannel both opens and funds the channel, then returns once the funding tx is submitted — poll listChannels() until isUsable.
asset field and pass amountSats.
LSP & Async Payments (APay)
See the LSP guide and async payments guide in the package repo for composed
UtexoLsp flows.
Backup and Restore
Backups are recommended after every significant state change: UTXO creation, asset issuance, and transfers.File Backup
Creates an encrypted backup as raw bytes. Store or download the bytes — there is no file path in the browser.VSS Backup
VSS keeps an encrypted remote copy of the wallet (RGB assets, stock, BDK state) and the node’s LDK/channel state. Identity is derived from the mnemonic atinit(); the server defaults to DEFAULT_VSS_SERVER_URL. Backup is automatic during normal operation.
Security
The browser SDK is fully non-custodial. Private keys and mnemonics are never transmitted to remote servers. WASM runs in the browser’s sandboxed environment. VSS values are encrypted client-side. For hardware wallet or external signer support, use the manual begin/end send flow:createUtxosBegin / createUtxosEnd) and BTC sends (sendBtcBegin / sendBtcEnd).
Demo App
A full working demo is available at rgb-sdk-web-sandbox. It covers theUTEXOWallet lifecycle, Lightning, LSP/APay, and file + VSS backup.
Further Reading
- SDK Overview — SDK family, key concepts, and execution model.
- wdk-rgb-lightning — Node.js / Bare WDK module for RGB Lightning.
- React Native SDK — On-device RLN for iOS and Android.
- Architecture — The Bitcoin + RGB stack the SDK operates on.
- rgb-sdk-web README