To speed up transactions and reduce fees, the Lightning Network was created

​How does the Lightning Network work

24.01.2022

2896

4 min

Bitcoin is not the most convenient tool for payments. Nevertheless, in some places, it is recognized as a full-fledged currency, for example, in El Salvador. In everyday transactions, people tend to use hundredths or even thousandths of a bitcoin. .

What is the Lightning Network?

It is an add-on to the blockchain that helps you make small transactions instantly with low fees. The fact is that the bitcoin network only processes about 5-7 transactions per second. By comparison, Visa has this figure of about 65 000. Bitcoin's blockchain is designed in such a way that one block is formed in 10 minutes on average, and this cannot be changed. The Lightning Network writes only a part of transactions into blocks, so the processing speed of each transaction increases by orders of magnitude.

How is it arranged?

The Lightning Network is a peer-to-peer network where each node is a computer with a wallet. Coins are transferred through channels between nodes - there can be two or more of them. At the same time, the blockchain only records the opening of the channel and the last transaction before closing, the intermediate operations are regulated by a smart contract.

When the channel is opened, the smart contract creates a joint account with the funds of both participants. They have two private keys to manage the account.

For example, Olga had 0,06 btc and Andrey had 0,08 btc. This means that the joint account will have a balance of 0,14 btc: 0,06 btc for Olga; 0,08 btc for Andrey.

If Andrey and Olga periodically transfer coins to each other, the total balance will not change, but the smart contract will note which part of the deposit belongs to each of them.

Olga transferred 0,02 btc to Andrey. The total balance will remain unchanged, but 0,1 btc of this amount now belongs to Andrey. If later he transfers 0,03 btc to Olga and closes the channel, the recalculated amount will be returned to his wallet: 0,08 + 0,02 - 0,03 = 0,07 btc, and 0,06 - 0,02 + 0,03 = 0,07 btc, to Olga’s.

2 transactions will be recorded in the blockchain:

  1. Opening the channel;
  2. Transferring 0,03 btc to Olga and closing the channel

Channel exhaustion

If the entire cryptocurrency on the account belongs to one participant of the transaction, the channel is considered exhausted, since the coins can only move in one direction.

If Olga transfers all her funds to Andrey, that is, the total of 0,07 btc, the channel will be considered exhausted, because now the coins can no longer move from Olga to Andrey.

It is not necessary to open a direct channel between two nodes, you can use those already opened between other network participants. At the same time, the fees in the “lightning” network are much lower than on the blockchain.

What is the benefit of the network?

Bitcoin has little use for small everyday transactions, be they transfers, buying, selling, or exchanging coins. Lightning Network solves this problem: speeds up small transactions, reduces fees, and simplifies atomic swaps. Here's how it works.

  • Reduces the load on the main bitcoin network. Since only the initial and final transactions are recorded into blocks, intermediate transactions take place without loading the main blockchain. Coin exchanges are almost instantaneous because participants do not have to wait for each transfer to be verified. At the same time, the speed of block formation on the blockchain remains the same.
  • Reduces fees. Since the Lightning Network is designed for transactions in hundredths and thousandths of a bitcoin, the fees on the network are proportionally lower than on the blockchain. For this purpose, bitcoin is converted into an LN token, satoshi, which is equal to 0,00000001 btc, i.e. ~ 4 kopecks.
  • Simplifies frequent small transactions. Fast transfers with minuscule fees make small transactions with bitcoin much more convenient than verified blockchain transactions.
  • Helps to trade cryptocurrency without exchanges. Lightning Network supports atomic swaps, so you do not have to sell coins on an exchange to trade them. Conversion will take place in the payment channel, just like any other transfer.

Disadvantages of the network

It is not possible to send a transfer “on-demand.”The recipient must be online, otherwise, the transaction will stall or be canceled altogether. This happens because the transaction is confirmed by both the sender and the recipient.

It is not suitable for large transfers. The network is designed for transactions with small sums: the average channel capacity at the beginning of 2022 is about $1 500 (0,038 BTC).

It can become centralized. The danger is that one player can concentrate most of the network's resources. In mid-January 2019, LNBIG.com was such a player. It owned almost 64% of the network capacity, while LNBIG.com’s share of nodes was only 0,7%.

The source: Bitcoinvisuals.com

Conclusion

Despite some disadvantages, the Lightning Network is gaining popularity for bitcoin micropayments. Channel capacity is growing, as is the number of nodes. Over time, Lightning Network may become a cryptocurrency alternative to Visa and Mastercard.

Subscribe to Getblock Magazine and stay up to date with the latest news from the world of cryptocurrencies and the digital economy