⚡
Lightning Node Management
🇺🇸 English
🇺🇸 English
  • Contents
  • Lightning basics
  • Create inbound liquidity
  • Create outbound liquidity
  • Comparison table of software implementations
  • Comparison table of lightning channel markets
  • Node Types
    • Merchant
    • Spending
    • Routing
  • Advanced Tools
    • lnd.conf example
    • Advanced and automated fee settings
    • Set up an LND watchtower and connect a client
    • Methods to create a balanced channel with a trusted peer
    • Pool usage notes
    • Bos Score
  • Technicals
    • Connecting to a lightning node remotely
    • High onchain fee environment
    • Compact the LND database (channel.db)
    • Manage the LND onchain funds in Electrum Wallet
  • Recovery
    • Resources for LND
    • Resources for Core Lightning
  • Privacy
    • Resources on Lightning privacy
    • VPN tunnels
  • Hardware deployment
    • Hardware recommendations
    • RaspiBolt
    • RaspiBlitz
      • charge-lnd
      • Balance of Satoshis Telegram Bot
      • LND updates
      • Bitcoin Core updates
      • VPN and firewall setup
    • TrueNAS (FreeBSD) node
      • aliases
      • Balance of Satoshis
      • Lightning Terminal
      • Circuitbreaker
      • LNtop
      • LND notes
      • stream-lnd-htlcs
      • Suez
      • Tailscale
      • Connect Zeus
  • Donate
    • Donations
Powered by GitBook
On this page
  • Peer connections and channels
  • Receiving payments
  • Channel size and choosing a peer
  • On-chain bitcoin fees
  • Tor nodes
  • Routing payments
  • Private channel
  • Lightning Network routing fees
  • Advanced and automated fee settings: fees.md
  • Watchtowers
  • Channel reserve
  • Liquidity
  • Create Inbound Liquidity
  • Create Outbound Liquidity
  • Manage channels
  • Balance of Satoshis
  • CLBOSS The C-Lightning Node Manager
  • lndmanage
  • rebalance-lnd
  • Methods to create a balanced channel with a trusted peer
  • Monitoring software
  • RTL - Ride The Lightning
  • ThunderHub
  • ZeusLN
  • Zap
  • Joule
  • lntop
  • lnd-admin
  • lndmon
  • Spark wallet for C-Lightning
  • Lightning network explorers
  • Resources
  • Routing
  • Videos
  • Forums
  • Learning

Was this helpful?

Edit on GitHub

Lightning basics

PreviousContentsNextCreate inbound liquidity

Last updated 1 year ago

Was this helpful?

Peer connections and channels

  • Peers are the nodes connected to each other through the internet (TCP/IP layer).

  • A channel is a payment channel between two peers established on the Lightning Network.

  • To open a channel to any node the peer connection needs to be established first.

  • The publicly accessible nodes can be connected to automatically.

  • If a node is not publicly accessible the peer connection needs to be initiated manually from the non-public side even if the other peer is opening the channel.

Receiving payments

To be able to receive payments on the Lightning Network a node needs:

  • "inbound liquidity" (aka remote balance) which means that some satoshis need to be on the side of the other peer in a channel.

  • a channel to a well connected node or a direct channel from the paying peer to make sure there is a possible payment route.

The max amount of the incoming payment is determined by the highest inbound liquidity of a single channel (not additive between channels).

Channel size and choosing a peer

  • There is no hard number, but in general it is recommended to avoid opening channels below 200K-500K sats.

  • shows the average channel size on the network:

    0.028 BTC = 2 800 000 satoshis on 2019 May 28.

  • A channel too small will result in being unable to close when on-chain fees are high. This will leave the channel vulnerable in a case, when the counterparty would try to close with a previous state (the funds in the channel can be cheated out).

  • The max size of the available payment made or routed is determined by the highest directional liquidity of a single channel (not additive between channels).

  • One big channel to a well connected and stable node is more useful than many small ones.

  • It is beneficial to connect to nodes where the operator can be contacted in case of a problem.

  • Choose a node you know or one from the list:

  • Try a custom list of recommendations for your public node:

On-chain bitcoin fees

  • Opening or closing a Lightning channel is an on-chain bitcoin transaction (settled on the blockchain)

  • Use a custom fee and choose the lowest number with a good chance for an acceptable confirmation time.

  • At least 141 bytes need to be covered by fees, but this number is often higher depending on the transaction inputs, script and signatures used.

