### Install and Start RGB Lightning Node Source: https://context7.com/rgb-tools/rgb-lightning-node/llms.txt Instructions for installing the RLN from source and starting the daemon. Includes options for development (authentication disabled) and production (with Biscuit token authentication). ```bash git clone https://github.com/RGB-Tools/rgb-lightning-node --recurse-submodules --shallow-submodules cargo install --locked --path . ``` ```bash ./regtest.sh start ``` ```bash rgb-lightning-node dataldk0/ \ --daemon-listening-port 3001 \ --ldk-peer-listening-port 9735 \ --network regtest \ --disable-authentication ``` ```bash rgb-lightning-node dataldk0/ \ --daemon-listening-port 3001 \ --ldk-peer-listening-port 9735 \ --network regtest \ --root-public-key ``` ```bash docker run --rm -it \ -p 3001:3001 \ -v RLNdata1:/RLNdata \ --network rgb-lightning-node_default \ rgb-lightning-node \ --daemon-listening-port 3001 \ --ldk-peer-listening-port 9735 \ --network regtest \ --disable-authentication \ RLNdata ``` -------------------------------- ### Start Testnet3 Node Instance 1 Source: https://github.com/rgb-tools/rgb-lightning-node/blob/master/README.md Start the first testnet3 node instance. This configuration uses public testnet3 services and does not require local docker services. ```sh rgb-lightning-node dataldk0/ --daemon-listening-port 3001 \ --ldk-peer-listening-port 9735 --network testnet \ --disable-authentication ``` -------------------------------- ### Install RGB Lightning Node Binary Source: https://github.com/rgb-tools/rgb-lightning-node/blob/master/README.md Install the rgb-lightning-node binary from the project root using cargo. ```sh cargo install --locked --path . ``` -------------------------------- ### Start RGB Lightning Node for Testnet3 Source: https://github.com/rgb-tools/rgb-lightning-node/blob/master/README.md Starts an RGB Lightning Node in daemon mode for testnet3. Configure listening ports, network, and disable authentication. ```bash rgb-lightning-node dataldk1/ --daemon-listening-port 3002 \ --ldk-peer-listening-port 9736 --network testnet \ --disable-authentication ``` ```bash rgb-lightning-node dataldk2/ --daemon-listening-port 3003 \ --ldk-peer-listening-port 9737 --network testnet \ --disable-authentication ``` -------------------------------- ### Start Regtest Node Instance 2 Source: https://github.com/rgb-tools/rgb-lightning-node/blob/master/README.md Start the second regtest node instance. Similar to the first, but with a different data directory and listening port. ```sh rgb-lightning-node dataldk1/ --daemon-listening-port 3002 \ --ldk-peer-listening-port 9736 --network regtest \ --disable-authentication ``` -------------------------------- ### Install Biscuit CLI Source: https://context7.com/rgb-tools/rgb-lightning-node/llms.txt Installs the Biscuit command-line interface tool, which is used for generating and managing Biscuit tokens for authentication. ```bash # Install the biscuit CLI cargo install biscuit-cli ``` -------------------------------- ### Start Regtest Services Source: https://context7.com/rgb-tools/rgb-lightning-node/llms.txt Starts the necessary services for the regtest environment, which is used for integration testing of the RGB Lightning Node. ```bash # Start regtest services ./regtest.sh start ``` -------------------------------- ### Issue Asset Example Source: https://github.com/rgb-tools/rgb-lightning-node/blob/master/README.md Example of how to issue a new asset using the `/issueasset` endpoint. ```APIDOC ## POST /issueasset ### Description Issues a new fungible asset. ### Method POST ### Endpoint /issueasset ### Request Body - **ticker** (string) - Required - The ticker symbol for the asset. - **name** (string) - Required - The full name of the asset. - **amounts** (array of numbers) - Required - The amounts to issue. - **precision** (number) - Required - The precision of the asset. ### Request Example ```json { "ticker": "USDT", "name": "Tether", "amounts": [666], "precision": 0 } ``` ### Response #### Success Response (200) - **result** (string) - Description of the result. #### Response Example ```json { "result": "success" } ``` ``` -------------------------------- ### Start Regtest Services Source: https://github.com/rgb-tools/rgb-lightning-node/blob/master/README.md Start the required services (bitcoind, indexer, RGB proxy) for the regtest network. This command also creates necessary directories and mines initial blocks. ```sh ./regtest.sh start ``` -------------------------------- ### Start Regtest Node Instance 1 Source: https://github.com/rgb-tools/rgb-lightning-node/blob/master/README.md Start the first regtest node instance. Requires bitcoind, indexer, and RGB proxy services to be running. This command specifies data directory, listening ports, network, and disables authentication. ```sh rgb-lightning-node dataldk0/ --daemon-listening-port 3001 \ --ldk-peer-listening-port 9735 --network regtest \ --disable-authentication ``` -------------------------------- ### Start Regtest Node Instance 3 Source: https://github.com/rgb-tools/rgb-lightning-node/blob/master/README.md Start the third regtest node instance. Similar to the others, with unique data directory and listening port. ```sh rgb-lightning-node dataldk2/ --daemon-listening-port 3003 \ --ldk-peer-listening-port 9737 --network regtest \ --disable-authentication ``` -------------------------------- ### Start RGB Lightning Node with Public Key Source: https://context7.com/rgb-tools/rgb-lightning-node/llms.txt Starts the RGB Lightning Node daemon, configuring it with a listening port and network, and crucially, providing the public key derived from a Biscuit keypair for authentication purposes. ```bash # Save private key and start the node with the public key biscuit keypair --only-private-key > private-key-file PUB_KEY=$(biscuit keypair --from-file private-key-file --only-public-key) rgb-lightning-node dataldk0/ \ --daemon-listening-port 3001 \ --ldk-peer-listening-port 9735 \ --network regtest \ --root-public-key "$PUB_KEY" ``` -------------------------------- ### Start RGB Lightning Node for Testnet4 Source: https://github.com/rgb-tools/rgb-lightning-node/blob/master/README.md Starts an RGB Lightning Node in daemon mode for testnet4. Use the same options as testnet3 but specify `--network testnet4` and adjust the bitcoind RPC port and indexer URL. ```bash rgb-lightning-node dataldk1/ --daemon-listening-port 3002 \ --ldk-peer-listening-port 9736 --network testnet4 \ --disable-authentication ``` -------------------------------- ### Install and Use Biscuit CLI for Authentication Source: https://github.com/rgb-tools/rgb-lightning-node/blob/master/README.md Installs the Biscuit CLI using cargo and generates a root keypair for API authentication. The private key should be stored securely. ```sh # install the biscuit CLI (or download a prebuilt binary from the Biscuit releases page) cargo install biscuit-cli # generate a root keypair (prints both keys) biscuit keypair # alternatively, you can export just the private key biscuit keypair --only-private-key > private-key-file # and later derive the public key from it biscuit keypair --from-file private-key-file --only-public-key ``` -------------------------------- ### Get Network Info Source: https://context7.com/rgb-tools/rgb-lightning-node/llms.txt Retrieves the Bitcoin network the node is connected to and the current best block height. No specific setup is required. ```bash curl -s http://localhost:3001/networkinfo | jq . ``` -------------------------------- ### GET /listchannels Source: https://context7.com/rgb-tools/rgb-lightning-node/llms.txt Returns detailed status of all Lightning channels, including RGB asset allocations per channel. ```APIDOC ## GET /listchannels ### Description Returns detailed status of all Lightning channels, including RGB asset allocations per channel. ### Method GET ### Endpoint /listchannels ### Response #### Success Response (200) - **channels** (array) - An array of channel objects. - **channel_id** (string) - The unique identifier for the channel. - **peer_pubkey** (string) - The public key of the peer. - **status** (string) - The current status of the channel (e.g., 'Opened'). - **ready** (boolean) - Indicates if the channel is ready for use. - **capacity_sat** (integer) - The total capacity of the channel in satoshis. - **local_balance_sat** (integer) - The local balance in satoshis. - **outbound_balance_msat** (integer) - The outbound balance in msatoshis. - **inbound_balance_msat** (integer) - The inbound balance in msatoshis. - **is_usable** (boolean) - Indicates if the channel is usable. - **public** (boolean) - Indicates if the channel is public. - **asset_id** (string) - The ID of the RGB asset in the channel, if any. - **asset_local_amount** (integer) - The local amount of the RGB asset. - **asset_remote_amount** (integer) - The remote amount of the RGB asset. ### Request Example ```bash curl -s http://localhost:3001/listchannels | jq . ``` ### Response Example ```json { "channels": [{ "channel_id": "aabb...cc", "peer_pubkey": "02abc...def", "status": "Opened", "ready": true, "capacity_sat": 100000, "local_balance_sat": 98670, "outbound_balance_msat": 97670000, "inbound_balance_msat": 0, "is_usable": true, "public": true, "asset_id": "rgb:2dkSTbr-மையில்", "asset_local_amount": 50000, "asset_remote_amount": 0 }] } ``` ``` -------------------------------- ### Clone RGB Lightning Node Repository Source: https://github.com/rgb-tools/rgb-lightning-node/blob/master/README.md Clone the project including submodules to get the full source code. ```sh git clone https://github.com/RGB-Tools/rgb-lightning-node --recurse-submodules --shallow-submodules ``` -------------------------------- ### Get Asset Balance Source: https://context7.com/rgb-tools/rgb-lightning-node/llms.txt Fetches the on-chain and off-chain (Lightning channel) balance for a specified RGB asset. ```APIDOC ## POST /assetbalance ### Description Returns the on-chain and off-chain (Lightning channel) balance for a specific RGB asset. ### Method POST ### Endpoint /assetbalance ### Parameters #### Request Body - **asset_id** (string) - Required - The unique identifier of the RGB asset. ### Request Example ```json { "asset_id": "rgb:2dkSTbr-..." } ``` ### Response #### Success Response (200) - **settled** (number) - The settled on-chain balance. - **future** (number) - The future balance (e.g., unconfirmed on-chain). - **spendable** (number) - The spendable balance. - **offchain_outbound** (number) - The outbound off-chain balance (available for sending). - **offchain_inbound** (number) - The inbound off-chain balance (received but not yet usable). ``` -------------------------------- ### Get Node Information (GET /nodeinfo) Source: https://context7.com/rgb-tools/rgb-lightning-node/llms.txt Retrieves comprehensive information about the node's current status, including public key, channel statistics, balances, capacity limits, and network graph size. This endpoint provides a snapshot of the node's operational state. ```bash curl -s http://localhost:3001/nodeinfo | jq . ``` -------------------------------- ### Run Regtest Node in Docker Source: https://github.com/rgb-tools/rgb-lightning-node/blob/master/README.md Run a regtest node within a Docker container. This example maps ports, mounts a volume for data persistence, and configures network and daemon settings. Data is persisted in the 'RLNdata1' volume. ```sh docker run \ --rm -it \ -p 3001:3001 \ -v RLNdata1:/RLNdata \ --network rgb-lightning-node_default \ rgb-lightning-node \ --daemon-listening-port 3001 \ --ldk-peer-listening-port 9735 \ --network regtest \ --disable-authentication \ RLNdata ``` -------------------------------- ### Get Asset Metadata Source: https://context7.com/rgb-tools/rgb-lightning-node/llms.txt Retrieves detailed metadata for an RGB asset, including its schema and supply information. ```APIDOC ## POST /assetmetadata ### Description Returns schema and supply information for any RGB asset by ID. ### Method POST ### Endpoint /assetmetadata ### Parameters #### Request Body - **asset_id** (string) - Required - The unique identifier of the RGB asset. ### Request Example ```json { "asset_id": "rgb:2dkSTbr-..." } ``` ### Response #### Success Response (200) - **asset_schema** (string) - The schema type of the asset (e.g., "Nia"). - **initial_supply** (number) - The total initial supply of the asset. - **max_supply** (number) - The maximum possible supply of the asset. - **known_circulating_supply** (number) - The currently known circulating supply. - **name** (string) - The human-readable name of the asset. - **precision** (number) - The number of decimal places for the asset. - **ticker** (string) - The ticker symbol of the asset. ``` -------------------------------- ### Get Bitcoin Balance Source: https://context7.com/rgb-tools/rgb-lightning-node/llms.txt Fetches the on-chain BTC balance, distinguishing between plain BTC ('vanilla') and RGB-capable UTXOs ('colored'). The `skip_sync` parameter can be used to avoid a full blockchain sync. ```bash curl -s -X POST http://localhost:3001/btcbalance \ -H "Content-Type: application/json" \ -d '{"skip_sync": false}' | jq . ``` -------------------------------- ### Get Asset Metadata Source: https://context7.com/rgb-tools/rgb-lightning-node/llms.txt Fetches schema and supply information for an RGB asset using its ID. This is a POST request that takes the asset ID in a JSON payload. ```bash curl -s -X POST http://localhost:3001/assetmetadata \ -H "Content-Type: application/json" \ -d '{"asset_id": "rgb:2dkSTbr-..."}' | jq . ``` -------------------------------- ### Get Bitcoin Balance Source: https://context7.com/rgb-tools/rgb-lightning-node/llms.txt Retrieves on-chain BTC balances, distinguishing between 'vanilla' (plain BTC) and 'colored' (RGB-capable UTXO) wallets. ```APIDOC ## POST /btcbalance — Get Bitcoin Balance ### Description Returns on-chain BTC balances split into `vanilla` (plain BTC) and `colored` (RGB-capable UTXO) wallets. ### Method POST ### Endpoint /btcbalance ### Parameters #### Request Body - **skip_sync** (boolean) - Optional - If true, skips the synchronization process before returning the balance. ### Request Example ```bash curl -s -X POST http://localhost:3001/btcbalance \ -H "Content-Type: application/json" \ -d '{"skip_sync": false}' | jq . ``` ### Response #### Success Response (200) - **vanilla** (object) - Balance information for the vanilla BTC wallet. - **settled** (integer) - Settled balance. - **future** (integer) - Future balance. - **spendable** (integer) - Spendable balance. - **colored** (object) - Balance information for the colored (RGB-capable) UTXO wallet. - **settled** (integer) - Settled balance. - **future** (integer) - Future balance. - **spendable** (integer) - Spendable balance. ### Response Example ```json { "vanilla": {"settled": 100000000, "future": 100000000, "spendable": 100000000}, "colored": {"settled": 50000000, "future": 50000000, "spendable": 50000000} } ``` ``` -------------------------------- ### Unlock the Node Source: https://context7.com/rgb-tools/rgb-lightning-node/llms.txt Decrypts the stored mnemonic and starts the LDK subsystem, connecting to the provided Bitcoin and indexer backends. This must be called after `/init` before any channel or payment operations. ```APIDOC ## POST /unlock — Unlock the Node ### Description Decrypts the stored mnemonic and starts the LDK subsystem, connecting to the provided Bitcoin and indexer backends. Must be called after `/init` before any channel or payment operations. ### Method POST ### Endpoint /unlock ### Parameters #### Request Body - **password** (string) - Required - The password to decrypt the wallet. - **bitcoind_rpc_username** (string) - Required - Username for Bitcoin Core RPC. - **bitcoind_rpc_password** (string) - Required - Password for Bitcoin Core RPC. - **bitcoind_rpc_host** (string) - Required - Hostname for Bitcoin Core RPC. - **bitcoind_rpc_port** (integer) - Required - Port for Bitcoin Core RPC. - **indexer_url** (string) - Required - URL of the Electrum or Esplora indexer. - **proxy_endpoint** (string) - Required - Endpoint for the RGB proxy server. - **announce_addresses** (array of strings) - Optional - List of network addresses to announce. - **announce_alias** (string) - Optional - Alias for the node. ### Request Example ```json { "password": "MyS3cur3P@ss", "bitcoind_rpc_username": "user", "bitcoind_rpc_password": "password", "bitcoind_rpc_host": "localhost", "bitcoind_rpc_port": 18443, "indexer_url": "127.0.0.1:50001", "proxy_endpoint": "rpc://127.0.0.1:3000/json-rpc", "announce_addresses": ["192.168.1.10:9735"], "announce_alias": "my-rgb-node" } ``` ### Response #### Success Response (200) - (empty object) #### Response Example ```json {} ``` ``` -------------------------------- ### Get a Specific Payment Source: https://context7.com/rgb-tools/rgb-lightning-node/llms.txt Fetch details for a single payment by providing its payment hash. This endpoint returns a specific payment record. ```bash curl -s -X POST http://localhost:3001/getpayment \ -H "Content-Type: application/json" \ -d '{"payment_hash": "abcd...ef"}' | jq . ``` -------------------------------- ### Unlock Node Wallet (POST /unlock) Source: https://context7.com/rgb-tools/rgb-lightning-node/llms.txt Decrypts the stored mnemonic and starts the LDK subsystem. This operation connects to the specified Bitcoin and indexer backends and must be called after `/init` and before any channel or payment operations. Requires wallet password and backend connection details. ```bash curl -s -X POST http://localhost:3001/unlock \ -H "Content-Type: application/json" \ -d '{ "password": "MyS3cur3P@ss", "bitcoind_rpc_username": "user", "bitcoind_rpc_password": "password", "bitcoind_rpc_host": "localhost", "bitcoind_rpc_port": 18443, "indexer_url": "127.0.0.1:50001", "proxy_endpoint": "rpc://127.0.0.1:3000/json-rpc", "announce_addresses": ["192.168.1.10:9735"], "announce_alias": "my-rgb-node" }' | jq . ``` -------------------------------- ### Get Node Info Source: https://context7.com/rgb-tools/rgb-lightning-node/llms.txt Returns the node's public key, channel counts, balances, capacity limits, and network graph size. ```APIDOC ## GET /nodeinfo — Get Node Info ### Description Returns the node's public key, channel counts, balances, capacity limits, and network graph size. ### Method GET ### Endpoint /nodeinfo ### Response #### Success Response (200) - **pubkey** (string) - The node's public key. - **num_channels** (integer) - The total number of channels. - **num_usable_channels** (integer) - The number of usable channels. - **local_balance_sat** (integer) - The local balance in satoshis. - **eventual_close_fees_sat** (integer) - The eventual close fees in satoshis. - **pending_outbound_payments_sat** (integer) - The amount of pending outbound payments in satoshis. - **num_peers** (integer) - The number of connected peers. - **account_xpub_vanilla** (string) - The xpub for vanilla accounts. - **account_xpub_colored** (string) - The xpub for colored accounts. - **max_media_upload_size_mb** (integer) - The maximum media upload size in megabytes. - **rgb_htlc_min_msat** (integer) - The minimum HTLC amount for RGB in millisatoshis. - **rgb_channel_capacity_min_sat** (integer) - The minimum channel capacity for RGB in satoshis. - **channel_capacity_min_sat** (integer) - The minimum channel capacity in satoshis. - **channel_capacity_max_sat** (integer) - The maximum channel capacity in satoshis. - **channel_asset_min_amount** (integer) - The minimum asset amount for channels. - **channel_asset_max_amount** (integer) - The maximum asset amount for channels. - **network_nodes** (integer) - The number of nodes in the network. - **network_channels** (integer) - The number of channels in the network. #### Response Example ```json { "pubkey": "02abc...def", "num_channels": 2, "num_usable_channels": 2, "local_balance_sat": 98000, "eventual_close_fees_sat": 334, "pending_outbound_payments_sat": 0, "num_peers": 1, "account_xpub_vanilla": "xpub...", "account_xpub_colored": "xpub...", "max_media_upload_size_mb": 5, "rgb_htlc_min_msat": 3000000, "rgb_channel_capacity_min_sat": 30010, "channel_capacity_min_sat": 5506, "channel_capacity_max_sat": 16777215, "channel_asset_min_amount": 1, "channel_asset_max_amount": 18446744073709551615, "network_nodes": 3, "network_channels": 2 } ``` ``` -------------------------------- ### Generate Biscuit Keypair Source: https://context7.com/rgb-tools/rgb-lightning-node/llms.txt Generates a new private and public key pair for Biscuit token operations. The private key is needed to sign tokens, and the public key is used to start the RGB Lightning Node. ```bash # Generate a root keypair biscuit keypair # Private key: abc123... # Public key: def456... ``` -------------------------------- ### Initialize Node Wallet (POST /init) Source: https://context7.com/rgb-tools/rgb-lightning-node/llms.txt Initializes the node wallet by generating or restoring a BIP-39 mnemonic. This must be called once on a fresh storage directory before the node can be unlocked. Requires a password and optionally accepts a mnemonic for restoration. ```bash curl -s -X POST http://localhost:3001/init \ -H "Content-Type: application/json" \ -d '{"password": "MyS3cur3P@ss"}' | jq . ``` ```bash curl -s -X POST http://localhost:3001/init \ -H "Content-Type: application/json" \ -d '{ "password": "MyS3cur3P@ss", "mnemonic": "word1 word2 word3 word4 word5 word6 word7 word8 word9 word10 word11 word12" }' | jq . ``` -------------------------------- ### Initiate a Swap as Maker Source: https://context7.com/rgb-tools/rgb-lightning-node/llms.txt Create a swap offer as the maker. Specify the assets and quantities to give and receive. The response includes a swap string to share. ```bash # Offer: give 5000 USDT, receive 3000000 msat BTC curl -s -X POST http://localhost:3001/makerinit \ -H "Content-Type: application/json" \ -d '{ \ "qty_from": 3000000, \ "qty_to": 5000, \ "from_asset": null, \ "to_asset": "rgb:2dkSTbr-વામાં", \ "timeout_sec": 3600 \ }' | jq . ``` -------------------------------- ### Create RGB-Compatible UTXOs Source: https://context7.com/rgb-tools/rgb-lightning-node/llms.txt Prepares UTXOs within the wallet that are suitable for use as RGB asset containers. This is a prerequisite for asset issuance and transfers. Specify the number of UTXOs, their size, and the fee rate. ```bash curl -s -X POST http://localhost:3001/createutxos \ -H "Content-Type: application/json" \ -d '{ \ "up_to": false, \ "num": 4, \ "size": 1000, \ "fee_rate": 1500, \ "skip_sync": false \ }' | jq . ``` -------------------------------- ### Get Specific Payment Source: https://context7.com/rgb-tools/rgb-lightning-node/llms.txt Retrieves a single payment record by payment hash. ```APIDOC ## POST /getpayment ### Description Retrieves a single payment record by payment hash. ### Method POST ### Endpoint /getpayment ### Parameters #### Request Body - **payment_hash** (string) - Required - The hash of the payment to retrieve. ### Request Example ```json {"payment_hash": "abcd...ef"} ``` ### Response #### Success Response (200) - **payment** (object) - The payment object containing details like `amt_msat` and `status`. #### Response Example ```json {"payment": {"amt_msat": 3000000, "status": "Succeeded", ...}} ``` ``` -------------------------------- ### Open an RGB Asset Channel Source: https://context7.com/rgb-tools/rgb-lightning-node/llms.txt Opens a Lightning channel pre-funded with a specified amount of an RGB asset. Requires a valid asset ID and amount. ```bash curl -s -X POST http://localhost:3001/openchannel \ -H "Content-Type: application/json" \ -d '{ \ "peer_pubkey_and_opt_addr": "02abc...def@127.0.0.1:9736", \ "capacity_sat": 100000, \ "push_msat": 0, \ "asset_id": "rgb:2dkSTbr- மரு", \ "asset_amount": 50000, \ "push_asset_amount": 0, \ "public": true, \ "with_anchors": true, \ "fee_base_msat": 0, \ "fee_proportional_millionths": 0, \ "temporary_channel_id": null \ }' | jq . ``` -------------------------------- ### Initiate a Swap as Maker Source: https://context7.com/rgb-tools/rgb-lightning-node/llms.txt The maker creates a swap offer specifying what asset to give (to) and receive (from). Returns a swap string to share with the taker. Quantities are in msat for BTC, or token units for RGB assets. ```APIDOC ## POST /makerinit ### Description The maker creates a swap offer specifying what asset to give (to) and receive (from). Returns a swap string to share with the taker. Quantities are in msat for BTC, or token units for RGB assets. ### Method POST ### Endpoint /makerinit ### Parameters #### Request Body - **qty_from** (integer) - Required - The quantity of the asset to send from. - **qty_to** (integer) - Required - The quantity of the asset to send to. - **from_asset** (string) - Optional - The asset ID to send from. If null, it refers to BTC. - **to_asset** (string) - Optional - The asset ID to send to. If null, it refers to BTC. - **timeout_sec** (integer) - Required - The timeout for the swap in seconds. ### Request Example ```json { "qty_from": 3000000, "qty_to": 5000, "from_asset": null, "to_asset": "rgb:2dkSTbr-...", "timeout_sec": 3600 } ``` ### Response #### Success Response (200) - **payment_hash** (string) - The hash of the payment. - **payment_secret** (string) - The secret for the payment. - **swapstring** (string) - The generated swap string to share with the taker. #### Response Example ```json { "payment_hash": "1234...56", "payment_secret": "abcd...ef", "swapstring": "1234...56@3000000:rgb:2dkSTbr-.../5000:3600" } ``` ``` -------------------------------- ### Stop Regtest Services Source: https://context7.com/rgb-tools/rgb-lightning-node/llms.txt Stops the services that were started for the regtest environment after integration tests are completed. ```bash # Stop services when done ./regtest.sh stop ``` -------------------------------- ### Accept a Swap as Taker Source: https://context7.com/rgb-tools/rgb-lightning-node/llms.txt Register a swap offer on your node as the taker. You will then wait for the maker to execute the swap. ```bash curl -s -X POST http://localhost:3001/taker \ -H "Content-Type: application/json" \ -d '{"swapstring": "1234...56@3000000:rgb:2dkSTbr-.../5000:3600"}' | jq . ``` -------------------------------- ### Initialize the Node Wallet Source: https://context7.com/rgb-tools/rgb-lightning-node/llms.txt Generates or imports a BIP-39 mnemonic and encrypts it with a password. This must be called once on a fresh storage directory before the node can be unlocked. ```APIDOC ## POST /init — Initialize the Node Wallet ### Description Generates (or imports) a BIP-39 mnemonic and encrypts it with the provided password. Must be called once on a fresh storage directory before the node can be unlocked. ### Method POST ### Endpoint /init ### Parameters #### Request Body - **password** (string) - Required - The password to encrypt the mnemonic. - **mnemonic** (string) - Optional - The existing BIP-39 mnemonic to restore the wallet from. ### Request Example ```json { "password": "MyS3cur3P@ss", "mnemonic": "word1 word2 word3 word4 word5 word6 word7 word8 word9 word10 word11 word12" } ``` ### Response #### Success Response (200) - **mnemonic** (string) - Required - The generated mnemonic if a new wallet was created. #### Response Example ```json { "mnemonic": "abandon abandon abandon ... art" } ``` ``` -------------------------------- ### Get Network Info Source: https://context7.com/rgb-tools/rgb-lightning-node/llms.txt Retrieves information about the Bitcoin network the node is connected to and the current best block height. ```APIDOC ## GET /networkinfo — Get Network Info ### Description Returns the Bitcoin network the node is on and the current best block height. ### Method GET ### Endpoint /networkinfo ### Response #### Success Response (200) - **network** (string) - The Bitcoin network the node is on (e.g., "Regtest"). - **height** (integer) - The current best block height. ### Request Example ```bash curl -s http://localhost:3001/networkinfo | jq . ``` ### Response Example ```json { "network": "Regtest", "height": 412 } ``` ``` -------------------------------- ### Build Docker Image for RGB Lightning Node Source: https://github.com/rgb-tools/rgb-lightning-node/blob/master/README.md Build the Docker image for the rgb-lightning-node project. ```sh docker build -t rgb-lightning-node . ``` -------------------------------- ### Display Regtest Utility Help Source: https://github.com/rgb-tools/rgb-lightning-node/blob/master/README.md Show help information for the regtest utility commands. ```sh ./regtest.sh -h ``` -------------------------------- ### Get a Bitcoin Address Source: https://context7.com/rgb-tools/rgb-lightning-node/llms.txt Generates a new on-chain Bitcoin address for receiving funds into the node's RGB-capable wallet. ```APIDOC ## POST /address — Get a Bitcoin Address ### Description Returns a new on-chain Bitcoin address for receiving funds into the node's colored (RGB-capable) wallet. ### Method POST ### Endpoint /address ### Response #### Success Response (200) - **address** (string) - A new Bitcoin address for receiving funds. ### Request Example ```bash curl -s -X POST http://localhost:3001/address | jq . ``` ### Response Example ```json { "address": "bcrt1q...xyz" } ``` ### Usage Notes Fund the address in regtest: ```bash ./regtest.sh sendtoaddress bcrt1q...xyz 1 ./regtest.sh mine 1 ``` ``` -------------------------------- ### Run Project Tests Source: https://github.com/rgb-tools/rgb-lightning-node/blob/master/README.md Execute the project's tests using Cargo. Ensure the test environment is set up correctly. ```sh cargo test ``` -------------------------------- ### Get Specific Swap Source: https://context7.com/rgb-tools/rgb-lightning-node/llms.txt Retrieves a single swap by payment hash, specifying whether to look in the maker or taker swap store. ```APIDOC ## POST /getswap ### Description Retrieves a single swap by payment hash, specifying whether to look in the maker or taker swap store. ### Method POST ### Endpoint /getswap ### Parameters #### Request Body - **payment_hash** (string) - Required - The hash of the swap to retrieve. - **taker** (boolean) - Required - True to look in the taker swap store, false for the maker swap store. ### Request Example ```json {"payment_hash": "1234...56", "taker": false} ``` ### Response #### Success Response (200) - **swap** (object) - The swap object containing details like `qty_from`, `qty_to`, and `status`. #### Response Example ```json {"swap": {"qty_from": 3000000, "qty_to": 5000, "status": "Succeeded", ...}} ``` ``` -------------------------------- ### Create RGB-Compatible UTXOs Source: https://context7.com/rgb-tools/rgb-lightning-node/llms.txt Prepares colored UTXOs within the wallet, which are used as containers for RGB asset issuance and transfers. ```APIDOC ## POST /createutxos — Create RGB-Compatible UTXOs ### Description Prepares colored UTXOs in the wallet used as RGB asset containers for issuance and transfers. ### Method POST ### Endpoint /createutxos ### Parameters #### Request Body - **up_to** (boolean) - Optional - If true, creates UTXOs up to the specified number. - **num** (integer) - Required - The number of UTXOs to create. - **size** (integer) - Required - The size of each UTXO in satoshis. - **fee_rate** (integer) - Required - The fee rate for the transaction in sat/vB. - **skip_sync** (boolean) - Optional - If true, skips the synchronization process. ### Request Example ```bash curl -s -X POST http://localhost:3001/createutxos \ -H "Content-Type: application/json" \ -d '{ \ "up_to": false, \ "num": 4, \ "size": 1000, \ "fee_rate": 1500, \ "skip_sync": false \ }' | jq . ``` ### Response #### Success Response (200) An empty JSON object `{}` indicates success. ``` -------------------------------- ### Generate RGB On-Chain Receive Invoice (Witness) Source: https://context7.com/rgb-tools/rgb-lightning-node/llms.txt Creates a P2TR output invoice for receiving RGB assets on-chain. This method requires setting 'witness' to true and can optionally include an expiration timestamp. ```bash # Witness receive (P2TR output) curl -s -X POST http://localhost:3001/rgbinvoice \ -H "Content-Type: application/json" \ -d '{ "asset_id": null, "assignment": null, "expiration_timestamp": 1800000000, "min_confirmations": 1, "witness": true }' | jq . ``` -------------------------------- ### Run Swagger UI with Docker Source: https://github.com/rgb-tools/rgb-lightning-node/blob/master/README.md Exposes the Swagger UI locally by running a Docker container. Mounts the OpenAPI specification file and maps ports for access. ```sh docker run -it \ -p 8246:8080 \ -e SWAGGER_JSON=/var/specs/openapi.yaml \ -v $PWD/openapi.yaml:/var/specs/openapi.yaml \ swaggerapi/swagger-ui ``` -------------------------------- ### Accept Swap as Taker Source: https://context7.com/rgb-tools/rgb-lightning-node/llms.txt Registers a swap offer on the taker's node. The taker then waits for the maker to call `/makerexecute`. ```APIDOC ## POST /taker ### Description Registers a swap offer on the taker's node. The taker then waits for the maker to call `/makerexecute`. ### Method POST ### Endpoint /taker ### Parameters #### Request Body - **swapstring** (string) - Required - The swap string obtained from the maker. ### Request Example ```json {"swapstring": "1234...56@3000000:rgb:2dkSTbr-.../5000:3600"} ``` ### Response #### Success Response (200) An empty JSON object indicates successful registration. #### Response Example ```json {} ``` ``` -------------------------------- ### Get a Specific Swap Source: https://context7.com/rgb-tools/rgb-lightning-node/llms.txt Retrieve a single swap record by its payment hash. Specify whether to query the maker or taker swap store. ```bash curl -s -X POST http://localhost:3001/getswap \ -H "Content-Type: application/json" \ -d '{"payment_hash": "1234...56", "taker": false}' | jq . ``` -------------------------------- ### Run All Integration Tests Source: https://context7.com/rgb-tools/rgb-lightning-node/llms.txt Executes all integration tests for the RGB Lightning Node using Cargo. Note that the regtest script and `cargo test` cannot run simultaneously. ```bash # Run all integration tests cargo test ``` -------------------------------- ### Open a Plain BTC Channel Source: https://context7.com/rgb-tools/rgb-lightning-node/llms.txt Use this endpoint to open a standard Bitcoin channel. Ensure the peer is online and reachable. ```bash curl -s -X POST http://localhost:3001/openchannel \ -H "Content-Type: application/json" \ -d '{ \ "peer_pubkey_and_opt_addr": "02abc...def@127.0.0.1:9736", \ "capacity_sat": 100000, \ "push_msat": 0, \ "asset_amount": null, \ "asset_id": null, \ "push_asset_amount": null, \ "public": true, \ "with_anchors": true, \ "fee_base_msat": null, \ "fee_proportional_millionths": null, \ "temporary_channel_id": null \ }' | jq . ``` -------------------------------- ### Get Asset Balance Source: https://context7.com/rgb-tools/rgb-lightning-node/llms.txt Retrieves the on-chain and off-chain balance for a specified RGB asset ID. Requires a POST request with the asset ID in the JSON payload. ```bash curl -s -X POST http://localhost:3001/assetbalance \ -H "Content-Type: application/json" \ -d '{"asset_id": "rgb:2dkSTbr-..."}' | jq . ``` -------------------------------- ### Generate RGB On-Chain Receive Invoice (Blind) Source: https://context7.com/rgb-tools/rgb-lightning-node/llms.txt Creates a UTXO-blinded invoice for receiving RGB assets on-chain. Specify the asset ID, assignment, and other parameters in the JSON payload. ```bash # Blind receive (UTXO-blinded) curl -s -X POST http://localhost:3001/rgbinvoice \ -H "Content-Type: application/json" \ -d '{ "asset_id": "rgb:2dkSTbr- மரு", "assignment": {"type": "Fungible", "value": 5000}, "expiration_timestamp": null, "min_confirmations": 1, "witness": false }' | jq . ``` -------------------------------- ### List All Swaps Source: https://context7.com/rgb-tools/rgb-lightning-node/llms.txt Retrieve a list of all swap operations this node has participated in, either as a maker or a taker. Includes swap status and quantities. ```bash curl -s http://localhost:3001/listswaps | jq . ``` -------------------------------- ### Get New Bitcoin Address Source: https://context7.com/rgb-tools/rgb-lightning-node/llms.txt Generates a new on-chain Bitcoin address for receiving funds into the node's RGB-capable wallet. Use this address to fund your RGB assets. ```bash curl -s -X POST http://localhost:3001/address | jq . ``` ```bash # Fund the address in regtest ./regtest.sh sendtoaddress bcrt1q...xyz 1 ./regtest.sh mine 1 ``` -------------------------------- ### Connect to Lightning Peer Source: https://context7.com/rgb-tools/rgb-lightning-node/llms.txt Establishes a TCP connection to a Lightning Network peer and saves its information. Requires the peer's public key and address in the JSON payload. ```bash curl -s -X POST http://localhost:3001/connectpeer \ -H "Content-Type: application/json" \ -d '{"peer_pubkey_and_addr": "02abc... மரு@127.0.0.1:9736"}' | jq . ``` -------------------------------- ### Issue Collectible Asset (CFA Schema) Source: https://context7.com/rgb-tools/rgb-lightning-node/llms.txt Issues a Collectible Fungible Asset (CFA), which can optionally include a media attachment. First, upload the media file using `/postassetmedia` to get its digest. ```bash # First upload the media file DIGEST=$(curl -s -X POST http://localhost:3001/postassetmedia \ -F "file=@/path/to/artwork.png" | jq -r '.digest') # Issue the CFA asset with the uploaded media curl -s -X POST http://localhost:3001/issueassetcfa \ -H "Content-Type: application/json" \ -d "{\"name\": \"RareToken\", \"details\": \"Limited edition collectible\", \"precision\": 0, \"amounts\": [100], \"file_digest\": \"$DIGEST\"}" | jq . ``` -------------------------------- ### Execute Swap as Maker Source: https://context7.com/rgb-tools/rgb-lightning-node/llms.txt Once the taker has registered the swap string via `/taker`, the maker finalizes execution by routing the two-leg Lightning payment. ```APIDOC ## POST /makerexecute ### Description Once the taker has registered the swap string via `/taker`, the maker finalizes execution by routing the two-leg Lightning payment. ### Method POST ### Endpoint /makerexecute ### Parameters #### Request Body - **swapstring** (string) - Required - The swap string obtained from `/makerinit`. - **payment_secret** (string) - Required - The payment secret associated with the swap. - **taker_pubkey** (string) - Required - The public key of the taker. ### Request Example ```json { "swapstring": "1234...56@3000000:rgb:2dkSTbr-.../5000:3600", "payment_secret": "abcd...ef", "taker_pubkey": "03xyz...abc" } ``` ### Response #### Success Response (200) An empty JSON object indicates successful execution. #### Response Example ```json {} ``` ``` -------------------------------- ### List Assets Source: https://github.com/rgb-tools/rgb-lightning-node/blob/master/README.md Retrieves a list of all assets. ```APIDOC ## GET /listassets ### Description Retrieves a list of all assets. ### Method GET ### Endpoint /listassets ### Response #### Success Response (200) - **assets** (array) - A list of assets. #### Response Example ```json { "assets": [ { "ticker": "USDT", "name": "Tether", "assetId": "asset123" } ] } ``` ``` -------------------------------- ### Send a Keysend (Spontaneous) Payment Source: https://context7.com/rgb-tools/rgb-lightning-node/llms.txt Initiate a spontaneous payment without a prior invoice. Optionally attach RGB assets by providing asset ID and amount. ```bash curl -s -X POST http://localhost:3001/keysend \ -H "Content-Type: application/json" \ -d '{ \ "dest_pubkey": "02abc...def", \ "amt_msat": 3000000, \ "asset_id": "rgb:2dkSTbr-વામાં", \ "asset_amount": 100 \ }' | jq . ``` -------------------------------- ### Open an RGB asset channel Source: https://context7.com/rgb-tools/rgb-lightning-node/llms.txt Opens a Lightning channel that includes an RGB asset. This allows for asset-denominated payments on the Lightning Network. ```APIDOC ## POST /openchannel ### Description Opens a Lightning channel that includes an RGB asset. This allows for asset-denominated payments on the Lightning Network. ### Method POST ### Endpoint /openchannel ### Parameters #### Request Body - **peer_pubkey_and_opt_addr** (string) - Required - The public key of the peer and optionally their address. - **capacity_sat** (integer) - Required - The capacity of the channel in satoshis. - **push_msat** (integer) - Required - The amount of satoshis to push to the peer upon channel opening. - **asset_id** (string) - Required - The ID of the RGB asset. - **asset_amount** (integer) - Required - The amount of the RGB asset to include in the channel. - **push_asset_amount** (integer) - Required - The amount of the RGB asset to push to the peer. - **public** (boolean) - Required - Whether the channel should be public. - **with_anchors** (boolean) - Required - Whether to use anchors for the channel. - **fee_base_msat** (integer) - Required - The base fee for routing in msat. - **fee_proportional_millionths** (integer) - Required - The proportional fee for routing in millionths. - **temporary_channel_id** (string) - Optional - A temporary ID for the channel. ### Request Example ```json { "peer_pubkey_and_opt_addr": "02abc...def@127.0.0.1:9736", "capacity_sat": 100000, "push_msat": 0, "asset_id": "rgb:2dkSTbr-மையில்", "asset_amount": 50000, "push_asset_amount": 0, "public": true, "with_anchors": true, "fee_base_msat": 0, "fee_proportional_millionths": 0, "temporary_channel_id": null } ``` ### Response #### Success Response (200) - **temporary_channel_id** (string) - The temporary ID of the opened channel. ``` -------------------------------- ### Execute the Swap as Maker Source: https://context7.com/rgb-tools/rgb-lightning-node/llms.txt Finalize a swap execution as the maker after the taker has registered the swap string. This routes the two-leg Lightning payment. ```bash curl -s -X POST http://localhost:3001/makerexecute \ -H "Content-Type: application/json" \ -d '{ \ "swapstring": "1234...56@3000000:rgb:2dkSTbr-.../5000:3600", \ "payment_secret": "abcd...ef", \ "taker_pubkey": "03xyz...abc" \ }' | jq . ```