Blockchain is far from being fast. Consequently, its services cost a lot. There may be a time lag of up to several days or even weeks between sending and receiving several coins. Furthermore, such a transfer requires a transaction fee to be paid. These unfavorable conditions make everything somewhat complicated.
Though, the community is aware of this problem, thus it constantly proposes solutions. The one of the solutions dedicated to resolve the mentioned flaws is called the Lightning Network. Let’s examine the flaws in detail before the solution is globally activated.
So, why does blockchain have such a low speed? To answer this question, we should first take a closer look at the structure of blockchain. Basically, any blockchain is a set of blocks, and each block consists of transactions. As soon as the number of transactions is enough to fill up and close the block, it can be added to blockchain. However, before a block joins other blocks in blockchain, it must be checked by all network participants for the correspondence to general rules. These heavy calculations take ten minutes on average for each block.
Now, let’s assume we want to send several BTC. A correspondent transaction must contain a lot of different information fields. They are the source, the destination, the value, the transaction fee, and some others. A sender has to set a fee to make their transaction more attractive to miners. Higher fees increase the chance that the transaction will be added to the next block. On the other hand, fees are not obligatory. This is just the matter of balance between time and expenses.
There are always plenty of different transactions that are waiting for their turn. Miners, computers supporting the whole blockchain network, have to choose among proposed transactions to add them in the block. Commonly, they are programmed to select transactions with higher rewards to increase their total profit.
The transactions that were not chosen and added to the block have to wait for their turn in the pool. Depending on the total number of transactions, miners policies, the network load, and some other factors, a transaction can remain in the pool for several weeks. This answers the question why blockchain is considered a slow and expensive technology. Regardless of the amount of transactions, there is a threshold that can be easily reached but not exceeded.
The Lightning Network (LN) as a possible solution
The main concept of the LN is that only a limited number of transactions must be added to blockchain. It is possible if two users exchange their funds many times. In this case, there is no need to record all intermediate states of their payment balance. The only thing is required is the final state.
Simply speaking, a so-called payment channel has to be opened between two participants of the same blockchain. Afterward, they can transfer funds as many times as they want to. The channel can stay open and, what is more important, the users do not have to close it. Once they decide to stop the current interactions and close the channel, they will record a final balance in blockchain.
Spreading these channels among pairs of users leads to the creation of an absolutely new network that works over blockchain. All participants will have to rarely interact with blockchain thus removing the load of the whole system.
Let’s imagine, there are three network participants — Carl, Lenny, and Barney.
Carl and Lenny decide to create a payment channel. At the same time, Lenny and Barney open another channel, too. Now, Carl can send money to Barney via Lenny. Or if Barney decides to send some BTC to Carl, he transfers his coins to Lenny, and Lenny, in turn, sends the same amount to Carl. This is the core concept of the LN application. Since no blockchain interaction is required in this scheme, all funds will move very quickly.
Each payment channel is similar to a vessel with common access for two participants. They put their funds inside and lock the vessel, and this action is recorded in blockchain in a common way. Then a set of unfinalized lock transactions is composed to prevent cheating by one of the parties. None of them can spend funds without the agreement of others.
Locking money allows participants to change the balance by transferring the promise of ownership. That’s how it works. Suppose, Carl and Lenny add 5 BTC each in the vessel. Now, if Carl wants to send BTC to Lenny, he must change the balance by transferring the promise of ownership. If these transactions are approved by the community, the vessel will get opened and Carl will receive his 4 BTC, while Lenny will get 6 BTC.
But the users will not open the vessel if they are going to continue their interaction, and this is the major achievement of the LN. Next day, if Carl decides to repeat the same procedure, he will change the balance by transferring the promise of ownership in favor of Lenny. Now, once the vessel is opened, Carl will receive his 3 BTC, while Lenny will get 7 BTC.
Basically, this channel is simply some funds united together and redistributed among initial owners. The channel can be closed at any time. If no misbehave is detected, then the last registered balance will be applied to the main network. But this is only half of all positive changes. What if several channels are opened among multiple participants simultaneously?
This changes a lot. Here us another example to illustrate the situation. Carl, Lenny and Barney open Carl-Lenny and Lenny-Barney payment channels, but there is no Carl-Barney channel.
Here, by moving 2 BTC from Carl to Barney, Carl uses the Lenny-Barney channel as well. Lenny changes the balance inside of the channel with Barney, and Carl changes the proportion in the Lenny-Carl channel.
The Lightning Network spares the whole blockchain from having to get updated every time the transaction between two users is carried out. Thus, a huge amount of transactions can be supported as they have to without any problems, high fees or delays.