Tor nodes

  • A Lightning node behind Tor can connect and open a channel to any other node.

  • The nodes running on clearnet are not able to see behind Tor.

  • The clearnet node needs to be added as a peer first by the Tor node to be able to open a channel.

  • Once the channel is established the connection will persist, but might take some more time to come back online after either peer restarts.

  • If both nodes restart in the same time or the clearnet node`s IP address is changed while both offline the peer connection need to be added manually again.

Routing payments

  • Imagine a node B in an A-B-C serial connection.

  • The channels of B are set up so that there is inbound capacity (remote balance) from A and outgoing capacity (local balance) to C.

  • If A wants to pay C there will be 1 hop in the route.

  • Under the hood: A sends the satoshis to B (the routing node) which will pay to C.

  • The capacity of the channels do not change, only move.

  • The whole payment can only go through if they can send a hash image (a message) through from the other direction first.

  • The process is all or nothing, the payment cannot get stuck en route.

Private channel

  • better to be called an "unannounced" channel

  • won't be advertised in the channel graph (network gossip)

  • more useful to send payments

  • to receive payments need to have a route hint included in the invoice:

    lncli addinvoice <amount> --private

  • the route hint is the identifier of the funding transaction (exposes the channel to the anyone knowing the invoice)

  • possible to receive keysend payments if the route hint is known

  • does not route payments (unless used in parallel with a public channel to the same node - aka shadow liquidity)

Lightning Network routing fees

Unlike with on-chain transactions (where the fee is paid for the bytes the transaction takes up in a block) Lightning Network fees are related to the amount routed. There are two fee components:

  • base fee (base_fee_msat). The default is 1000 millisat, which means 1 satoshi fee per every routed payment.

  • proportional fee (fee_rate) which is by default in lnd: 0.000001. This means there is an additional 1 sat charged for every million satoshis in the routed payment.

There is no LN fee for payments in a direct channel between two peers.

  • Can reduce the base fee to 500 msat and increase the proportional fee to 100ppm/0.01% with this command: $ lncli updatechanpolicy 500 0.0001 144

  • the default setting is (1 sat per payment + 1 ppm/0.0001%): $ lncli updatechanpolicy 1000 0.000001 144

Watchtowers

Channel reserve

Generally 1% of the channel capacity is used as a reserve. This means that any channel can only send the amount above the 1% of the capacity up to as much as the 99%.

The channel reserve is specified by the peer's channel_reserve_satoshis: 1% of the channel total is suggested. Each side of a channel maintains this reserve so it always has something to lose if it were to try to broadcast an old, revoked commitment transaction. Initially, this reserve may not be met, as only one side has funds; but the protocol ensures that there is always progress toward meeting this reserve, and once met, it is maintained.

Liquidity

Create Inbound Liquidity

Create Outbound Liquidity

Manage channels

The channels are best to be balanced with funds on each side to maximize the ability to route payments (allows bidirectional traffic).

A feature rich tool to work with LND balances. Has an experimental feature to connect to a personal Telegram bot and notify about the node activity.

  • See how to use the rebalance command with: bos help rebalance

An automated manager for C-Lightning forwarding nodes.

A command-line tool for advanced channel management of an LND node written in python.

  • Install with:

      # activate virtual environment
      sudo apt install -y python3-venv
      python3 -m venv venv
      source venv/bin/activate
      # get dependencies
      sudo apt install -y python3-dev libatlas-base-dev
      pip3 install wheel
      python3 -m pip install lndmanage
  • Start the interactive mode (do this at every new start):

      $ source venv/bin/activate
      (venv) $ lndmanage
  • To display the status of the channels:

    $ lndmanage status $ lndmanage listchannels

  • Example rebalance command:

    $ lndmanage rebalance --max-fee-sat 20 --max-fee-rate 0.0001 CHANNEL_ID --reckless

Using this python script you can easily rebalance individual channels of your lnd node.

  • To install run in the terminal of the lnd node:

    $ git clone https://github.com/C-Otto/rebalance-lnd

    $ cd rebalance-lnd

    $ pip install -r requirements.txt

  • $ python rebalance.py -t <channel_ID-where-to-move-sats> -f <channel_ID-from-which-to-move-sats> -a <amount-of-sats-to-be-moved>

  • Perform a trusted onchain to offchain swap.

  • Open a dual funded, balanced channel with a trusted peer using the command line requiring an Lightning and an on-chain transaction.

Monitoring software

An LND Lightning Node Manager in your Browser.

A lightning wallet for desktop, iOS and Android - can connect to your LND node remotely through the GRPC interface (port 10009)

lntop is an interactive text-mode channels viewer for Unix systems.

Spark is a minimalistic wallet GUI for c-lightning, accessible over the web or through mobile and desktop apps (for Android, Linux, macOS and Windows). It is currently oriented for technically advanced users and is not an all-in-one package, but rather a "remote control" interface for a c-lightning node that has to be managed separately.

Lightning network explorers

Resources

  • LND Builder's Guide Best Practices

  • A conceptual review of the Lightning Network:

  • gRPC API reference documentation for LND

  • A list about How to get Channel Liquidity fast?

  • A curated list of awesome Lightning Network resources, apps, and libraries

  • Jameson Lopp's curated list of Lightning Network resources

Routing

Videos

  • Collection of Alex Bosworth`s online presentations:

