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)
@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).
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-rpcTestnet:
rpcs://rgb-proxy-testnet3.utexo.com/json-rpcTestnet4:
rpcs://proxy.iriswallet.com/0.2/json-rpcSignet:
rpcs://rgb-proxy-utexo.utexo.com/json-rpcRegtest:
rpcs://proxy.iriswallet.com/0.2/json-rpc
Indexer URLs (Bitcoin blockchain data):
Mainnet:
ssl://electrum.iriswallet.com:50003Testnet:
ssl://electrum.iriswallet.com:50013Testnet4:
ssl://electrum.iriswallet.com:50053Signet:
https://esplora-api.utexo.comRegtest:
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
Core Workflows
Wallet Initialization
UTXO Management
Asset Issuance
Asset Transfers
Balance and Asset Management
Setup wallet and issue asset
Security
Key Management
Full Examples
new-wallet – Generate keys and create a new UTEXO wallet
read-wallet – Initialize by mnemonic and call getXpub, getNetwork, getAddress, getBtcBalance, listAssets
create-utxos-asset – Create UTXOs and issue a NIA asset
transfer – Two wallets: witness + blind receive, refresh, listTransfers (requires ASSET_ID and funded wallets)
onchain-flow – On-chain transfer: receive + send
lightning-flow – Lightning transfer: createLightningInvoice + payLightningInvoice
utexo-vss-backup-restore – VSS backup and restore
utexo-file-backup-restore – File backup and restore
See examples/README.md for run commands. CLI: cli/.
Last updated