Introduction to Lightning Network Technology
As the first and most popular cryptocurrency ever, Bitcoin clearly offers the strongest security and decentralisation guarantees compared to alternative blockchains. However, regarding its scalability, there is no getting around the maximum block space or the average 10-minute block production interval at the base layer, which limits its throughput to around seven transactions per second. This creates concerns in many users as to whether, with the gradual global adoption and growth of the user base, Bitcoin can be scalable enough to meet the needs of millions of users worldwide.
Over time, as the Bitcoin ecosystem developed, various technological innovations that focused explicitly on solving Bitcoin’s scalability problem began to emerge. One of them is the very popular Lightning Network, a second-layer scaling solution built on top of the Bitcoin network. How did the Lightning Network come about, and how does it work?
The Birth of the Lightning Network
The concept for the creation of the Lightning Network was proposed back in 2015 by Thaddeus Dryja and Joseph Poon, who published a joint whitepaper titled “The Bitcoin Lightning Network: Scalable Off-Chain Instant Payments”. The paper describes a decentralised protocol built on top of Bitcoin that is built on the principle of payment channels and can process off-chain transactions between users on the network.
In 2016, Dryja and Poon founded Lightning Labs, a company dedicated to the development of the Lightning Network. Despite turnover among the team members over time, the developers have continuously worked to make the protocol compatible with the Bitcoin blockchain. The biggest breakthrough in Lightning Network development came with the implementation of SegWit in 2017, which introduced an increase in the block size limit by removing signature data while eliminating a long-standing bug on Bitcoin known as transaction malleability.
After the activation of the SegWit soft fork in the summer of 2017, after a long struggle, the door was opened for the Lightning Network on Bitcoin as well. It should be added, however, that Bitcoin was not the first network on which the Lightning Network was launched. Back in May 2017, the first ever Lightning Network transaction was made on the Litecoin blockchain.
In January 2019, a Twitter initiative was created in which an unknown user with the nickname hodlonaut started a promotional test of the Lightning Network by sending 10,000 satoshis (0.00010000 BTC) to another recipient, with the recipient linking another 10,000 satoshis (roughly $0.35 at the time) to the transaction and sending it to another trusted recipient. Over time, the initiative, officially named “Lightning Torch“, has made its way to prominent figures such as Twitter founder Jack Dorsey, Binance founder Changpeng Zhao, and Litecoin founder Charlie Lee. According to available information, the torch passed through 292 users in more than 40 countries worldwide until it reached a hard-coded limit of 4,390,000 satoshis (0.0439 BTC). The last payment in the challenge went as a donation to Bitcoin Venezuela, a non-profit organisation that aims to popularise Bitcoin in the country.
What is Lightning Network?
Lightning is a second-layer scaling solution built on top of the Bitcoin network and other networks such as Litecoin. The Lightning Network is effectively separate from the blockchain it is built on – it has its own nodes and software but still communicates with the main blockchain.
The Lightning model is built on the principle of peer-to-peer payment channels established between different counterparties. The essence of the Lightning Network is that only the opening and closing of a channel require an on-chain transaction to take place. During the period between the opening and closing of the channel, all transactions are carried out off-chain, i.e. outside the main blockchain. An unlimited number of transactions can be made through payment channels, which are fast, cheap and secure.
To open a payment channel, the user must lock a certain amount of bitcoins into the log. In practice, this involves creating a kind of smart contract with another user, which can be imagined as a mutually shared ledger in which an unlimited number of transactions can be entered. These transactions are visible only to you and your counterparty, and neither party can write unauthorised transactions to this ledger and thus cannot cheat.
Both parties can transfer funds between each other once the channel is open, without these transactions being reflected on the main blockchain. As transactions within the Lightning Network do not need to be approved by all nodes in the network, the use of Lightning significantly reduces the settlement time of transactions. In addition, nodes within the network are able to forward and route transactions even between users who do not have open channels between each other. This makes Lightning a high-speed and high-quality payment system.
If counterparties decide to no longer transact with each other, they can choose to close the payment channel. All the information related to that channel is then merged into a single transaction, which is sent to the main network (e.g. Bitcoin), where settlement occurs. Conducting transactions over Lightning outside of the main network ensures that settlement between counterparties is aggregated into just one transaction. There is no need to perform dozens or hundreds of small transactions on the main network, which would be more expensive, slower, and take up limited block space.
A Practical Example
Let’s imagine that Marek, a programmer and budding entrepreneur from Bratislava who is a big fan of new technologies, goes for lunch every day to a restaurant next to his private office that accepts Bitcoin payments. Marek has agreed with the restaurant’s operators to open a payment channel within the Lightning network, where he will reimburse the restaurant for his lunches. The payment channel, in this case, is a multi-signature address with a 2-2 scheme, which means that there are two private keys for signing a transaction at this address, and both are needed to move funds. To open a channel with a restaurant, Marek sends part of his bitcoins to this address by broadcasting the funding transaction directly on the Bitcoin blockchain.
After opening a payment channel with the restaurant, Marek can make daily payments for his lunches, with payments occurring virtually instantaneously and at a fraction of the transaction fees he would pay with a traditional Bitcoin payment. The open payment channel has its own “ledger” of sorts, which records all transactions made outside of the main Bitcoin blockchain. None of these transactions ever interact with the Bitcoin blockchain, but they still benefit from its security.
With the expansion of Marek’s business and the hiring of several employees, Marek had to move to new offices, but they are more than two kilometres away from the restaurant. So Marek agreed with the restaurant to close the payment channel. When a channel closure occurs on the Lightning Network, all transactions made on the Lightning Network are consolidated into a single transaction and sent to the main Bitcoin network.
Of course, if Mark wanted to, he could buy his lunch through regular bitcoin transactions during the entire time he was in the restaurant. However, he would have to pay network fees for each of these transactions, which in some cases could amount to several dollars, which would not be efficient at all. However, Mark is a smart businessman and knows that thanks to Lightning, he has saved a lot of money on transaction fees in a year and a half. Instead, he only paid a fee when he opened and closed the payment channel.
The Main Advantages of Lightning
Lightning is scalable
Bitcoin itself is only capable of processing approximately 7 transactions per second. Lightning Network aims to solve this limitation by providing fast and cheap transactions, with network throughput that can reach up to 1,000,000 transactions per second.
Lightning is cheap
Fees for normal bitcoin transactions can be really expensive, especially during periods of high demand. The average transaction fee on the bitcoin network is currently around $1.5, which in some cases can be higher than the value of the goods you are paying for (for example, buying coffee with bitcoin). Lightning provides an economical way to make payments of any size. The average transaction fee on Lightning is one satoshi, which is approximately $0.00022. This opens the door for making everyday micropayments via Bitcoin, whether for coffee, lunch, or anything else.
Lightning is interconnected
The Lightning Network allows users to interact even with users with whom they don’t have open payment channels. If Entity A has an open channel with Entity B and Entity B has an open channel with Entity C, then Entity A can transact with Entity C without having to open a new payment channel.
Lightning is fast and private
While on Bitcoin, transaction blocks arrive approximately once every ten minutes, with a transaction considered valid after 2-4 block confirmations (20-40 minutes), transactions within the Lightning Network are settled instantly. At the same time, transactions made within Lightning take place in so-called channels instead of the public Bitcoin blockchain, which are not completely transparent. Lightning thus helps in improving the privacy of transactions.
Transaction Redirection – Interconnectivity
Consider model situation number two, in which Adam has an open payment channel with Beata and Beata has an open channel with Charlie.
All three entities meet at a restaurant for a joint company meeting. However, Adam hardly knows Charlie because, although Charlie works for the same company, he came to the party as a branch representative from another city. Charlie decided to pay the bill for the whole get-together via Bitcoin.
Adam, however, wants to get even with Charlie for his dinner and drinks. Since Adam has almost no contact with Charlie, he has no open payment channel with him. At the same time, since they do not foresee interacting with each other in the future, creating a joint channel makes no sense to them.
The fact that Adam and Charlie are not connected together does not preclude the possibility of using Lightning to settle each other’s dinner bill. Since Adam has an open channel with Beata, and Beata has an open channel with Charlie, there is a possibility of a mutual settlement between them.
Beata agrees to broker Adam’s payment of 0.001 BTC to Charlie in exchange for a small routing fee of 100 satoshis. The payment that goes through the intermediary is referred to as a “hop” in practice. In practice, a single payment can go through a maximum of 20 hops, but the fewer hops, the better – each additional hop comes with an additional cost for routing the transaction by default.
One of the most common criticisms of Lightning is the limitations of conducting larger transactions. In practice, users within Lightning can only spend funds that they have locked up in the payment channel. For example, if you put 0.2 BTC into a channel and spend it over time, your counterparty will have all the funds, and you will only be left with the option to close the channel or wait for someone to pay you, which is not ideal.
One of the problems is the limited capacity of the channels. Suppose that Adam and Beata have a capacity of 5 BTC on their channel (Adam 3 BTC and Beata 2 BTC), but Beata and Charlie only have a capacity of 1 BTC (Beata 0.5 BTC and Charlie 0.5 BTC). In that case, Adam will never be able to send more than 0.5 BTC to Charlie due to the fact that Beata is the intermediary between Adam and Charlie.
Centralisation of nodes
There is concern within the community that, over time, large players with lots of capital will enter the Lightning Network and may become “centralised intermediaries”. Any payments of a higher amount would have to be routed through them since they have sufficient capacity and liquidity to redirect transactions.
It is probably clear to everyone that this is not an optimal scenario. It would weaken the system because, for example, taking these nodes offline could make it significantly more difficult or impossible to make payments within the LN network.
Lightning Network Status
According to bitcoinvisuals.com, more than 16,000 nodes are currently active in the Lightning Network. In total, up to 76 thousand payment channels are established with a total capacity of 5390 BTC ($120 million). The average capacity per channel is around 6,713,000 satoshi (0.06713 BTC – about $1,500), and the average capacity per node is around 60,940,000 satoshi (0.6094 BTC – roughly $13,000). Each node has an average of 9 payment channels open.INVEST WITH FUMBI