Lightning Network Methods
Lightning methods are currently only available using the native Komodo DeFi Framework. WASM support should be available in late 2023.
- Initialise your lightning node with task::enable_lightning::init
- Check the initialization status of the lightning node with task::enable_lightning::status
- Cancel initialization process of the lightning node with task::enable_lightning::cancel
Any methods with a task::
prefix will be linked to a numeric task_id
value
which is used to query the status or outcome of the task.
- Connect to a lightning node with lightning::nodes::connect_to_node
- Add a trusted node with lightning::nodes::add_trusted_node
- Remove a trusted node with lightning::nodes::remove_trusted_node
- List your trusted lightning nodes with lightning::nodes::list_trusted_nodes
- Open a lightning channel lightning::channels::open_channel
- Close a lightning channel lightning::channels::close_channel
- Update a lightning channel lightning::channels::update_channel
- Get details about a lightning channel lightning::channels::get_channel_details
- Get claimable balances from lightning channels lightning::channels::get_claimable_balances
- List open lightning channels matching a filter lightning::channels::list_open_channels_by_filter
- List closed lightning channels matching a filter lightning::channels::list_closed_channels_by_filter
- Generate lightning invoices with lightning::payments::generate_invoice
- Send lightning payments with lightning::payments::send_payment
- Get details about a lightning payment with lightning::payments::get_payment_details
- Get a filtered list of lightning payments with lightning::payments::list_payments_by_filter
Once you:
- Enable lightning with task::enable_lightning::init
- Connect to a lightning node with lightning::nodes::connect_to_node
- Open a lightning channel lightning::channels::open_channel
You can get an invoice for a coffee from https://starblocks.acinq.co!
Then you can:
- Pay the invoice with lightning::payments::send_payment
- View details about the payment with lightning::payments::get_payment_details
- List your payments with lightning::payments::list_payments_by_filter
Follow the flowchart below to visualize the process:
Some configurations are set per coin, and some are set per channel. The
counterparty_channel_config_limits
param must be set in the coins
configuration file, and aplies to all
channels opened by counterparty nodes. The
our_channels_config and
channel_options parameters
are set per channel. These can be defined in the coins
configuration file to
act as the default for all opened channels, and optionally overwritten or
updated using the
open_channel or
update_channel
methods.
Parameter | Type | Description |
---|---|---|
coin | object | The ticker of the coin you will use lightning network with, suffixed with -lightning |
mm2 | integer | Defaults to 0 . A value of 1 , indicates the coin is atomic swap compatible. |
decimals | integer | The decimal precision of the coin you will use the lightning network with. |
protocol | object | A standard CoinProtocol object. |
accept_inbound_channels | boolean | Optional, defaults to true . If this is set to false, we do not accept inbound requests to open a new channel. |
accept_forwards_to_priv_channels | boolean | Optional, defaults to false . When set to false , any HTLCs which were to be forwarded over private channels will be rejected. This prevents us from taking on HTLC-forwarding risk when we intend to run as a node which is not online reliably (e.g. GUI wallet apps). Generally, private channels are used for non-routing purposes only. |
counterparty_channel_config_limits | object | Optional. A standard CounterpartyChannelConfig object. |
channel_options | object | Optional. A standard LightningChannelOptions object. |
our_channels_config | object | Optional. A standard LightningChannelConfig object. |
For GUIs and wallet apps, it is recommended to set
accept_forwards_to_priv_channels
to false
. This prevents users from taking
on HTLC-forwarding risk when a node is expected to not be reliably online.
our_channels_config::announced_channel
should also be set to false
for GUIs and wallet apps.