Learn › Module 5 of 6

Lightning and swaps

On-chain payments are public, final and relatively slow. Lightning moves payments off the chain — inside a shared deposit called a channel.

1. Why Lightning exists

Every on-chain payment occupies space in a block, must be confirmed, and costs a fee. That is fine for buying a house, and terrible for buying coffee.

Lightning pays for the coffee by moving value off-chain between two parties who already locked funds together, and only settles on-chain when they decide to close. Result: instant confirmation, fees of a few satoshis, and privacy by default (payments are not published).

The trade: you depend on a counterparty staying reachable and on having liquidity where you need it.

2. Anatomy of a channel

A channel is a shared deposit between you and another node:

  1. Open — one on-chain transaction locks funds in a contract that requires both signatures (2-of-2). From the chain's point of view the money now belongs to "the channel".
  2. Use — you and the peer exchange signed updates. Each payment shifts the split: some of it is yours, some is theirs. Updates are instant and do not touch the chain.
  3. Close — the final split goes back on-chain, to your address and theirs, in a normal transaction.

Think of it as a tab at a bar: you deposit an amount, you both keep signing the current balance, and at the end you settle once.

3. The words you will meet

4. Closing: cooperative vs forced

A cooperative close is the normal path: both sides agree, one on-chain transaction, funds available after it confirms, fees shared.

A force close is the emergency exit: you stop waiting for the peer and publish the last state yourself. You pay the on-chain fee alone, wait for confirmations, and then wait again for the to-self delay. Use it when the peer is offline or hostile — not as a shortcut.

5. Your node, and the app as a remote control

Lightning needs a node that stays online: a small computer or a VPS running the Lightning daemon. This app can connect to your node and act as its remote control, keeping the keys on your machine.

6. Swaps: paying without a node

If you do not run a node, you can still pay a Lightning invoice with an atomic swap through a provider:

  1. the provider pays the invoice immediately on Lightning;
  2. you reimburse the provider on-chain;
  3. an escrow contract with timelocks guarantees that either both legs execute or your funds come back — after the timeout.

What to know before using it:

7. Starting small

  1. Open a channel with a modest amount — enough to pay for a few weeks of tests, small enough to lose without drama.
  2. Leave funds on-chain for fees and for emergencies: an empty on-chain balance with an active channel is a bad place to be.
  3. Pay something to yourself (another wallet, or an invoice you generated) to see confirmations, statuses and fees in the app.
  4. Only then think about inbound liquidity, routing and bigger channels.
Takeaway — Lightning = instant payments inside channels opened with one on-chain transaction. Capacity is fixed, inbound liquidity decides whether you can receive, force closes cost time and money, and swaps let you pay invoices without a node — with a timelock as your safety net.

8. Check yourself

  1. You open a channel with 100 000 sat. Can you immediately receive 5 000 sat over Lightning?
  2. Why does a force close take longer than a cooperative one?
  3. What does the escrow in a swap guarantee, and what does it not guarantee?