Crypto Guides

Go Back

Lightning Network Explained! Bitcoin’s Second Layer Scaling Solution

by | Sep 29, 2018

If you’ve heard about the Lightning Network and wondered why Bitcoin needs a scaling solution, this article is for you. After all, why can’t scaling just be achieved on the main blockchain itself? And furthermore, why would we even need a “second layer” solution like the Lightning Network? What is the Lightning Network exactly and how does it aim to solve the scaling issue?

This article provides insight and explanation to the myriad of questions surrounding the Lightning Network. We’ll explore the existing concerns and discuss if it will even solve the scaling problem at all.

What is the Lightning Network?

The Lightning Network is a second layer off-chain solution for Bitcoin’s scaling problem. The goal is to technologically support Bitcoin mass adoption while keeping the coin useful, affordable, decentralized, and censorship-resistant. It does this by opening payment channels between 2 users/peers that (normally would) have established relationships and don’t require trust. Subsequently the payment channels together form a network that can process much more transactions than the Bitcoin blockchain would be able to on its own main chain. And it can do this instantaneously, at very low fees, all while keeping the same security and decentralization.

Each channel on the Lightning Network can process an enormous amount of payments, but only broadcasts the final state of the channel to be recorded on the Bitcoin blockchain when a channel is closed. This way, all intermediate transactions do not need to be recorded on the main chain – which theoretically decreases the workload and increases the capacity enormously for the whole network.

Why Does Bitcoin Need a Scaling Solution?

In the early years, whenever the Bitcoin blockchain network grew in users and transactions, the block-size (soft) limit* was simply raised in order to keep up with demand. Block sizes were kept big enough to easily accommodate the demand for all transactions, but also small enough to be processed by the network easily. In those years, large block sizes would have created problems on the network due to technological limitations at the time. This way, nobody had to compete by raising the transaction fee to incentivize miners to include their transaction in a block.

*For the advanced reader – the block size “hard” limit in the code was technically already 1 MB since 2010 (but it was designed to be relatively straightforward to increase it if needed). At that time 1 MB was far more than what was actually being used and lower “soft” limits were imposed. Those were steadily increased when the network required it. In 2013 when a code upgrade was required, the block size limit became officially 1 MB and remained that way from then on, because no further block size increases could be agreed upon by the community.

But at some point, it was argued that continuously raising the block size would not be enough to grow Bitcoin sustainably to compete with existing worldwide payment networks in terms of speed and fees (while maintaining security and decentralization). Blocks were filling up too quickly and fees were increasing again. One easy solution would be to compromise on security and make the currency more centralized.  But that would defeat the whole purpose of Bitcoin – decentralization is a key feature that ensures the censorship-resistant and permission-less nature of Bitcoin.

Critics argued that increasing the block size could not be sustained technically nor economically as Bitcoin adoption grew.  So, alternative solutions such as SegWit and Lightning Network were proposed.

What is SegWit?

SegWit stands for “Segregated Witness” and, simply stated, it reorganizes the way data is structured in the blocks.  The digital signature data is separated from each transaction in an “extended block,” thereby freeing up space in the current 1MB blocks. Moreover, Segwit makes it easier to implement Lightning Network because it fixes another issue called “transaction malleability”.

SegWit therefor functions as a viable short-term solution that does not require increasing the block size. This workaround could buy time until the Lightning Network tech is ready for larger-scale use and be implemented in a long-term solution.

In 2017, influential companies in the Bitcoin industry came together and agreed to implement SegWit in August of that year.  They would increase the block size from 1MB to 2MB in November 2017 (this whole process was called “SegWit2X”). However, some community members did not want SegWit at all and decided to split from Bitcoin using a hard fork. The result was a new coin with its own version of the Bitcoin blockchain – Bitcoin Cash.  Bitcoin Cash chose to increase the block size to 8MB and not to adopt SegWit. This fork occurred just before SegWit was activated on the Bitcoin (BTC) mainnet. If you would like to read more about the history of the scaling debate that resulted in the forming of Bitcoin Cash (BCH), please read our article “What is the Difference Between Bitcoin and Bitcoin Cash?”.

Eventually, the 2MB block size increase for Bitcoin BTC was called off due to a lack of community support.

