Lightning for Builders Nodes

Operating a Lightning Network node

Running a node is a job: set the fees you charge for routing, back up your channels, and know what to watch.

35 minIntermediate5 / 17

Draft: this lesson is still waiting for review.

What you'll learn

  • Explain how routing fees are calculated from a base fee and a fee rate
  • Set Alice's routing fees and read the fee report
  • Make a static channel backup and explain what it can and can't recover

Key terms

fee (ada)
A small amount you pay to get your transaction into a block or routed over Lightning.
backup (nakala ya akiba)
A copy of your seed phrase kept somewhere safe so you can restore your wallet.
node (nodi)
A computer running Bitcoin or Lightning software that checks every rule for itself.

Lesson 2 showed a payment paying a small fee at every hop. Those fees are set by the nodes that forward the payment, and earning them takes some work.

Routing fees

Every channel direction has a fee policy with two parts:

  • a base fee, a fixed amount per payment (in millisats), and
  • a fee rate, in parts per million (ppm) of the amount.

For a 100,000-sat payment through a node charging 1 sat + 100 ppm:

fee = 1 sat + 100,000 × 100 / 1,000,000 = 1 + 10 = 11 sats

Set fees too high and senders route around you; too low and you earn nothing for locking up your coins.

Step 1: Set Alice's fees

Set routing fees

These exercises need a laptop with the lab running. You can read the lesson on your phone.

feereport lists each channel's new policy. The change is announced to the network, so other nodes will use it when they plan routes.

Backups

A node's channels exist only as signed transactions in its database. If the disk dies, a seed phrase alone gets back the on-chain wallet, but not the channels.

A static channel backup (SCB) records who your channels were with. After a disaster, your node uses it to ask each peer to close the channel, so you get your funds on-chain. It can't restore the channels themselves, and it is only as good as its last update, so keep it current.

Step 2: Back up Alice's channels

Back up the channels

These exercises need a laptop with the lab running. You can read the lesson on your phone.

Reflect

Write your answer down, or talk it over with a friend or your chama.

  1. If Alice charges too much, what happens to the payments that would have used her channels?
  2. Why is a channel backup not the same as a copy of the whole node?

Check yourself

Question 1 of 4What is the fee for 100,000 sats through a node charging 1 sat + 100 ppm?

Further reading

Adapted from Mastering the Lightning Network. Andreas M. Antonopoulos, Olaoluwa Osuntokun and René Pickhardt. Licence: CC BY-SA 4.0.