Lightning Network: what it is and how it works

Lightning Network is a relatively new, but solid solution

lightning network

Lightning Network: what it is and how it works. Source: shutterstock.com

Lightning Network (LN) is a technical solution developed as a “Layer 2” protocol of blockchain networks. LN uses advanced smart contracts to achieve higher transaction bandwidth, enabling the peer-to-peer nature of the bitcoin protocol.

The solution was first presented at the Scaling Bitcoin conference in Montreal in September 2015.

Why do we need Lightning Network?

The major goal of the Lightning Network is scaling and boosting operation speed of blockchain networks. In particular, it is about instant micropayments with lower (compared to ordinary transactions) commission/fees.

Simply put, the Lightning Network allows users to carry out transactions directly between themselves, without writing down information in the public blockchain. Thus, two tasks are solved simultaneously. On the one hand, we’ve got faster and cheaper transactions. On the other hand, the amount of blockchain data is considerably reduced. In addition, this technology contributes to greater anonymity of users.

Let’s consider LN from a technical standpoint

lightning network

A key principle of the Lightning Network is about the use of payment channels. Source: shutterstock.com

A key principle of the Lightning Network is about the use of payment channels, in which funds are put and consequently transferred between participants. A payment channel is a wallet with a multisig (multi-signature) feature, which stores a certain number of bitcoins. Coins can be provided by both parties.

A channel is opened by means of a regular bitcoin transaction. In this case, data on this transaction is recorded in the blockchain. Furthermore, data is recorded in the blockchain when the channel is also closed. However, all further transactions (within the channel) are carried out directly between participants without putting any data into the blockchain.

The payment channel somehow plays the role of a safe, in which money is placed. Then, these funds are available to a certain number of people. But, you need to know the combination of numbers to open the safe, so you will use private keys.

Complicated and boring. What about a particular example?

lightning network

The LN is a network-based payment protocol. Source: shutterstock.com

The simplest example of using LN technology:

Jane’s favorite coffee shop announces that it has started accepting bitcoins as a means of payment. “Cool”, Jane thinks, but paying every time for a cup of coffee with bitcoins can be a little bit complicated. Each time you pay means you create a separate transaction. At this point, it can be too expensive due to the fees associated with the process. Moreover, it takes a certain length of time to confirm the transaction.

It is here that LN comes to their aid. Jane opens a payment channel between herself and the coffee shop and puts, for example, 0.01 BTC. She intends to spend this sum on coffee in the near future. When creating a channel 0.01 BTC is displayed on Jane’s balance, while the balance of the coffee shop says 0 BTC.

Let’s say a cup of coffee costs 0.0004 BTC. After the first order, the balance of Jane will say 0.0096 BTC, while the balance of a coffee shop will apparently display 0.0004 BTC. Thus, Jane can order coffee till she runs out of funds on her payment channel. On the other hand, she can simply close the channel. For each transaction, Jane and the coffee shop (two parties) sign an updated smart contract that displays how many coins in the channel belong to each side. As already mentioned, this data is not written down to the blockchain. But instead, each party stores its copy of the smart contract.

Do I need to open a new payment channel for each new transaction party?

lightning network

You’ll also receive small commissions each time a transaction is carried out. Source: shutterstock.com

The answer is no. The LN is a network-based payment protocol. This means that Jane (the one that loves coffee) may not have an open payment channel with her friend Dave, but may be connected with him through another friend Bob (if she is connected to him), or even through several participants. That is, users can exchange transactions with any other users connected to their network of payment channels through nodes.

You’ll also receive small commissions each time a transaction is carried out, so it makes sense to create nodes.

Due to the use of smart contracts, the Lightning Network does not require the trust of the parties. Thus, funds always reach their recipients through intermediaries or are returned to the sender if an indirect route to the recipient is not available for some reason.

Extra functionality

The aforementioned situation with Jane and a coffee shop implies that Jane has opened a one-way channel. It means only one party spends funds. Nevertheless, you can open a two-way channel as well. Thus, parties can pay to each other. Parties can also set special conditions (in order to carry out a transaction) with the help of smart contracts.

For example, Jane and Bob made a bet whether bitcoin would reach $9000 before January 1st, 2020. Jane is a crypto-enthusiast, thus she believes this will happen, while Bob considers it impossible. Both of them bet 0.1 BTC, so they send coins to a multisig wallet. The funds are unavailable until:

  • Jane and Bob sign a finalizing transaction with their private keys. Depending on the result of the bet, these funds will be sent to Jane or Bob (in other words, to the one who has won);
  • one of the parties decides to get out of the bet and finalizes the transaction single-handedly;
  • a time limit has been reached (for example, January 2, 2020). So, once the January 2 deadline arrives, the funds are returned to their respective wallets (Jane and Bob).

Sounds good, what about drawbacks?

lightning network

Lightning Network is still in an experimental phase. Source: shutterstock.com

First and foremost, the Lightning Network is still in an experimental phase. It is better to entrust large and significant transactions to the basic Bitcoin network.

It is important to remember that today the p2p nature of the protocol means that both parties must be online in order to open a channel and make payments. That is, offline payments, when you can simply send a certain amount of coins to a particular address, for the recipient to see them when they enter the network, in this case, are impossible.

Moreover, a lot of people are concerned about the possible centralization of the network. For instance, in early January 2019, about 64% of the network capacity was controlled by only one player.

What to expect from LN?

Lightning Network is still a young, but very promising technology. The network capacity is steadily growing, having recently reached the 827 BTC mark. The number of nodes is approaching the 10,300 mark, and the number of open channels has already exceeded 35,200 (here you can watch real-time lightning network statistics).

SEE ALSO: Top 10 blockchain professions in 2019

facebook