Meanwhile, starting in the summer of 2017 and continuing through the rest of the year, the cryptocurrency market experienced an extreme bull run.  This increased demand put a lot of pressure on the Bitcoin blockchain as new users and transactions clogged the network. Transaction fees skyrocketed. And even though SegWit had been activated, the feature was still not widely used on the network, especially not by bigger companies that created large transaction volumes. So, unfortunately for the Bitcoin blockchain, SegWit did not provide a lot of relief during this period.

The 2017 bull market clearly demonstrated the need for a scaling solution if Bitcoin ever wanted to reach mass adoption. Here are some numbers to consider:

Early 2017 – Average transaction fee for transactions included within 6 blocks (~1 hour) was around $0.15.

Summer 2017 – Fees rose to $1-5, which was too high to remain competitive as a payments network compared to other cryptocurrencies AND too high to be affordable for people in countries that need to use a permissionless, censorship resistant currency. Note: the argument whether or when transaction fees are too high, seems to have become a political argument as well.

December 15, 2017 – At the all-time high of the bull market, blocks were 97% filled on average and an average of around 2,025 transactions were included in each block. On that day, transaction fees had risen to an astronomical average of over $35 for 1 transaction! At that time there was no way to buy your coffee with Bitcoin. Even though SegWit had already been activated on the mainnet, it was not yet implemented and used by enough bigger players, such as exchanges and wallet providers, to provide relief on the network for the amount of transactions that were occurring.

February 2018 – SegWit was being used on a larger scale and the market shifted to more of a bear market, so blocks used less space and fees dropped below $1 on average.

May 25, 2018 – By this date, the bear market and effects of SegWit had brought the average used space in each block back down to 52%, while including over 1,550 transactions (a low for the year).

June to September 2018 – Fees were very low again, below $0.10, and used block space is around 60%.

Transaction Capacity and Competition

Another aspect about the current technological state of the Bitcoin network is that it can process about 3-7 transactions per second.  In order for it to be used on a grand scale, it has to compete with the payment networks such as Visa and PayPal, which can process about 4,000 transactions per second and even 65,000 at max capacity. It’s pretty clear that Bitcoin does not stand a chance of competing with these highly-efficient payment networks. If it wants to survive as anything other than only being a censorship-resistant store of value, it will need to up its game massively.

Transaction capacity and the above sequence of events clearly illustrate that, in its current state, the Bitcoin network is not capable of handling the large volumes required for worldwide adoption. It needs a long-term scaling solution! SegWit has already provided the first step in that process. The next step on the Bitcoin development roadmap should then be Lightning Network!

What is Lightning Network?

So what is Lightning Network and how will it solve Bitcoin’s scaling issue?  As mentioned previously, Lightning Network is a network that exists as an off-chain, second layer of the Bitcoin network. Transactions on the LN layer are not recorded on the Bitcoin blockchain itself. As a result, small transactions can be processed very quickly with the lowest fees possible, on a scale unimaginable on the current blockchain.

Lightning Network would primarily be used for the enormous number of small, day-to-day transactions between parties that transact on a more frequent basis and wouldn’t necessarily need the trust level of worldwide consensus. The only times you would need to actually broadcast your transaction to the main blockchain is when the amounts are much larger or if an issue or dispute occurs with a payment on the second layer network.

How Does Lightning Network Work in Practice?

A regular on-chain transaction is a transaction that is signed and broadcasted to the network and then recorded in a block.

Once the transaction is broadcasted and propagated over the network, the receiver can see that they are getting an incoming transaction, but will not be able to spend the funds until at least one confirmation has taken place. And so every transaction, even the smallest one, is recorded on the blockchain, even those between two users – like the famous Alice and Bob from many Bitcoin explainers – that already have an established relationship and transact between each other frequently.

The idea of an off-chain second layer Lightning Network transaction is that two participants – like Alice and Bob – who may frequently interact with each other can opt to open a payment channel on the Lightning Network. This is a smart contract that holds a committed amount from both sides.  The opening state is recorded on the actual Bitcoin blockchain. Now Alice and Bob can send a nearly unlimited amount of transactions back and forth to each other within their shared smart contract that will only be executed on the Lightning Network layer. Whenever Bob or Alice decide to close the channel on the Lightning Network, a second transaction is sent to the Bitcoin blockchain, which then records the final state of the payment channel. This way, the Bitcoin blockchain does not need to know all the intermediate transactions.

