This guide covers React Native (iOS & Android) usage. For server-side Node.js see the Node.js guide, and for browser apps see the Web guide. For concepts shared across all guides, see the Quickstart Overview.
Prerequisites
- React Native 0.71 or later with a working iOS or Android build environment
- Node.js v18 or later for the development toolchain
- A testnet BTC balance for transaction fees (see Quickstart Overview for faucet links)
- Basic familiarity with React Native and async/await
Step 1: Install the SDK
@utexo/rgb-sdk-rn package targets iOS and Android via React Native. It uses the device’s secure storage and native crypto bindings — it is not compatible with Node.js or browser environments. For those, use @utexo/rgb-sdk or @utexo/rgb-sdk-web respectively.
All three Utexo SDK packages (
@utexo/rgb-sdk, @utexo/rgb-sdk-rn, @utexo/rgb-sdk-web) share the same UTEXOWallet class and method API via @utexo/rgb-sdk-core. The steps below are identical in structure to the Node.js guide — only the import and storage model differ.Step 2: Generate Wallet Keys
Generate a BIP-39 mnemonic. Store it using your app’s secure storage solution (e.g.react-native-keychain or expo-secure-store) — never store mnemonics in plain AsyncStorage or source control.
Step 3: Initialise the Wallet
Create and initialise aUTEXOWallet instance. On React Native, dataDir points to a path within the app’s document directory.
initialize() performs the initial sync with the Bitcoin indexer and RGB transport layer. Run this once at app startup after restoring or creating the wallet. This may take a few seconds on first run.
Step 4: Get a Deposit Address
Step 5: Create UTXOs
RGB asset state must be anchored to Bitcoin UTXOs. Before a user can receive any RGB asset, the wallet needs dedicated UTXOs prepared.Step 6: Get the USDT on Bitcoin Asset ID
Step 7: Generate an RGB Invoice (Receiver Side)
Step 8: Send an RGB Asset (Sender Side)
amount and assetId in the send() call must exactly match those in the invoice. Mismatches will cause the transfer to be rejected by the receiver’s client-side validator.
Step 9: Verify the Transfer
100 for the USDT asset. RGB transfers require Bitcoin confirmation to finalise. If the transfer is still pending, call refreshWallet() again after the next Bitcoin block. On testnet, a new block typically arrives every 1–10 minutes.
Step 10: Create and Pay a Lightning Invoice
Lightning payments require an open channel between your wallet and the node. UseopenChannel() to request a channel, then verify it is active with listChannels() before sending or receiving.
Channel opening is an on-chain Bitcoin transaction and requires a confirmed BTC balance. Allow 1–3 confirmations before the channel becomes usable. On testnet a new block arrives every 1–10 minutes.
asset.assetId to the asset ID and asset.amount to the RGB amount on the invoice.
Step 11: On-Chain Receive and Send
The same wallet handles on-chain Bitcoin addresses and RGB on-chain transfers.getAddress() returns a standard Bitcoin address for on-chain funding. blindReceive() returns an RGB blinded invoice for asset transfers. Both work the same way on iOS and Android.React Native-Specific Notes
Storage. The wallet database is written to the app’s document directory. UseRNFS.DocumentDirectoryPath or expo-file-system’s documentDirectory to construct the dataDir path. Do not use temporary or cache directories — the wallet state must persist across app restarts.
Background execution. RGB transport and Bitcoin indexer calls require network access. Ensure your app has the necessary permissions and that the device is online when calling initialize(), createUtxos(), send(), and refreshWallet().
Mnemonic storage. Use react-native-keychain or expo-secure-store to persist the mnemonic in the platform’s secure enclave. Never store it in AsyncStorage, Redux state, or any unencrypted local store.
Troubleshooting
If you encounter an issue not listed here, join the Utexo Discord for community support.
Next Steps
- SDK Reference — Full method reference for
UTEXOWallet, including backup and restore - Architecture — Understand how Bitcoin, Lightning, and RGB fit together
- Glossary — Definitions for RGB, PSBT, blinded invoice, UTXO, and other key terms