Blockchain/Level V · Layers/5.1 Lightning/Lesson 1
Payment channels
Two signatures, thousands of payments: the mechanics of off-chain settlement
MaterialsA block explorer capable of viewing multisig inputs (e.g., mempool.space)The BOLT #2 specification documentA graphing tool to visualize the funding and commitment transaction structures
Wonder
- How can two parties conduct thousands of instant payments while only submitting two transactions to the Bitcoin blockchain?
- What mechanism prevents a participant from broadcasting an older commitment transaction that favors their balance?
- Why were the first payment channels, described by Jeremy Spilman in 2013, one-way only?
Explore
- Bitcoin’s base layer settles transactions at approximately ten-minute intervals, creating latency and fee constraints for high-frequency micro-payments. Payment channels relocate the computational burden of state updates off-chain, allowing participants to exchange signed balance states indefinitely without network propagation. The on-chain blockchain serves solely as a settlement layer, verifying only the initial funding and final closure events.
- The channel begins with a funding transaction: a 2-of-2 multisig output locking funds controlled by both Alice and Bob. If each contributes 1 BTC, the channel capacity is 2 BTC. Neither party can unilaterally spend these funds without the other’s signature. This structure binds the participants together in a shared account that exists only as a potential claim on the main chain.
- During operation, Alice and Bob exchange commitment transactions representing new balance distributions. Each update replaces the previous state; if Alice sends 0.1 BTC to Bob, they sign a new transaction moving funds from Alice’s output to Bob’s. These signed but unbroadcast transactions are valid Bitcoin transactions, ensuring that any final state can be enforced on-chain without relying on counterparty trust.
- Each side must also be stopped from broadcasting an outdated state that paid it more. Lightning does this with revocation secrets and timelocks, covered in a later lesson; in short, publishing a revoked state lets the other party take the whole channel balance, which makes cheating a losing bet.
- Closure occurs either cooperatively or unilaterally. In a cooperative close, both parties sign a settlement transaction that pays their final balances immediately without timelocks. If one party disconnects or acts maliciously, the other can force-close by broadcasting the latest commitment transaction. On this unilateral path, the party who force-closes must wait out a relative timelock before spending its own share, leaving time for a penalty claim; the other party’s output is available almost at once.
- Precursors include Jeremy Spilman’s one-way channels (2013), in which payments could flow only from payer to payee, and Christian Decker and Roger Wattenhofer’s duplex channels (2015). Joseph Poon and Thaddeus Dryja’s Lightning Network paper (2015 draft, 2016 version) added revocable commitments, so a channel can stay open indefinitely, and HTLCs, so payments can route across many channels. Mainnet implementations like LND, Core Lightning, and Eclair now manage these states, with significant adoption beginning in earnest during 2018.
Key facts
- A payment channel locks funds in a 2-of-2 multisig output, requiring both signatures for on-chain spending.
- Commitment transactions are signed but unbroadcast updates that redistribute the channel balance; each new state replaces the last.
- Revocation secrets allow the counterparty to claim the entire channel balance if an outdated commitment transaction is broadcast.
- Cooperative closes settle balances immediately via a timelock-free settlement transaction; unilateral closes impose relative timelocks for penalty verification.
- Jeremy Spilman’s 2013 one-way channels and Decker/Wattenhofer’s 2015 duplex channels were the primary precursors to the Lightning Network.
- Main implementations include LND (Lightning Labs), Core Lightning (Blockstream), Eclair (ACINQ), and LDK, with mainnet usage accelerating from 2018.
Exercise nine, six, three, one
9CollectList 9 distinct technical components or protocols involved in opening, updating, and closing a payment channel.
6ClusterGroup the 9 into 6 categories based on their function: funding, state management, security enforcement, closure mechanics, routing prerequisites, or implementation standards.
3DistillReduce the 6 groups to 3 core principles that guarantee trustless operation between two parties.
1CrystallizeWrite 1 sentence on why two on-chain transactions can settle any number of off-chain payments.
Fact check
Dates, figures and claims checked against the published sources listed below.