Run from repo root after npm run build.
new-wallet.mjs– Generate new keys and create a UTEXOWallet.- Calls
generateKeys(network)to get a new mnemonic, thennew UTEXOWallet(mnemonic, { network }),initialize(), and prints address + balance. - Reminds to back up the mnemonic.
- Calls
node examples/new-wallet.mjscreate-utxos-asset.mjs– Create UTXOs and issue a NIA asset.- Calls
createUtxos({ num, size })thenissueAssetNia({ ticker, name, amounts, precision }). - Only
MNEMONICcan be passed (env); createUtxos and NIA params are fixed in script. Requires indexer/network.
- Calls
node examples/create-utxos-asset.mjs
MNEMONIC="your mnemonic" node examples/create-utxos-asset.mjsread-wallet.mjs– Initialize by mnemonic and call read-only functions.- getXpub, getNetwork, getAddress (no indexer); getBtcBalance, listAssets (require indexer).
- Set
MNEMONICenv to use your own wallet.
node examples/read-wallet.mjs
MNEMONIC="your mnemonic" node examples/read-wallet.mjstransfer.mjs– Two wallets (2 mnemonics): 1 witness receive + 1 blind receive, refresh, listTransfers. Assumes UTXOs and asset already exist (e.g. from create-utxos-asset.mjs); wallets must be funded.- Env:
ASSET_ID(required),MNEMONIC_A,MNEMONIC_B(optional). Requires indexer/network.
- Env:
ASSET_ID="rgb:..." node examples/transfer.mjs
ASSET_ID="rgb:..." MNEMONIC_A="..." MNEMONIC_B="..." node examples/transfer.mjsonchain-flow.mjs– Two wallets (2 mnemonics): Wallet B callsonchainReceiveto obtain a mainnet invoice; Wallet A callsonchainSendto pay that invoice from UTEXO.- Env:
ASSET_ID(required),MNEMONIC_A,MNEMONIC_B(optional),AMOUNT(optional; default 10). Requires bridge backend + indexer/network.
- Env:
MNEMONIC_A="..." MNEMONIC_B="..." ASSET_ID="rgb:..." AMOUNT=10 node examples/onchain-flow.mjslightning-flow.mjs– Two wallets (2 mnemonics): Wallet B callscreateLightningInvoiceto obtain a Lightning invoice; Wallet A callspayLightningInvoiceto pay that invoice from UTEXO. For external Lightning invoices, setLN_INVOICEenv.- Env:
ASSET_ID(required),MNEMONIC_A,MNEMONIC_B(optional),AMOUNT(optional; default 10),LN_INVOICE(optional; external LN invoice to pay). Requires bridge backend + indexer/network.
- Env:
MNEMONIC_A="..." MNEMONIC_B="..." ASSET_ID="rgb:..." AMOUNT=10 node examples/lightning-flow.mjs
LN_INVOICE="lnbc..." MNEMONIC_A="..." ASSET_ID="rgb:..." AMOUNT=10 node examples/lightning-flow.mjsutexo-vss-backup-restore.mjs– VSS only (no file backup).- Backup: wallet with
vssServerUrl→vssBackup()/vssBackupInfo(). - Restore:
restoreUtxoWalletFromVss({ mnemonic, targetDir, vssServerUrl })→ wallet withdataDir. - Toggle: set
runRestore = trueto run restore instead of backup.
- Backup: wallet with
node examples/utexo-vss-backup-restore.mjsutexo-file-backup-restore.mjs– Regular file backup only (no VSS).- Backup: wallet →
createBackup({ backupPath, password })(one folder:wallet_<fp>_layer1.backup,wallet_<fp>_utexo.backup). - Restore:
restoreUtxoWalletFromBackup({ backupPath, password, targetDir })→ wallet withdataDir. - Toggle: set
runRestore = trueto run restore instead of backup.
- Backup: wallet →
node examples/utexo-file-backup-restore.mjs