Lightning Network logo

Lightning Network

Status
Mainnet
Type
State Channel
Fee Token
BTC
TVL
₿ 5122
The Lightning Network (sometimes known as Lightning) is a payment-channel-based Layer 2 for payments. It enables users to open a payment channel with a counterparty and make an unlimited number of payments within the channel. It also enables users to route payments across a network of these channels to users outside of their specific channel.
BRIDGE
DATA AVAILABILITY
OPERATORS
SETTLEMENT ASSURANCE
Risk Analysis
Bridge Custody
Low risk
Users custody their funds with their counterparty
When a user opens a payment channel, they deposit their funds into a 2-2 multi-signature address with their counterparty via an onchain Bitcoin transaction. This address holds the funds that are transferred within the channel, and users can collaboratively exit a channel by agreeing on a final state before signing off on withdrawals. If a channel counterparty is unresponsive to a cooperative channel closure attempt, then users can unilaterally exit the channel by spending an uncooperative channel closure transaction onchain. There is a challenge-response mechanism to settle potential disputes between channel counterparties over the final state of a channel closure transaction.
Data Availability
Low risk
Users are responsible for fulfilling the data availability requirement. State data is self-hosted by default
Lightning users must be responsible for their own data availability, rather than relying on a network of nodes to complete this function. If users irrecoverably lose their channel state data, then they will lose all of the funds they had in the channel.
Network Operators
Low risk
L2 transactions are done via a peer-to-peer network
In a payment channel, users interact in a peer-to-peer fashion, meaning no sequencer or block builder is needed. If a user wants to transfer funds to someone who is not in their specific channel, they can route their payment across a network of nodes to reach the receiver. If a channel counterparty fails to route the payment, the user will have to go through another channel (if they have another open, and there is a route to the recipient) or back onchain to transfer funds to the intended recipient.
Settlement Assurance
Low risk
Onchain settlement is optimistic
Lightning Network transactions are only considered final when a channel is closed. Bitcoin consensus enforces this closure as it would any other transaction. When closing a channel, users can collaboratively sign off on a final state, have this state validated by Bitcoin consensus, and then proceed to withdraw their funds. If a user disagrees on a final state proposed by their counterparty, they have a fixed-duration period of time to challenge it, and if the challenge is successful, then the challenger receives the entire balance of the channel that was closed. This challenge-response mechanism, which can end in the challenger receiving all of the channel funds, incentivizes channel counterparties to only close channels using the correct final state.
Bitcoin Security
Settlement is finalized by Bitcoin consensus
As mentioned in the risk analysis, settlement is optimistically finalized by Bitcoin consensus.
The protocol does not enable MEV on Bitcoin
Lightning does not enable malicious forms of MEV on Bitcoin. Since all transactions are done offchain within a payment channel, miners are unable to influence the ordering of transactions done via Lightning.
No alternative token needed for network security
Lightning does not use another token for network security.
Opening and closing channels contributes to the security budget
Lightning does not directly contribute to Bitcoin’s security budget, but users do pay onchain transaction fees to miners when they open, and close, Lightning channels. .
Withdrawals
Users can unilaterally withdraw their funds with optimistic settlement guarantees
Users can close a channel and withdraw their funds at any time. They can close a channel collaboratively with their counterparty by agreeing on the final state of the channel and withdrawing their balances to their respective addresses. In the event of a dispute over the final state, the Lightning Network’s model is optimistic. A malicious user can attempt to steal channel funds by submitting a channel closure transaction with an old state. If their counterparty is offline with no watchtower for the entire duration of the challenge period then the old state will be finalized, allowing the theft to succeed. If the counterparty, or their watchtower, is online during the challenge period, then they can submit a challenge transaction onchain that will stop the theft attempt and sweep the full balance of the channel that was incorrectly closed. Users should be aware that the cost of challenging an incorrect channel closure attempt could eat significantly into the channel balance, to the point of being uneconomical, if bitcoin fee rates are prohibitively expensive. Users should also be aware that if they are unable to confirm their challenge transaction before the end of the challenge period, for example because their transaction is being withheld by bitcoin miners, then they risk losing the full balance of their channel to their counterparty.
Technology
Payment channels
Payment channels are 2-2 multi-signature addresses that enable two counterparties to lock funds into an address, and process an unlimited number of payments between each other. Payments are considered final when the parties withdraw their funds back onchain and close their channel. Creating and managing one or more payment channels lis how a user interacts with Lightning.
Network routing
Lightning is a network of various two-party payment channels. Users can route their payments across a variety of channels to reach a final destination (the recipient). Atomicity is enforced via a script that ensures that the transaction either reaches its intended recipient, or it fails entirely.
Hashed Timelock Contracts (HTLCs)
HTLCs are smart contracts that ensure conditional and atomic payments. HTLCs are used in Lightning to enable transaction routing across multiple nodes. These contracts are designed in a way that sees routed payments happen atomically; meaning the payment either succeeds or fails entirely. Routing nodes are unable to misappropriate funds as they are unable to reveal a secret preimage which is conditional to the transaction being finalized. Only the intended receiver has access to the secret preimage which was created when they generated the transaction’s invoice.
Use Cases
Micro-transactions
With its low fees, Lightning is well-suited for small or high frequency transactions.
Faster transactions
With its near-immediate confirmations due to being offchain and using P2P consensus, Lightning is well-suited for fast transactions.
Interoperability
Lightning can act as an interoperability layer between blockchain protocols and bridge operators.
Lightning Service Providers (LSP)
A LSP deploys liquidity in Lightning on behalf of others. LSPs improve Lightning’sUX for users by essentially supplying liquidity and managing payment channels on their behalf. Managing a payment channel can come with a number of UX hurdles, so LSPs remove the majority of the complexity and charge fees to be compensated. These providers ideally interact with users in a way that ensures that users retain custody of their funds. However, even when using a self-custodial wallet supported by an LSP, users still have to initiate mainchain transactions to deposit funds into their wallet.
Operator
The Lightning Network is peer-to-peer
The only operators involved are the user and the counterparty with whom they open the payment channel. Users can transitively interact with others who have open channels with their counterparty(ies). The Lightning Network operators have to run their own node and must have near-perfect uptime to ensure their channels are not being force-closed or closed with an old channel state. Leveraging a self-custodial wallet supported by an LSP ensures users retain the custody of their funds, but the LSP operator can choose to stop servicing users at any point, meaning that users must withdraw their funds to an onchain address and find a new LSP.
Source Code
Code is open-source
There are multiple free and open-source implementations of the Lightning Network protocol.