### Install Aperture Source: https://docs.lightning.engineering/lightning-network-tools/aperture/get-aperture Clone the Aperture repository and install it using make. Requires Go 1.19 or later. ```bash git clone https://github.com/lightninglabs/aperture.git cd aperture make install ``` -------------------------------- ### Query Documentation via HTTP GET Source: https://docs.lightning.engineering/the-lightning-network Perform an HTTP GET request to the current page URL with the 'ask' query parameter to dynamically query the documentation. The question should be specific and self-contained. ```http GET https://docs.lightning.engineering/the-lightning-network.md?ask= ``` -------------------------------- ### Query Documentation Dynamically Source: https://docs.lightning.engineering/the-lightning-network/taproot-assets/faq Perform an HTTP GET request to query documentation dynamically using the `ask` query parameter. This is useful for retrieving specific information not explicitly present on the page. ```bash GET https://docs.lightning.engineering/the-lightning-network/taproot-assets/faq.md?ask= ``` -------------------------------- ### Get Channel Information Source: https://docs.lightning.engineering/the-lightning-network/liquidity/manage-liquidity Obtain detailed information about a specific channel, including routing policies. Use the compact channel ID obtained from `lncli listchannels`. ```bash lncli getchaninfo ``` -------------------------------- ### Open a Lightning Channel Source: https://docs.lightning.engineering/the-lightning-network/liquidity/manage-liquidity Open a new channel with a specified peer. You can set the channel capacity, push an initial amount, and control network announcement. ```bash lncli openchannel 021c97a90a411ff2b10dc2a8e32de2f29d2fa49d41bfbb52bd416e460db0747d0d 1000000 ``` ```bash lncli openchannel --sat_per_byte 21 --local-amt 800000 --close_address bc1qsltz4tt23k0825q76ylj5mt0gwenlm8wr7umkl 021c97a90a411ff2b10dc2a8e32de2f29d2fa49d41bfbb52bd416e460db0747d0d ``` -------------------------------- ### Send Bitcoin with Fee Rate Source: https://docs.lightning.engineering/the-lightning-network/liquidity/manage-liquidity Send a specific amount of Bitcoin to an address, setting the fee rate per byte. The amount is in satoshis. ```bash lncli sendcoins --sat_per_byte 10 --label savings bc1qaxcxcpunn6ns3gpu6ywcy57tcmy2vsjzwdklxr 100000 ``` -------------------------------- ### Set Default Channel Fees in lnd.conf Source: https://docs.lightning.engineering/the-lightning-network/liquidity/manage-liquidity Configure default fees for new channels in your `lnd.conf` file. `bitcoin.basefee` sets the base fee in msat, and `bitcoin.feerate` sets the fee per million msat. ```ini bitcoin.basefee=1000 (referring to base_fee_msat above) bitcoin.feerate=1 (referring to fee_per_mil above) ``` -------------------------------- ### Connect to a Lightning Peer Source: https://docs.lightning.engineering/the-lightning-network/liquidity/manage-liquidity Connect to a remote Lightning node before opening a channel. Ensure the peer is online and accepts your connection request. ```bash lncli connect 021c97a90a411ff2b10dc2a8e32de2f29d2fa49d41bfbb52bd416e460db0747d0d@54.184.88.251:9735 ``` -------------------------------- ### Asset Tree Root Calculation Source: https://docs.lightning.engineering/the-lightning-network/taproot-assets/taproot-assets-protocol Illustrates the formula for calculating the asset tree root, which commits to all assets within the tree and their sum. ```plaintext asset_tree_root = sha256(asset_id || left_hash || right_hash || sum_value) ``` -------------------------------- ### Sweep Entire Balance with Confirmation Target Source: https://docs.lightning.engineering/the-lightning-network/liquidity/manage-liquidity Send all available Bitcoin from the wallet to a specified address, targeting confirmation within a certain number of blocks. The `amt` value is omitted when using `--sweepall`. ```bash lncli sendcoins --sweepall --conf_target 6 bc1qaxcxcpunn6ns3gpu6ywcy57tcmy2vsjzwdklxr ``` -------------------------------- ### List All Lightning Channels Source: https://docs.lightning.engineering/the-lightning-network/liquidity/manage-liquidity Retrieve a list of all your Lightning channels, including active and inactive ones. This command provides details on channel status, balances, and peer information. ```bash lncli listchannels ``` -------------------------------- ### View Forwarding History Source: https://docs.lightning.engineering/the-lightning-network/liquidity/manage-liquidity Use `lncli fwdinghistory` to see a list of payments your node has successfully forwarded. You can specify a time range using `--start_time` and `--end_time` arguments. ```bash lncli fwdinghistory ``` -------------------------------- ### Generate New Bitcoin Address Source: https://docs.lightning.engineering/the-lightning-network/liquidity/manage-liquidity Use this command to generate a new Bitcoin address for your Lightning node wallet. ```bash lncli newaddress ``` -------------------------------- ### Check Pending Channels Source: https://docs.lightning.engineering/the-lightning-network/liquidity/manage-liquidity View channels that are currently in the process of being confirmed on the blockchain. ```bash lncli pendingchannels ``` -------------------------------- ### View Channel Fee Policy Source: https://docs.lightning.engineering/the-lightning-network/liquidity/manage-liquidity Use `lncli feereport` to view the fee policy for all your channels and see earned routing fees. The output shows channel ID, point, base fee in msat, fee per million, and fee rate. ```json { "chan_id": "739918549049147393", "channel_point": "3ebdb34f1fc1948b5b49d127b52b19d24549779661af03a691cf934aa3b86e3f:1", "base_fee_msat": "1000", "fee_per_mil": "1", "fee_rate": 0.000001 } ``` -------------------------------- ### Send Bitcoin to Multiple Addresses Source: https://docs.lightning.engineering/the-lightning-network/liquidity/manage-liquidity Send Bitcoin to multiple addresses simultaneously by providing a JSON string mapping addresses to amounts in satoshis. ```bash lncli sendmany '{"ExampleAddr": NumCoinsInSatoshis, "SecondAddr": NumCoins}' ``` -------------------------------- ### Taptweak Formula for Taproot Public Key Source: https://docs.lightning.engineering/the-lightning-network/taproot-assets/taproot-assets-protocol This formula illustrates how a Taproot public key is derived by tweaking the internal public key with a hash of the internal public key and the commitment. This is fundamental to committing data using Taproot. ```plaintext Q= P+H(P|c)G Q = the final Taproot public key P = the internal public key H(P|c) = A hash of the internal public key and the commitment ``` -------------------------------- ### Asset ID Generation Formula Source: https://docs.lightning.engineering/the-lightning-network/taproot-assets/taproot-assets-protocol Defines the formula for generating a 32-byte asset ID by hashing the genesis outpoint, an asset tag, and meta information. ```plaintext asset_id = sha256(genesis_outpoint || asset_tag || asset_meta) ``` -------------------------------- ### Force Close a Lightning Channel Source: https://docs.lightning.engineering/the-lightning-network/liquidity/manage-liquidity To perform a unilateral, uncooperative close, use the `--force` flag with `lncli closechannel`. This locks up funds for a period before they can be redeemed. ```bash lncli closechannel --force --funding_txid --output_index ``` -------------------------------- ### Taproot Assets Address Format Source: https://docs.lightning.engineering/the-lightning-network/taproot-assets/taproot-assets-protocol Shows the structure of a Taproot Assets address, which is bech32m encoded and includes the asset ID, script hash, internal key, and amount. ```plaintext bech32(hrp=TapHrp, asset_id || asset_script_hash || internal_key || amt) ``` -------------------------------- ### View Closed Lightning Channels Source: https://docs.lightning.engineering/the-lightning-network/liquidity/manage-liquidity Use `lncli closedchannels` to retrieve a list of all channels that have been closed. This command helps in reviewing past channel closure activities. ```bash lncli closedchannels ``` -------------------------------- ### Close All Lightning Channels Source: https://docs.lightning.engineering/the-lightning-network/liquidity/manage-liquidity Execute `lncli closeallchannels` to close all active channels simultaneously. This is a convenient way to manage multiple channels at once. ```bash lncli closeallchannels ``` -------------------------------- ### Close a Lightning Channel Source: https://docs.lightning.engineering/the-lightning-network/liquidity/manage-liquidity Use `lncli closechannel` to close a specific channel. Specify the funding transaction ID and output index. Optionally, set the sat/byte for the closing transaction and a delivery address for the funds. ```bash lncli closechannel --funding_txid 83b5a55b21255915dbc0d005230b2c026a004c839edaa716247b96b66490c66a --output_index 1 --sat_per_byte 20 --delivery_addr bc1q6tcemsjadwgt938gkrmcqyvt79wxla42js8r4l ``` -------------------------------- ### Update Channel Fee Policy Source: https://docs.lightning.engineering/the-lightning-network/liquidity/manage-liquidity Use `lncli updatechanpolicy` to adjust fee policies for existing channels. You can set `base_fee_msat`, `fee_rate`, `time_lock_delta`, and optionally `min_htlc_msat` and `max_htlc_msat`. Omitting `channel_point` updates all channels. ```bash lncli updatechanpolicy [command options] base_fee_msat fee_rate time_lock_delta [--max_htlc_msat=N] [channel_point] ``` ```bash lncli updatechanpolicy base_fee_msat 100 fee_rate 0.00001 ``` ```bash lncli updatechanpolicy base_fee_msat 1000 fee_rate 0.000001 --max_htlc_msat 100000000 ```