RGB 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 rgb-sdk (via WalletManager)

Method
Description

generateKeys(network)

Generate new wallet keypair with mnemonic/xpub/xpriv/master fingerprint

deriveKeysFromMnemonic(network, mnemonic)

Derive wallet keys (xpub/xpriv) from existing mnemonic

deriveKeysFromSeed(network, seed)

Derive wallet keys (xpub/xpriv) directly from a BIP39 seed

registerWallet()

Register wallet with the RGB Node

getBtcBalance()

Get on-chain BTC balance

getAddress()

Get a derived deposit address

listUnspents()

List unspent UTXOs

listAssets()

List RGB assets held

getAssetBalance(asset_id)

Get balance for a specific asset

createUtxosBegin({ up_to, num, size, fee_rate })

Start creating new UTXOs

createUtxosEnd({ signed_psbt })

Finalize UTXO creation with a signed PSBT

blindReceive({ asset_id, amount })

Generate blinded UTXO for receiving

witnessReceive({ asset_id, amount })

Generate witness UTXO for receiving

issueAssetNia({...})

Issue a new Non-Inflationary Asset

signPsbt(psbt, mnemonic?)

Sign PSBT using mnemonic and BDK (async)

signMessage(message, options?)

Produce a Schnorr signature for an arbitrary message

verifyMessage(message, signature, options?)

Verify Schnorr message signatures using wallet keys or provided public key

refreshWallet()

Sync and refresh wallet state

syncWallet()

Trigger wallet sync without additional refresh logic

listTransactions()

List BTC-level transactions

listTransfers(asset_id)

List RGB transfer history for asset

failTransfers(...)

Mark expired transfers as failed

sendBegin(...)

Prepare a transfer (build unsigned PSBT)

sendEnd(...)

Submit signed PSBT to complete transfer

send(...)

Complete send operation: begin → sign → end

createBackup(password)

Create an encrypted wallet backup

downloadBackup(backupId?)

Download the generated backup binary

restoreFromBackup({ backup, password, ... })

Restore wallet state from a backup file

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

Installation

Important: WASM Module Support

This SDK uses WebAssembly modules for cryptographic operations. When running scripts, you may need to use the --experimental-wasm-modules flag:

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

2

Register wallet and fund for fees

3

Create UTXOs

4

Issue asset and list balances

Security

Key Management

Full Examples

For complete working examples demonstrating all features, see:

Last updated