Skip to main content
The @utexo/rgb-sdk-web package is the browser SDK for the Utexo stack. All operations run locally via WebAssembly — no server, no Node.js, no native binaries required. Wallet state persists to IndexedDB automatically and survives page refresh.
This SDK is designed for browser environments only. It is not compatible with Node.js (use @utexo/rgb-sdk) or React Native (use @utexo/rgb-sdk-rn).Lightning support is not yet available in the Web SDK. It will be included in the next major release.

Requirements

  • Modern browser: Chrome, Firefox, Safari, Edge
  • ESM-only bundler: Vite, Webpack 5, Rollup, or esbuild — CommonJS is not supported
  • No backend or server required

Installation

Initialisation

The primary class is UTEXOWallet. WASM initialises automatically inside the static create() factory — no manual initWasm() call needed.

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.

Storage

Unlike the Node.js SDK, there is no dataDir option. The browser SDK persists wallet state to IndexedDB automatically. State survives page refresh and browser restarts without any additional configuration.

Vanilla vs Colored Addresses

The SDK operates two separate derivation paths, consistent with the Node.js and React Native SDKs:
  • 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.

Address Rotation

By default, getAddress() rotates to a new derivation index on each call. To disable rotation and return the same address every time, pass reuseAddresses: true in the config. You can also rotate manually:
  • rotateVanillaAddress() — advance the vanilla address index
  • rotateColoredAddress() — advance the colored address index

Wallet Methods

Key Generation

  • generateKeys(network?) — Generate new wallet keys. Returns mnemonic, xpub, accountXpubVanilla, accountXpubColored.
  • deriveKeysFromMnemonic(network, mnemonic) — Derive keys from an existing BIP39 mnemonic.

Wallet State

Call syncWallet() after funding or UTXO creation to update chain state. Call refreshWallet() after send() to update RGB transfer status on both sender and receiver sides.

UTXO Management

Before issuing or receiving RGB assets, colored UTXOs must be created. Call createUtxos() after funding the vanilla address:
  • createUtxos({ num?, size?, upTo? }) — Create colored UTXOs. Handles begin, sign, and end internally.

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 minimum amountSat) in send().

Sending Assets

  • send({ invoice, assetId, amount, witnessData? }) — Complete an RGB transfer (begin → sign → end)
  • sendBtc({ address, amount, feeRate? }) — On-chain BTC send with PSBT signing

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

Pushes wallet state to a remote Verifiable Secret Sharing server. Requires vssServerUrl in the wallet config.

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. For hardware wallet or external signer support, use the manual begin/end send flow:
The same begin/end pattern applies to UTXO creation (createUtxosBegin / createUtxosEnd) and BTC sends.
Store mnemonics securely and never log or transmit them. In browser environments, use the Web Crypto API or a secure vault rather than localStorage.

Further Reading

  • SDK Overview — SDK family, key concepts, and execution model.
  • Node.js SDK — Server-side SDK with the same core API surface.
  • Architecture — The Bitcoin + RGB stack the SDK operates on.