"Layer 2" payment protocol that operates on top of a blockchain-based cryptocurrency
Example ACFKLQ routing through an idealized mesh network of payment channels.
The Lightning Network is a "layer 2" payment protocol designed to be layered on top of a blockchain-based cryptocurrency such as bitcoin or litecoin. It is intended to enable fast transactions among participating nodes and has been proposed as a solution to the bitcoin scalability problem. It features a peer-to-peer system for making micropayments of cryptocurrency through a network of bidirectional payment channels without delegating custody of funds.
Normal use of the Lightning Network consists of opening a payment channel by committing a funding transaction to the relevant base blockchain (layer 1), followed by making any number of Lightning Network transactions that update the tentative distribution of the channel's funds without broadcasting those to the blockchain, optionally followed by closing the payment channel by broadcasting the final version of the settlement transaction to distribute the channel's funds.
On January 19, 2019, pseudonymous Twitter user hodlonaut began a game-like promotional test of the Lightning Network by sending 100,000 satoshis (0.001 bitcoin) to a trusted recipient where each recipient added 10,000 satoshis ($0.34 at the time) to send to the next trusted recipient. The "lightning torch" payment reached notable personalities including Twitter CEO Jack Dorsey, Lightning Labs CEO Elizabeth Stark, and Binance CEO "CZ" Changpeng Zhao, among others. The lightning torch was passed 292 times before reaching the formerly hard-coded limit of 4,390,000 satoshis. The final payment of the lightning torch was sent on April 13, 2019 as a donation of 4,290,000 satoshis ($217.78 at the time) to Bitcoin Venezuela, a non-profit that promotes bitcoin in Venezuela.
Andreas Antonopoulos has referred to the Lightning Network as a second layer routing network. The payment channels allow participants to transfer money to each other without having to make all their transactions public on the blockchain. This is done by penalizing uncooperative participants. When opening a channel, participants must commit an amount (in a funding transaction, which is on the blockchain). Time-based script extensions like CheckSequenceVerify and CheckLockTimeVerify make the penalties possible.
"If we presume a large network of channels on the Bitcoin blockchain, and all Bitcoin users are participating on this graph by having at least one channel open on the Bitcoin blockchain, it is possible to create a near-infinite amount of transactions inside this network. The only transactions that are broadcast on the Bitcoin blockchain prematurely are with uncooperative channel counterparties."
There are several claimed future benefits to using the Lightning Network compared to on-chain transactions:
Granularity: According to Andreas Antonopoulos, some implementations of the Lightning Network allow for payments that are smaller than a satoshi, the smallest unit on the base layer of bitcoin. Routing fees paid to intermediary nodes on the Lightning Network are frequently denominated in millisatoshis or msat.
Privacy: The details of individual lightning network payments are not publicly recorded on the blockchain. Lightning network payments may be routed through many sequential channels where each node operator will be able to see payments across their channels, but they will not be able to see the source nor destination of those funds if they are non-adjacent.
Speed: Settlement time for lightning network transactions is under a minute and can occur in milliseconds. Confirmation time on the bitcoin blockchain, for comparison, occurs every ten minutes, on average.
Transaction throughput: There are no fundamental limits to the amount of payments per second that can occur under the protocol. The amount of transactions are only limited by the capacity and speed of each node.
The Lightning Network is made up of bidirectional payment channels between two nodes which combined create smart contracts. If at any time either party drops the channel, the channel will close and be settled on the blockchain.
Due to the nature of the Lightning Network's dispute mechanism, which requires all users to watch the blockchain constantly for fraud, the concept of a "watchtower" has been developed, where trust can be outsourced to watchtower nodes to monitor for fraud.
In the event that a bi-directional payment channel is not open between the transacting parties, the payment must be routed through the network. This is done using an onion routing technique similar to Tor, and it requires that the sender and receiver of the payment have enough established peers in common to find a path for the payment. In effect, a simple route would look like this:
Bob wants to pay Alice 1 BTC but Bob and Alice don't have a channel open with each other.
Bob does have a channel open with Carol, and Alice also has a channel open with Carol
To route the payment, Bob sends 1 BTC to Carol, and Carol then sends 1 BTC to Alice
The original whitepaper in reference to routing suggests that "eventually, with optimizations, the network will look a lot like Tier-1 ISPs".
Cryptocurrency exchanges such as Bitfinex use it to enable deposits and withdrawals. Laszlo Hanyecz, who gained fame in the cryptocurrency community for paying 10,000 BTC for two pizzas in 2010, bought two more pizzas in 2018 using Lightning Network and paid 0.00649 BTC.
^Ajiboye, Timi; Buenaventura, Luis; Gladstein, Alex; Liu, Lily; Lloyd, Alexander; Machado, Alejandro; Song, Jimmy; Vranova, Alena (2019-08-14). The little bitcoin book : why bitcoin matters for your freedom, finances, and future. Redwood City, CA: 21 Million Books. ISBN978-1-64199-050-9.