What Is the Lightning Network?
The lightning network is a second layer technology applied to bitcoin that uses micropayment channels to scale its blockchain’s capability to conduct transactions more efficiently. Transactions conducted on lightning networks are faster, less costly, and more readily confirmed than those conducted directly on the bitcoin blockchain (i.e., on-chain).
By taking transactions away from the main blockchain and making them off-chain, the lightning network was designed to de-congest the bitcoin blockchain and reduce associated transaction fees. The lightning network can also be used to conduct other types of off-chain transactions involving exchanges between cryptocurrencies.
Understanding the Lightning Network
If it is to achieve its potential of becoming a medium for daily transactions, bitcoin will need to reach tens or hundreds of thousands of transactions per second, similar to credit cards or electronic payments networks. Due to the nature of its decentralized technology that requires consensus from all nodes within its network, bitcoin is laden with such problems in its current state.
For example, approving and storing transactions will become expensive and time-consuming if their numbers on bitcoin’s network multiply. An increase in transaction numbers also requires orders of magnitude improvement in the processing power of the computers that are required to execute transactions involving bitcoin. Additionally, the energy necessary to compute this information is enormous, making maintaining bitcoin for day-to-day transactions prohibitively expensive.
The lightning network proposed to solve the scaling problem by creating a second layer on bitcoin’s main blockchain. That second layer consists of multiple payment channels between parties or bitcoin users. A lightning network channel is a transaction mechanism between two parties. Using channels, the parties can make or receive payments from each other.
How the Lightning Network Works
Say Alice opens a channel with her favorite coffee shop and deposits $100 worth of bitcoin in it. Her transactions with the coffee shop are instant because she has a direct channel with it.
Bob, who has another channel open with the grocery store he visits most frequently, also buys coffee from Alice’s shop. The connection between Alice, the coffee shop, and Bob ensures that Alice can use funds from her balance with the coffee shop to buy groceries from Bob’s store. Similarly, Bob can use his grocery store balance to conduct transactions with businesses in Alice’s network.
If Bob closes his channel with the grocery store (and there are no other customers in common between the coffee shop and grocery store), then Alice will have to open another channel with the grocery store to make purchases there. In this way, a web of transactions is created and routed between multiple lightning nodes in a decentralized fashion.
On a more technical level, the lightning network uses smart contracts and multi-signature scripts to implement its vision. An initial transaction, called the funding transaction, is created when one or both parties fund a channel. In a typical multi-signature environment, two master keys (one public and another private) are initially exchanged. The exchange facilitates access and spending of funds.
In the case of a lightning node, however, the signatures are not exchanged. This is done to prevent the funding transactions’ spend from being recognized by the main blockchain. Instead, the two parties exchange a single key that is used to validate spending transactions (also called commitment transactions) between themselves.
The two parties can conduct endless commitment transactions between themselves and other nodes on a lightning network. They exchange their master keys only when the channel between them is closed.
Are There Fees for Using Lightning Network?
Yes, there are transaction fees associated with using the lightning network. They are a combination of routing charges for routing payment information between lightning nodes and bitcoin’s transaction fees to open and close channels.