‹ CHAPTER 12, ALL LESSONS

PATHFINDER · CHAPTER 12 · LESSON 3 OF 5

The Lightning Network

Routing payments

Do you need a channel with every shop you pay? 5 min

No. Channels connect into a network. If Alice has a channel with Bob, and Bob has one with Carol, Alice can pay Carol through Bob, without ever having met Carol.

A secret that makes it all or nothing

Carol creates a random secret and gives Alice its hash inside an invoice. Alice offers Bob a payment that Bob can claim only by revealing the secret. Bob offers Carol the same deal. When Carol claims the payment, the secret is revealed, and Bob uses it to claim the payment from Alice. These locked payments are called HTLCs, hashed time locked contracts.

Either every hop completes, or none does. Bob can never take Alice's money without paying Carol, and if anything fails, time locks return the funds.

Onion routing

The route is wrapped in layers of encryption. Each hop only learns where the payment came from and where to send it next, not who sent it first or who receives it last. Routing nodes may charge a small fee for the service.

▶ SEE IT IN THE MACHINE

At the LIGHTNING NETWORK stop, payments hop from channel to channel in a flash.

What to remember

  • Payments can route through other people's channels.
  • HTLCs make a multi hop payment all or nothing.
  • Onion routing hides the full path from each hop.

Quick check

Why can't an intermediate node keep the money passing through it?

What does each routing node learn about a payment?