Utexo SDK

This is the underlying SDK used by RGB client applications. It provides a complete set of bindings for interacting with the RGB and managing RGB-based transfers.

With this SDK, developers can:

  • Generate RGB invoices

  • Create and manage UTXOs

  • Sign PSBTs using local private keys or hardware signing flows

  • Fetch asset balances, transfer status, and other RGB-related state

Capabilities of @utexo/rgb-sdk (via WalletManager)

The primary wallet class is UTEXOWallet: initialize with a mnemonic (or seed) and optional { network, dataDir }, then call await wallet.initialize() before use. It combines standard RGB operations with UTEXO features (Lightning, on-chain deposit/withdrawal).

Method / Function
Description

generateKeys(network?)

Generate new wallet keys (mnemonic, xpubs, master fingerprint) – top-level function

restoreUtxoWalletFromBackup({ backupPath, password, targetDir })

Restore UTEXO wallet from file backup (layer1 + utexo) – top-level function

restoreUtxoWalletFromVss({ mnemonic, targetDir, config?, vssServerUrl? })

Restore UTEXO wallet from VSS cloud backup – top-level function

deriveKeysFromMnemonic(network, mnemonic)

Derive wallet keys from existing mnemonic

deriveKeysFromSeed(network, seed)

Derive wallet keys from BIP39 seed

getAddress()

Get deposit address (async)

getBtcBalance()

Get on-chain BTC balance (async)

getXpub()

Get vanilla and colored xpubs

getNetwork()

Get current network

listUnspents()

List unspent UTXOs

listAssets()

List RGB assets held

getAssetBalance(assetId)

Get balance for a specific asset

createUtxos({ num?, size?, upTo? })

Create UTXOs (async; combines begin, sign, end; feeRate defaults to 1)

createUtxosBegin({ upTo?, num?, size? })

Start creating UTXOs (returns unsigned PSBT)

createUtxosEnd({ signedPsbt, skipSync? })

Finalize UTXO creation with signed PSBT

blindReceive({ assetId, amount, minConfirmations?, durationSeconds? })

Generate blinded UTXO for receiving

witnessReceive({ assetId, amount, minConfirmations?, durationSeconds? })

Generate witness UTXO for receiving

issueAssetNia({ ticker, name, amounts, precision })

Issue a new Non-Inflationary Asset

send({ invoice, assetId, amount, witnessData? })

Complete send (begin → sign → end; use witnessData for witness invoices; feeRate defaults to 1)

sendBegin({ invoice, assetId, amount, witnessData?, ... })

Prepare transfer (returns unsigned PSBT)

sendEnd({ signedPsbt, skipSync? })

Complete transfer with signed PSBT

signPsbt(psbt, mnemonic?)

Sign PSBT using wallet mnemonic (async)

refreshWallet()

Sync and refresh wallet state

syncWallet()

Trigger wallet sync

listTransactions()

List BTC-level transactions

listTransfers(assetId?)

List RGB transfer history for asset

failTransfers(params)

Mark waiting transfers as failed

createBackup({ backupPath, password })

Create encrypted backup (layer1 + utexo in one folder)

vssBackup(config?, mnemonic?)

Backup to VSS (config optional; built from mnemonic + default server URL)

vssBackupInfo(config?, mnemonic?)

Get VSS backup info

On-chain

onchainReceive(params)

Generate invoice for depositing from mainnet to UTEXO

onchainSendBegin(params)

Start on-chain withdraw (returns unsigned PSBT)

onchainSendEnd(params)

Finalize on-chain withdraw with signed PSBT

onchainSend(params, mnemonic?)

Complete on-chain withdraw (begin → sign → end)

getOnchainSendStatus(invoice)

Get status of on-chain withdraw

Lightning

createLightningInvoice(params)

Create Lightning invoice for receiving

payLightningInvoiceBegin(params)

Start Lightning payment (returns unsigned PSBT)

payLightningInvoiceEnd(params)

Finalize Lightning payment with signed PSBT

payLightningInvoice(params, mnemonic?)

Complete Lightning payment (begin → sign → end)

getLightningSendRequest(lnInvoice)

Get status of Lightning send

getLightningReceiveRequest(lnInvoice)

Get status of Lightning receive

listLightningPayments()

List Lightning payments

By using this SDK, developers have full control over:

  • Transfer orchestration

  • UTXO selection

  • Invoice lifecycle

  • Signing policy

This pattern enables advanced use cases, such as:

  • Integrating with third-party identity/auth layers

  • Applying custom fee logic or batching

  • Implementing compliance and audit tracking

Getting Started

Prerequisites

This SDK uses rgb-protocol libraries. All operations are performed locally.

Default Endpoints

The SDK uses default endpoints for RGB transport and Bitcoin indexing. These are automatically used if not specified:

Transport Endpoints (RGB protocol communication):

  • Mainnet: rpcs://rgb-proxy-mainnet.utexo.com/json-rpc

  • Testnet: rpcs://rgb-proxy-testnet3.utexo.com/json-rpc

  • Testnet4: rpcs://proxy.iriswallet.com/0.2/json-rpc

  • Signet: rpcs://rgb-proxy-utexo.utexo.com/json-rpc

  • Regtest: rpcs://proxy.iriswallet.com/0.2/json-rpc

Indexer URLs (Bitcoin blockchain data):

  • Mainnet: ssl://electrum.iriswallet.com:50003

  • Testnet: ssl://electrum.iriswallet.com:50013

  • Testnet4: ssl://electrum.iriswallet.com:50053

  • Signet: https://esplora-api.utexo.com

  • Regtest: tcp://regtest.thunderstack.org:50001

UTEXOWallet uses network (testnet / mainnet) that define indexer and transport endpoints internally.

Installation

Node.js only

This SDK is designed for Node.js and is not browser-compatible. Use it in Node.js applications, scripts, and backends.

Basic Usage

1

Generate wallet keys

2

Initialize wallet

3

Get a derived deposit address

4

Check balance

Core Workflows

Wallet Initialization

1

Generate keys and initialize

2

Restore from mnemonic

UTXO Management

1

Begin UTXO creation

2

Sign PSBT

3

Finalize UTXO creation

Asset Issuance

Asset Transfers

1

Create blind receive (receiver)

2

Begin transfer (sender builds PSBT)

3

Sign the PSBT

4

Finalize transfer

5

Alternative: Complete send in one call

6

Refresh wallets to sync transfer

Balance and Asset Management

Setup wallet and issue asset

1

Generate and initialize wallet

Security

Key Management

Full Examples

See examples/README.mdarrow-up-right for run commands. CLI: cli/arrow-up-right.

Last updated