Forums

  • A community managed group for the RaspiBlitz Lightning Node:

  • LND Developer Slack. Find the invite link on:

  • A subreddit for Bitcoin and Lightning developers to discuss technical topics:

Learning

The confirmation time depends on the state of the bitcoin mempool () and the sats/byte fee used ().

Check for the current estimation of confirmation time/fee.

Learn what to do in a

Tor is an anonymizing network designed to hide the participant`s IP address. Somewhat similar to using a VPN with multiple hops. Learn more at:

Advanced and automated fee settings:

To change routing fees of your node use the command:

It is important to increase the routing fee for any expensive channels so rebalancing or closure is paid for if payments are routed that way. Check the routing fees of the peers on or in .

Setting the fees for individual channels takes only one click in the .

Read more and how to set one up .

Specified in

Explained in more detail in the

Read the basic ideas from Alex Bosworth:

in the

Pay with Lightning and receive onchain. See the a list of recommendations

Simply open channels or pay onchain and receive on Lightning. See the a list of recommendations

Use with (more options in the ):

RTL is a web UI for Lightning Network Daemon. Aimed to be used on the local network. or connection method is available.

A mobile Bitcoin app for Lightning Network Daemon (lnd) node operators. Android and iOS - connects through the REST API (port 8080 or )

Bring the power of lightning to the web with in-browser payments and identity, all with your own node.

Admin web interface for LND, via gRPC. Built with Node.js, express, bootstrap-v4. Test at:

A drop-in monitoring solution for your lnd node using Prometheus and Grafana.

Elaine Ou - Bootstrapping and maintaining a Lightning node and

Alex Bosworth - Lightning channel Management

https://1ml.com/statistics
https://1ml.com/node?order=nodeconnectednodecount
https://moneni.com/nodematch
https://jochen-hoenicke.de/queue/#0,24h
https://bitcoinfees.earn.com/
https://whatthefee.io/
high onchain fee environment
https://en.wikipedia.org/wiki/Tor_(anonymity_network)
fees.md
https://lightning.engineering/api-docs/api/lnd/lightning/update-channel-policy
1ml.com
lndmanage
RTL app
watchtower.md
BOLT2
Bitcoin Design Guide
https://github.com/alexbosworth/run-lnd/blob/master/LIQUIDITY.md
Bitcoin Design Guide
CreateInboundLiquidity.md
CreateOutboundLiquidity.md
Balance of Satoshis
Install instructions for the RaspiBlitz
CLBOSS The C-Lightning Node Manager
lndmanage
rebalance-lnd
readme
Methods to create a balanced channel with a trusted peer
RTL - Ride The Lightning
HTTPS
Tor
https://medium.com/@suheb__/how-to-ride-the-lightning-447af999dcd2
ThunderHub
Install instructions on the RaspiBlitz
ZeusLN
Tor
Zap
Joule
https://medium.com/lightning-power-users/bitcoin-lightning-joule-chrome-extension-ac149bb05cb9
lntop
lnd-admin
https://lnd-admin.chaintools.io/
lndmon
https://blog.lightning.engineering/posts/2019/07/24/lndmon-v0.1.html
Spark wallet for C-Lightning
1ml.com
explorer.acinq.co
amboss.space
ln.fiatjaf.com
docs.lightning.engineering/advanced-best-practices/advanced-best-practices-overview/channels
dev.lightning.community/overview/index.html#lightning-network
api.lightning.community
medium.com/lightningto-me/practical-solutions-to-inbound-capacity-problem-in-lightning-network-60224aa13393
lightningwiki.net
satbase.org
github.com/raspiblitz/raspiblitz/issues/395
github.com/bcongdon/awesome-lightning-network
lightning.how
wiki.ion.radar.tech/tutorials/troubleshooting/bootstrapping-channels
blog.lightning.engineering/posts/2018/05/30/routing.html
diyhpl.us/wiki/transcripts/chaincode-labs/2018-10-22-alex-bosworth-channel-management/
diyhpl.us/wiki/transcripts/lightning-hack-day/2021-03-27-alex-bosworth-lightning-routing/
38 mins video
slides
35 mins video
Chaincode Labs Lightning Seminar - Summer 2019
twitter.com/alexbosworth/status/1175091117668257792
https://t.me/raspiblitz
dev.lightning.community/
www.reddit.com/r/lightningdevs
https://github.com/lnbook/lnbook
https://chaincode.applytojob.com/apply/LpQl1a0cvd/Chaincode-Labs-Online-Seminars
https://github.com/chaincodelabs/lightning-curriculum