Skip to main content
Layer 2s and scaling

Lightning Network: Bitcoin's Layer 2

Pomegra Learn

Lightning Network: Bitcoin's Layer 2

The Lightning Network is a practical realization of payment channel technology applied to Bitcoin. Launched as a beta in 2018, it has grown into a functioning payment network with thousands of channels and hundreds of millions of dollars in capacity. Lightning solves the fundamental routing problem of payment channels: it allows payments to flow between parties who don't have a direct channel, by routing the payment through intermediate nodes. This transforms payment channels from a bilateral technology into a scalable network.

The Routing Problem

As discussed in Payment Channels Basics, a single payment channel connects only two parties. Alice and Bob can transact instantly with a channel between them, but Alice can't pay Charlie unless she has a separate channel with Charlie. Creating a different channel for every possible pair of people would require billions of channels—clearly impractical.

Lightning solves this through routing. Imagine Alice wants to pay Charlie, but they don't have a direct channel. If Bob has channels with both Alice and Charlie, the payment can route: Alice sends Bitcoin to Bob through their channel, and Bob forwards it to Charlie through his channel with Charlie. The payment never travels through the blockchain; it hops from channel to channel until it reaches the destination.

This is conceptually simple but cryptographically complex. The challenge is ensuring that Bob can't steal the Bitcoin. He needs to forward it to Charlie while also receiving it from Alice, and these need to happen atomically—either both happen or neither happens.

Atomic Swaps and Hash Time-Locked Contracts

Lightning solves this using hash time-locked contracts (HTLCs). Here's how it works:

Step 1: Create a secret. Charlie generates a random number called a preimage, hashes it, and sends the hash to Alice.

Step 2: Lock with timeout. Alice tells Bob: "If you can show me the preimage of this hash within 1 hour, I'll send you Bitcoin." Bob tells Charlie: "If you can show me the preimage of this hash within 30 minutes, I'll send you Bitcoin."

Step 3: Reveal the secret. Charlie reveals the preimage to Bob, proving he knows it. Bob forwards the preimage to Alice, revealing it to her.

Step 4: Settlement. All three update their channel balances, effectively transferring Bitcoin from Alice to Bob to Charlie, with the routing happening automatically.

The time windows are critical: Alice's lock expires after 1 hour, Bob's expires after 30 minutes. This means Bob must get Charlie's preimage and forward it to Alice before his lock expires. If Charlie doesn't cooperate, the transaction unwinds: Alice's money returns to her, Bob's money returns to him, and Charlie gets nothing.

Network Topology

The Lightning Network isn't a single organization. It's a peer-to-peer network where anyone can run a node. Node operators can create channels with anyone, and payments can route across the network. The resulting network has a topology similar to the Internet: well-connected hubs (lightning channels with large capacity and many connections) plus individual users connecting to the network.

By the mid-2020s, Lightning has:

  • Over 16,000 public channels
  • Hundreds of millions of dollars in total capacity
  • Thousands of nodes (though exact numbers vary because nodes can operate privately)
  • Growing daily transaction volume

The network is still far from its potential. Most channels are relatively small, and the routing efficiency still improves as more hubs form and liquidity concentrates. But the existence of a functioning routing network proves the concept works.

Payment Flow in Practice

From a user's perspective, Lightning payments work like this:

  1. Request invoice. The recipient generates an invoice containing a hash-based identifier, the amount, and other details.

  2. Send payment. The sender's node identifies a route to the recipient, creates hash-locked contracts along the path, and sends the payment.

  3. Receive notification. The recipient's node receives the payment and immediately notifies the recipient. The payment is essentially complete.

  4. Settle on channels. The preimage is revealed and travels back through the network, updating all intermediate channel balances. This happens within seconds, but the exact timing isn't critical from the user's perspective.

The entire process takes 1-5 seconds, compared to 10 minutes for Bitcoin and sometimes hours during congestion. Fees are micropayments: often under a cent, even for international payments.

