What Is the Lightning Network?
Table of Contents
- The Lightning Network enables users to transact bitcoin in a near-free and instant manner.
- The Lightning Network is an example of how Bitcoin can become a global medium of exchange without sacrificing the security or decentralization of the Bitcoin network.
- While the Lightning Network is fully functional, it is still experimental and should not be used to store or transact large volume.
Bitcoin’s blockchain can only process an average of 7 transactions per second. This is not enough to make Bitcoin a suitable platform for handling the millions of transactions humans make every day. Thus, if Bitcoin is to become a medium of exchange, payment systems must be built which allow users to transact bitcoin quickly and cheaply. The Lightning Network is one such payment system.
What Is the Lightning Network?
The Lightning Network is a second-layer protocol designed to enable off-chain Bitcoin transactions, which are not recorded on the blockchain. Because they are not recorded on the blockchain, and thus require no mining, Lightning payments are extremely fast and cheap.
How Does the Lightning Network Work?
Similar to the Bitcoin network, the Lightning network is made up of nodes running the Lightning Network software. Unlike the Bitcoin network however, Lightning transactions are not publicly broadcast and stored by all members of the network. Instead, individual Lightning nodes transact with one another privately. Lightning nodes use channels to execute such payments.
What Is a Lightning Payment Channel?
A Lightning channel is a bidirectional payment channel, meaning both parties can send and receive payments across the channel. Lightning channels comprise the Lightning Network and have a defined bitcoin capacity. This capacity is split between the two parties to the channel, and bitcoin is moved from one side of the channel to the other by Lightning transactions.
Opening a Lightning Channel
Two parties open a Lightning channel by depositing bitcoin in a 2-of-2 multisig address. This transaction is recorded on the Bitcoin blockchain, and when this transaction is confirmed, the Lightning channel is opened. Once open, a Lightning channel enables both parties to execute any number of transactions cheaply and instantly. When the two parties are done transacting, they can close the channel with another on-chain Bitcoin transaction, which will reflect the net change in both of their balances.
Transacting Over a Lightning Channel
A payment channel is a pool of funds divided between two parties. These funds are always stored in the multisig address—there is no extra token or representation of the bitcoin created by the Lightning Network. Lightning transactions occur over this channel by redistributing the funds stored in the multisig address. Whenever bitcoin is spent through the channel—from party A to party B—the channel’s balance updates. However, these updates are not recorded on the blockchain.
In the example below, Alice and Bob open up a channel and deposit 1 BTC each in a multisig address. Then Bob pays Alice 0.5 BTC on the Lightning Network. The shared balance is still 2 BTC, but 1.5 BTC belong to Alice, and 0.5 to Bob.
Closing a Lightning Channel
The settlement of the funds will occur when both parties decide to close the channel. When the channel closes, an on-chain transaction will be recorded on Bitcoin’s blockchain, spending bitcoin from the multisig address. When this happens, the balance in the channel is settled. Alice will now have 1.5 BTC and Bob will now have 0.5 BTC.
Routing Payments Over Lightning
The fundamental building blocks of the Lightning Network are nodes and payment channels that allow nodes to communicate with one another. Naturally, not every node will be connected to the node that it wants to send a payment to. Routing is what allows transactions between two unconnected parties to occur through a series of pre-existing channels.
How Does Lightning Routing Work?
Imagine that Alice wants to pay Carol over the Lightning Network, but does not have a direct channel with Carol. However, both Alice and Carol have channels with Bob. A cryptographic process allows Alice to send a payment to Bob with the assurance that Bob will forward the payment to Carol. In exchange for his assistance, Bob will receive a small fee.
Routing is enabled by Hashed Time Locked Contracts (HTLCs). An HTLC is a special type of Bitcoin transaction which serves as a smart contract. In the context of the Lightning Network, HTLCs are used to allow Alice to promise payment to Bob only if he can prove that he has paid Carol the proper amount.
Who Developed the Lightning Network?
Thaddeus Dryja and Joseph Poon first introduced the Lightning Network in their white paper, 'The Bitcoin Lightning Network: Scalable Off-Chain Instant Payments' in 2015.
Different Lightning Implementations
While these three implementations are written in a different programming language, they are all compatible with one another. All Lightning implementations follow the standards set by the Basis of Lightning Technology (BOLT), a set of rules ensuring that Lightning implementations can achieve consensus and interoperability. Thanks to the BOLT specifications, there is only one Lightning Network protocol.
Invest in Bitcoin.