Lightning Network Methods
Lightning Network Initialization Tasks
- 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
Lightning Network Nodes Methods
- 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
Lightning Network Channels Methods
- 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
Lightning Network Payments Methods
- 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
Lightning Network Flowchart
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:
Lightning Network Coins File Configuration
Lightning Coin Config Parameters
| 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. |
Show Example Config
{
"coin": "BTC-lightning",
"mm2": 1,
"decimals": 11,
"our_channels_config": {
"inbound_channels_confirmations": 3,
"max_inbound_in_flight_htlc_percent": 90
},
"counterparty_channel_config_limits": {
"outbound_channels_confirmations": 3,
"force_announced_channel_preference": false
},
"protocol": {
"type": "LIGHTNING",
"protocol_data":{
"platform": "BTC-segwit",
"network": "mainnet",
"confirmation_targets": {
"background": 12,
"normal": 6,
"high_priority": 1
}
}
}
},
{
"coin": "tBTC-lightning",
"mm2": 1,
"decimals": 11,
"our_channels_configs": {
"inbound_channels_confirmations": 3,
"max_inbound_in_flight_htlc_percent": 90,
"their_channel_reserve_sats": 10000
},
"counterparty_channel_config_limits": {
"outbound_channels_confirmations": 3
},
"protocol": {
"type": "LIGHTNING",
"protocol_data":{
"platform": "tBTC-segwit",
"network": "testnet",
"confirmation_targets": {
"background": 12,
"normal": 6,
"high_priority": 1
}
}
}
},