Because each transaction in the payment channel of Alice and Bob doesn’t have to be recorded on the blockchain itself and doesn’t need the full verification of the entire network, the transactions can be instantaneous. There is no need to wait for block confirmations.  Each payment channel only requires 2 transactions on-chain – opening and closing the channel. This is regardless of the number of transactions that have taken place on the Lightning Network, which could be thousands. As you can imagine, because of the second layer Lightning Network, Bitcoin could potentially reach millions of transactions per second. This could make Bitcoin a serious competitor of the likes of Visa and PayPal!

But wait… does this mean everyone will need to have a payment channel with everyone they transact with? No, they do not. Let’s say Bob wants to buy pizza at the local pizza store but he does not have a payment channel with the pizza shop. However, if his peer Alice already has a payment channel with the pizza shop, then Bob can still pay over the Lightning Network. The transaction will be routed by the network over a path of different channels to reach its destination. In this case, the payment will go from Bob -> Alice -> pizza shop.

Important Characteristics of the Lightning Network

  • Each payment channel is a multisig wallet, which is a smart contract that is funded by either one or both parties. Both participants need to agree to open the channel.
  • The multisig wallet of the Lightning Network payment channel is a hot wallet, which means the private keys and the funds for this wallet are stored online.
  • Each Lightning Network transaction that takes place uses the same signed transaction security model of Bitcoin that will be verified by the network. So it is still an official Bitcoin transaction with the same secure properties.  However, it is not broadcasted to the main blockchain, but held as sort of IOUs within the multisig wallet.
  • For a transaction to use a path of channels to reach its destination, the nodes of each channel need to hold at least the same amount as the transaction to be able to use that path, otherwise, the transaction needs to find another path where the “weakest link” has enough balance.
  • Because each transaction can only use a path where every node holds at least the transaction amount, the Lightning Network is most likely to be useful for relatively smaller payments.  Larger transactions would then ideally be done on-chain (on the bitcoin mainnet).
  • Either participant of the payment channel can choose to close it without the consent of the other party. This can happen in case one party:
    • fails to finish the commitment to a channel,
    • does not update their state, or
    • does not close the channel when asked
  • Routing of Lightning payments will work similarly to how the TOR network works: each channel that routes a transaction will see from which channel it is coming and where it is going, but will not know the other sources or destinations. This feature should add a lot of privacy to Bitcoin payments, as current on-chain transactions are fully visible on the blockchain.
  • In order to achieve privacy as a Lightning Network user, you would need to open payment channels with multiple users. For optimal privacy and to maintain the decentralization of the network, it is said that 14 connections per user are recommended.

Advantages of the Lightning Network

Below is a summary of the key advantages of Lightning Network:

  • Allowing worldwide scalability of Bitcoin by handling of most small and frequent payments off-chain
  • Much lower transaction fees (better for micro transactions)
  • Faster transactions (no need to wait for the long block confirmations)
  • Increased privacy
  • No need to trust the participants in the Lightning Network, because users still hold a valid, signed transaction, so they can always recover their funds if a node misbehaves
  • Interoperability between other blockchains, like Litecoin, by facilitating a feature called “atomic swaps”. With atomic swaps, it’s possible to send Bitcoin to someone in the Bitcoin network and to receive Litecoin in return on the Litecoin network as an instant and secured transaction. This could also eliminate the need for exchanges because users could then trade coins directly from wallet to wallet.

Does the Lightning Network Actually Work?

Apparently, in the current state it does work. After a long incubation period, the Lightning Network has been live and growing steadily since 2018.  While it is still in its infancy with bugs and issues to be resolved, the network is working as intended at its current scale.

Who is Developing the Lightning Network?

Several teams and companies are developing the Lightning protocol and implementations:

  • Lightning Labs – this is the company that develops LND (Lightning Network Daemon).
  • ACINQ — a French company whose product is called Eclair.
  • Blockstream team — they are implementing the c-lightning client and Lightning gateway for e-commerce services.

 

Criticisms and concerns of the Lightning Network

Routing

First, the routing issue is not resolved, therefore limiting scalability.  The algorithm being used for routing payments over a path of payment channels from Bob to Alice has some limitations in terms of not being scalable yet to the desired level of mass worldwide use. This issue would need to be solved at some point in time when the Lightning Network will reach a certain (yet unknown) size.

Payments need to find a path where all nodes are online AND have enough funds. When this isn’t possible, another path needs to be found, which requires a calculation for each transaction. However, the difficulty of this calculation quadruples every time the network of nodes doubles. At a certain point, the difficulty level becomes too high and transactions can’t be processed anymore. It is estimated that somewhere between 10,000 and 1,000,000 nodes this maximum capacity will be reached, which is not enough to reach world scale usage.