Advantages and Limitations

Advantages:

  • Instant payments: Users see funds arrive in seconds rather than minutes or hours
  • Minimal fees: Routing fees are typically under one cent, even for international transfers
  • Scalability: Lightning can theoretically handle billions of transactions per second once the network is fully developed
  • Bitcoin security: All Lightning payments are ultimately secured by Bitcoin's blockchain
  • Privacy: Lightning payments are less visible on the blockchain than on-chain transactions

Limitations:

  • Channel management: Users need to open and close channels, requiring blockchain transactions with fees
  • Liquidity: Channels must have sufficient balance in the right direction for payments to route. If Alice wants to send Bob money repeatedly, Bob's side of the channel will eventually fill up, and Alice will need to send money through a different route or open a new channel
  • Onboarding friction: New users must bootstrap liquidity, either by receiving payments or paying to open channels
  • Always-on requirement: Nodes must monitor the network to prevent other nodes from broadcasting old channel states
  • Routing failures: If a path doesn't exist or intermediate nodes are offline, payments fail. Users see a failed payment and might need to retry on a different path

The liquidity problem is real: researchers have shown that even with many channels, a significant percentage of payments fail because no route exists with sufficient balance. This doesn't make Lightning impractical—traditional payment systems have liquidity constraints too—but it means Lightning works better as a network with depth and resilience than as a simple point-to-point channel.

Use Cases

Lightning is particularly useful for:

Streaming micropayments: Content creators can receive payments per minute of content consumed. Users prepay into a channel and pay as they use.

Cross-border remittances: Sending money between countries can take days and costs 5-10% in fees. Lightning can do it in seconds for under a cent.

Point-of-sale payments: Retail merchants can accept Bitcoin instantly and settle to their bank when convenient.

Settling up between services: If two cryptocurrency exchanges frequently need to transfer Bitcoin, a Lightning channel lets them do so instantly instead of waiting for blockchain confirmation.

Development and Adoption

Multiple Lightning implementations exist: LND (Lightning Labs), Eclair (Acinq), and c-lightning (Blockstream). Different implementations have varying levels of privacy, performance, and feature support, but they interoperate through the Lightning specification.

Adoption has been steady but not explosive. El Salvador adopted Lightning for national payments in 2021, though usage has been modest. Various Bitcoin wallets (Phoenix, Breez, Muun) integrated Lightning seamlessly. Strike (a payments company) built a business on top of Lightning. The growth suggests Lightning is becoming functional infrastructure rather than remaining experimental.

However, Lightning's actual transaction volume remains a fraction of Bitcoin's capacity. This suggests that while Lightning is superior for certain use cases, it hasn't yet achieved the mainstream adoption that would fully utilize its capacity. The reasons are probably some combination of: user education needed, merchant adoption lagging, liquidity challenges, and the fact that Bitcoin's current fees aren't painful enough to force migration.

Comparison with Other Layer 2s

Plasma and rollups are Ethereum-focused Layer 2 solutions that work differently than Lightning. Lightning is specific to Bitcoin and works with payment channels. Rollups batch many transactions and post them to the blockchain. Each approach has trade-offs in finality speed, throughput, and decentralization.

For Bitcoin, Lightning remains the most developed Layer 2. For Ethereum, rollups have attracted more development and adoption because they support arbitrary smart contracts, not just payments.

Summary

The Lightning Network applies payment channels to Bitcoin through a routed network using hash-locked contracts. This allows any two users to send payments through intermediate nodes, enabling instant Bitcoin transfers with minimal fees. Lightning has grown into a functioning network with real usage, proving that Bitcoin can scale beyond its base-layer limitations. Limitations around liquidity management and channel bootstrapping remain, but Lightning demonstrates that payment channel scaling is practically viable. For many Bitcoin use cases—especially micropayments, streaming, and cross-border transfers—Lightning provides a superior user experience compared to blockchain confirmation times and fees.


Next: Plasma: An Ethereum Scaling Solution