BR Academy
0%
The Bitcoin Ecosystem·Lesson 23 of 37·10 min

Layer 2: Lightning Network and Sidechains

The Concept

Base-layer Bitcoin confirms blocks roughly every 10 minutes (from "difficulty-adjustment"), which is secure — every confirmation inherits the full proof-of-work security covered in "the-blockchain" — but relatively slow and, during busy periods, costly for small, frequent payments (per "fees-and-transaction-cost"). Layer-2 networks address this by moving the bulk of transaction activity off the base chain while still relying on it for final security and settlement.

The leading example is the Lightning Network. Two parties open a channel by funding it with a single on-chain transaction. Once open, they can exchange an unlimited number of instant, near-zero-fee payments entirely off-chain, simply by exchanging updated, mutually signed balances directly with each other — none of these intermediate payments touch the base blockchain at all. When the parties are done, either one can close the channel with a single on-chain transaction that settles the final, net balance. Only the opening and closing transactions ever appear on the base chain; everything in between is instant and effectively free.

A Lightning channel: one on-chain open, many off-chain payments, one on-chain close

A direct channel between only two people would be a limited network on its own, so Lightning also supports routing: a payment can hop across a path of several already-open channels between parties who have never directly transacted with each other, as long as a connected route of sufficiently funded channels exists between sender and recipient. Each intermediate node along the route earns a small routing fee for forwarding the payment, and the entire multi-hop payment either completes across every hop simultaneously or fails entirely, using a cryptographic technique that prevents any intermediate hop from stealing the funds mid-route.

Sidechains take a different approach: a separate blockchain, with its own consensus rules (often allowing more programmability or faster finality than Bitcoin's base layer), that is pegged to BTC — value can move from the base chain onto the sidechain and back, convertible at a fixed rate, while the sidechain handles activity under its own rules rather than the base chain's.

Worked Example

Trace a Lightning payment end to end. Alice and Bob want to transact frequently over the course of a day — say, Alice is buying coffee from Bob's shop every morning. They open a channel: Alice funds it with 0.01 BTC in a single on-chain transaction, which (per "fees-and-transaction-cost") might cost a modest fee and take one confirmation to settle, establishing the channel.

Over the following days, Alice makes five coffee purchases, each instantly deducted from her side of the channel balance and credited to Bob's — no on-chain transaction, no mempool wait, no per-payment fee beyond a negligible routing cost. After the fifth payment, suppose Alice has spent 0.003 BTC total across the five purchases. When either party decides to close the channel, a single on-chain closing transaction settles the net result directly: 0.007 BTC back to Alice, 0.003 BTC to Bob — reflecting the accumulated outcome of all five payments, but appearing on the base chain as only one transaction.

Now extend the example with routing. Suppose Alice wants to pay Carol, a vendor she has never directly opened a channel with, but Bob has an open channel with Carol. Alice's payment can route through Bob: Alice's wallet finds the path Alice→Bob→Carol, and the payment travels across both channels as a single, atomic operation — either both hops complete and Carol receives the payment while Bob is reimbursed on his side, or neither hop completes and no funds move at all. Bob earns a small routing fee for forwarding the payment, even though he was not the final recipient, which is the economic incentive that makes third parties willing to keep channels open and liquidity available for routing other people's payments.

Exercise

Explain why a coffee shop processing many small, frequent payments throughout the day would prefer the Lightning Network over on-chain transactions for each individual sale. Your answer should cite the specific fee and speed trade-offs established in "fees-and-transaction-cost" — namely, that an on-chain transaction for a small coffee purchase would incur a fee disproportionate to the purchase amount and take minutes to confirm, while a Lightning payment settles instantly at negligible cost. Then explain in one or two sentences how routing lets Alice pay Carol without opening a direct channel with her, and why Bob is willing to forward that payment.

Recap

  • Layer-2 networks like Lightning move the bulk of transaction volume off the base chain, while still relying on it for the opening and closing settlement transactions.
  • A Lightning channel turns an unlimited number of instant, near-zero-fee off-chain payments into just two on-chain transactions: one open, one close; routing lets a payment travel across a path of existing channels to reach someone you've never directly opened a channel with, with intermediate nodes earning a small fee for forwarding it.
  • Sidechains offer an alternative approach — a separate, pegged chain with its own rules — for use cases where more programmability or faster finality matters more than base-layer settlement for every transaction.

Resources

  • Joseph Poon and Thaddeus Dryja, "The Bitcoin Lightning Network" (lightning.network/lightning-network-paper.pdf) — the original Lightning whitepaper.
  • Lightning Network specifications, "BOLT" documents (github.com/lightning/bolts).
  • Bitcoin Wiki, "Sidechain" (en.bitcoin.it/wiki/Sidechain).