However, just because the current algorithm for routing can’t scale doesn’t mean that Lightning Network can never scale. The Lightning Network algorithm works as it’s used today and it’s not unrealistic to imagine this issue will be solved in the future, as many other challenges in computer science from the past, were eventually solved. There’s no reason to immediately stop all innovation right here right now because we don’t know how to solve a certain problem that we would run into in the future. Nevertheless, this issue does put a boundary to the current growth potential of Lightning Network.

Security of Funds

Because the payment channels on the Lightning Network are hot wallets that store the private keys online, the larger the funds stored in each channel, the bigger the honeypot becomes as a target for hackers. Therefore, larger funds are not very secure when stored in Lightning Network payment channels. Also because the Lightning Network is still in an infant stage of development and could face technical issues and bugs, it is even currently not recommended for that reason to hold larger funds in payment channels. The risk of loss due to technical errors is still significant.

Network Attacks

Bad actors could perform DDOS attacks on the network by opening enormous amounts of channels with small amounts stored in the wallets to overload the network. This will certainly happen, but because opening a channel incurs a transaction fee and requires funds to be stored, the reach of such attacks is limited by the available funds of an attacker. By the way, Bitcoin itself has been under constant spam attacks which have made the network even more resilient. Solutions for these problems are an ongoing effort as will be the case with the Lightning Network.

Risk of Centralization

It is certainly to be expected that some companies with payment channels on the Lightning Network will evolve into so-called hubs, which means they will have enough liquidity to handle higher transaction amounts and enough nodes connected to easily form paths from sender to receiver. The concern, however, is that these hubs will then attract so many nodes that everyone will want to connect to them for convenience. This will lead to a high degree of centralization, which means they may be forced to comply with remittance regulation and implement KYC laws. Such compliance would completely defeat the purpose of Bitcoin. While this is a legitimate concern, there are many experts who doubt this situation will occur. They actually predict the opposite will happen – that we will see increased decentralization and privacy.

Legal Issues

There are many legal issues to overcome with the Lightning Network. First, users would ideally run the Lightning Network with a TOR browser, which isn’t legal everywhere in the world. Second, hubs or even regular nodes may be required to comply with money transmitting and AML/KYC laws. Lastly, distinct legal issues may arise in different jurisdictions or countries based on local laws.

Fee Structure

Nodes that relay transactions would receive a small portion of the already small fee that Lightning Network payments incur. However, a payment channel still needs to open and close the channel to cash out, which costs the normal Bitcoin blockchain network fee for these two transactions. There are some arguments being made that the total fees collected on the Lightning Network may not be enough to incentivize or to even offset the cost of opening and closing the channel. That situation could even be less favorable if one is forced to close the channel by the other participant of the channel at a peak time of on-chain transaction fees.

Conclusion

Even though some of the concerns discussed above are valid and need to be resolved, others are theoretical speculation – they may or may not occur.  Moreover, there may be additional issues in the future that appear in practice that would have to be dealt with. At least for the midterm future it will certainly help to offload a lot of pressure from the mainnet and allow Bitcoin to grow further for the time being.

It’s hard to predict the precise outcome in the current state of the project. Obviously, many in the Bitcoin community have high expectations and/or confidence that the Lightning Network will solve the Bitcoin scalability problem. They are confident Lightning Network will support Bitcoin eventually into being a powerful and competitive worldwide payment network and a resilient store of value that maintains its core principles of decentralization and censorship resistance while improving privacy.

In that scenario, the Lightning Network would make a great payment network for smaller transactions, like buying coffee, since it would not overload the main layer of the blockchain. The underlying blockchain will still provide the same guarantee of security and immutability and will mainly function as the store of value and be most suitable for larger or large batches of transactions.

There seems to be enough solid development and working product right now that the Bitcoin community can keep the faith that Lightning Network will indeed bring what it promises, even though there are still issues to resolve in the future.

Disclaimer:

This article was written to the best of our knowledge with the information available to us. We do not guarantee that every bit of information is completely accurate or up-to-date. Please use this information as a complement to your own research. Nothing we write in any of our articles is intended as investment advice nor as an endorsement to buy/sell/hold anything. Cryptocurrency investments are inherently risky so you should never invest more than you can afford to lose.

Have questions? Ask in our group!