In the blockchain, transactions are combined into groups called blocks. According to the blockchain's design, only a certain number of transactions can be included in a single block.
After you send a transaction, it enters a queue called the mempool. Processing this queue can take anywhere from a couple of minutes to several days. The speed depends on the number of other transactions in the queue, while the rate at which new blocks are generated is regulated—approximately every 10 to 15 minutes for Bitcoin. On average, each block can accommodate between 1,500 and 3,000 transactions. Therefore, those who want their transactions to be processed ahead of others set higher fees, which in turn prompts others to raise their fees as well. This practice during periods of high demand leads to a sharp and significant increase in fees and long queues in the mempool.
The scalability problem of bitcoin became particularly evident at the end of 2017 when millions of people joined the community and overloaded the blockchain with a high volume of transactions. The network struggled to handle the number of transactions, resulting in the processing cost for a single transaction reaching an unprecedented $37 by December of the same year. This made bitcoin a very inconvenient currency, as the transaction fee exceeded the actual payment for many small transfers.
So, what's the solution? Can I just wait?
Yes, in the world of cryptocurrencies, waiting for about an hour for a transaction to be confirmed is quite common. However, this characteristic limits the use of bitcoin as a means for processing fast transactions, such as buying a cup of coffee or a bottle of milk at a store. No one in their right mind would wait for several hours or even minutes for the network to confirm their transaction.
But the bitcoin developer community has devised a concept that can potentially solve all these issues. The network of micropayment channels, called the Lightning Network, can address bitcoin's scalability problems without the need to change the internal mechanisms of the blockchain itself.
The Lightning Network (LN) is a "second-layer solution," which means it is a network built on top of the Bitcoin blockchain that interacts with it indirectly.
LN consists of a system of bidirectional channels that allow individuals or companies to move funds between each other without the need to use the blockchain. Only two transactions are directly recorded in the Bitcoin ledger: the opening and closing transactions of the channel, regardless of any number of intermediate transfers within the LN network.
The goal of creating this system is to provide fast, secure communication channels between Bitcoin users without registering small transactions on the blockchain. This method is suitable for frequent traders, as the transaction fees are minimal. This scheme speeds up transactions and reduces costs by bypassing the main Bitcoin blockchain. It represents a decentralized network that retains the benefits of decentralization.
The Lightning Network makes Bitcoin suitable for everyday transactions, while larger transactions can still be conducted on the main blockchain.
How does it work?
For example, let's take two users. When connecting to the Lightning Network, they will have a shared deposit in bitcoins but separate balances depending on their share in the deposit. At the same time, neither of them can take the entire deposit without the permission of the other.
The essence of LN implies that users can update balances as many times as they want by simply redistributing their shares of ownership in the deposit among themselves. Thus, nothing much happens on the main blockchain - after all, in fact, bitcoins do not move anywhere; they simply change ownership.
At the same time, any of the participants can close the channel on their own initiative, and then a transaction with the wallet balances at the time of closure will enter the network.
Since payments are not made on the Bitcoin blockchain, they do not require the work of miners, which means that any payments can be made with a fee as low as one-hundredth of a bitcoin (which is approximately 0.01 rubles per transfer).
How can one join the network?
It is important to understand that to use the Lightning Network, you need to freeze a certain amount of Bitcoin in a payment channel. After that, you will be able to interact with the LN network within the limits of your balance.
Here are the steps:
- Download and install any client for working with the Lightning Network.
- Create a Bitcoin address with SegWit support.
- Open a payment channel with any other user for any amount. Opening a channel involves locking bitcoins in a multi-signature wallet, which allows the parties to avoid the need to trust each other.
- Now you can make as many transfers as you want within the deposited amount. The size of the deposit determines the "width of the payment channel," which is the amount you can spend.
- After closing the channel, a final transaction is sent to the main blockchain, which brings the wallet balances to a state that corresponds to the result after all the intermediate operations. Either party can initiate the closure of the channel without the consent of the other.
But how do you pay at different stores?
Do you need to create multiple separate channels with each of them? Actually, no! The network itself selects intermediate links that help find an optimal route for the transfer to the final destination. For maximum convenience, there are hubs in the network whose goal is to connect as many nodes as possible so that each user can connect to any other LN participant.
During the process, funds "flow" from the sender's wallet to the intermediate one, then to the next one, and so on until the transfer reaches the final recipient. We can't see this happening because all transactions occur simultaneously.
Did you know? In El Salvador, which as early as June 2021 recognized bitcoin as legal tender in the country, stores use the Lightning Network to facilitate small payments.
Is there anything else?
Yes! The Lightning Network overlay allows not only quick and inexpensive transactions but also the opportunity to earn from it.
The thing is, any network participant creates their own node, and if you have enough channels with popular recipients, you can earn as an intermediate participant in the channel between other users.
Operators of node operators can set any fees at their discretion for processing payments (but the network will choose the most advantageous route for the sender).
But there must be a catch, right?
Yes, there is more than one catch:
- LN does not have a public ledger, and nodes do not see all the details of the transactions passing through them. On one hand, this makes payments more private, but on the other hand, it raises concerns about the potential compromise of one of the nodes. The system does not yet guarantee complete security.
- For a payment, a route with sufficient liquidity is required, meaning the deposit size of each intermediate link must allow for the transfer to be completed.
- All participants in the route must be online; otherwise, the transfer will be impossible.
- If your node is disconnected from the network, the other party may close the channel, broadcasting an earlier state of the channel and reclaiming some of the funds previously paid to you.
- Trusting only known and verified nodes with a good reputation leads to network centralization, potentially compromising the very idea of LN.
What's the outcome then?
If Lightning Network technology succeeds, it will significantly contribute to the wider adoption of cryptocurrencies in everyday life.
In addition to increasing speed and reducing fees (potentially even eliminating them in the future), LN provides participants with higher anonymity.
However, until the technology is fully implemented, it is not advisable to store significant amounts in Lightning Network channels. The technology itself is still in the development and implementation stage.