Lightning Network, Explained

Published at: Nov. 15, 2017

What is this all about?

Blockchains are slow.

And therefore, expensive. If I had to send you some Bitcoins, you’d receive them in about a couple of hours and I’d have paid a heavy transaction fee too. With such a reputation, how will Blockchains take over the world?

Any idea that can solve the non-scalability of Blockchains is worth attention, time and effort. Lightning Network is one such idea. But before we understand the solution, we’ll need to understand the problem.

If you’re already aware of the problem, you can directly jump to the next section.

Why Blockchains are slow?

Think of a Blockchain as a register.

And this register contains several pages (blocks) where each page has several transactions. As soon as a page has been filled with transactions, it needs to be added to the register before starting to record transactions on the next page.

Before a page (block) can be added to the register (chain), there’s some processing that needs to be done to ensure that everyone agrees with the contents it contains. The process approximately takes 10 minutes (for Bitcoin Blockchain) for each block.

Imagine, you send 1 BTC to your friend, Joe. The transaction will look something like this.

Among other things, a transaction contains information about the sender, the recipient, the amount and the transaction fee.

Wait a minute, transaction fee?

Yes, there’s an additional fee.

You can pay it to incentivize miners to include your transaction in a block as soon as possible. There’s no set price and it’s entirely up to you how much you are willing to pay to speed up the process. The higher the fee, faster your transaction will go through.

At any given moment, there are several transactions available to be recorded on the current page.

The miners, i.e. computers working in the Blockchain network, have to decide which of the available transactions to include in the current block. To help them decide, they look at which transactions yield the most rewards — meaning that the transactions with the highest transaction fee will be included first.

If there are enough transactions with a higher transaction fee than yours to fill up the block, your transaction will have to wait in queue. The wait can last from a few minutes to a few hours. And sometimes, even days. The more you pay in transaction fees, the quicker your transaction is processed.

That’s why Blockchains are slow, and therefore, expensive for everybody to start using. Ideally, the adoption of Blockchain would mean more transactions happening but as the number of transactions goes up, the network will become slow, making a hurdle for adoption. What a paradox!

Lightning Network (LN) is a potential solution to the problem.

So what is Lightning Network again?

The idea behind LN is that not all transactions are required to be recorded on the Blockchain.

Imagine you and I transact quite a few times among ourselves. In such a case, we can bypass recording the transactions on the Blockchain and carry them off the chain.

In the simplest terms, how it’ll work is -- we’ll open something called a payment channel between us and record its opening on the Blockchain. Now, you and I can transact any number of times through this payment channel and it can stay open for any number of hours, days, weeks or decades. The only time we would touch the Blockchain ever again will be when we would want to close the channel. Then, we’ll write the final status of the transactions that occurred through the channel on the Blockchain.

Using this idea of payment channel, we can create a network of payment channels such that it would be only rarely required to transaction on the Blockchain. Imagine there are three characters - Xan, Yelena and Zeke.

If Xan and Yelena have a payment channel opened between them and Yelena and Zeke have a payment channel opened between them, then Xan can send money to Zeke via Yelena.

Suppose Xan wants to send 2 BTC to Zeke, Yelena will send 2 BTC to Zeke and Xan will reimburse Yelena with 2 BTC.

That’s what the idea of Lightning Network is. Because you won’t be touching the Blockchain often, the transactions will be happening at lightning speed. As you might have guessed by now, all the magic happens in the payment channels. Let’s learn the magic trick then.

And what are those payment channels?

It’s like a safety deposit box where two people deposit equal amounts of money and each put a lock on it.

This action of depositing equal amounts of money in a common box is recorded on the Blockchain in the form of an ‘Opening Transaction’ and thereafter a payment channel is open between those two people.

The idea behind locking money in such a box is that no one person can spend the money in the box without the other. The money in this box is then used to transact between each other.

Imagine, Xan and Yelena pool in 10 BTC each in the common box. And now, if Xan wants to send 2 BTC to Yelena, how would he do that?

To do that, he would transfer a promise of ownership for two of his Bitcoins in the common box to Yelena. After this transfer of promise, if the box is unlocked, Xan will be able to take 8 BTC from it and Yelena will be able to claim 12 BTC.

But they will not open the box because they want to continue transacting between themselves. That’s the beauty of this arrangement.

Now, if the next day, Yelena has to send 1 BTC to Xan, she would do the same - transfer a promise of ownership for one of her Bitcoins to Xan. After these two transactions, if the box is opened, Xan can claim 9 BTC and Yelena can get 11 BTC.

To imagine how off-chain transactions look like, consider this:

To sum it up, payment channel is nothing but a combination of pooling some money together and then transferring the promise of ownership of the pooled-in money in the agreed upon manner. If ever either of Xan or Yelena wants to close the channel, they can.

Closing a channel would simply mean opening up the box and taking the money inside. This opening of the box happens on the Blockchain and the who owns how much from the box is recorded forever.

That’s how payment channels work. But that doesn’t even come close to defining their true potential. Their true power is unleashed when two or more payment channels work together to form a network - The Lightning Network.

Got it, so how does it actually work?

LN works by moving the value from the ownership of the Bitcoins to the promise of ownership of the Bitcoins.

This shift is huge. Like always, we will use an example to understand this. Imagine there are three people - Xan, Yelena and Zeke - such that there’s a payment channel open between Xan and Yelena, and there’s another channel open between Yelena and Zeke. Note that Xan and Zeke have no payment channel between them.

In such a situation, if Xan wants to transfer 2 BTC to Zeke, he can use the payment channel between Yelena and Zeke to do that. How does that look like?

Xan asks Yelena to transfer a promise of 2 BTC to Zeke on Yelena-Zeke payment channel and then he reimburses Yelena with 2 BTC on Xan-Yelena channel.

With such network of payment channels, a huge chunk of transactions can be off-loaded from the Blockchain to be carried out off the chain, therefore, freeing up the chain’s bandwidth. Using a network of payment channels, millions of transactions can happen, and that too without a hefty transaction fee.

That’s the Lightning Network.

Tags
Related Posts
Cointelegraph Consulting: Report pictures a crypto-consumer portrait
Bitcoin’s status as legal tender in El Salvador has recently sparked a new round of discussion concerning Bitcoin (BTC) and its role in the world economy. Despite ambiguous reactions from institutions such as JPMorgan Chase and the World Bank, some feel that Bitcoin’s status as a means of payment is now more explicit than ever. Meanwhile, the perception of Bitcoin among retail users is contrasted sharply by institutional uncertainty. A recent study by CryptoRefills, a company that sells vouchers and gift cards in exchange for cryptocurrency, seems to suggest that many users view Bitcoin as a useful way to pay …
Technology / June 18, 2021
RIF Labs Launches 3rd-Layer Scalability Solution Capable of Processing Up to 5K TPS
RIF Labs — owner of bitcoin-based smart contract sidechain Rootstock (RSK) developer RSK Labs — has launched a third-layer scalability solution capable of processing up to 5,000 transactions per second. The news was revealed in a press release from RIF News on May 14. As reported, RSK Labs and its decentralized app (DApp) infrastructure protocols RIF OS began as a spin-off from Rootstock, having been initially launched by several senior executives from the latter’s creator — the startup RSK Labs. The two structures became fully integrated when RIF Labs acquired RSK Labs in November 2018. Originally conceived by Bitcoin Core …
Blockchain / May 15, 2019
Lightning Labs Launches Lightning Network Client for Main Bitcoin Network
Blockchain development company Lightning Labs announced that it released the first alpha version of its Lightning Network (LN) client for the main bitcoin (BTC) network, according to a blog post published on April 23. The announcement specifies that this is still an early version aimed at testers and developers willing to start experimenting with the software. The developers also warn that the users should not put more funds into the app than they are willing to lose. Furthermore, while the release supports macOS, Windows and Linux, the post also specifies that it is an important stepping stone in the development …
Blockchain / April 24, 2019
Tipping the Scales: Could Unit-e Finally Break Blockchain’s Scalability Impasse?
Amid a seemingly constant stream of new concepts claiming to be key to crypto to breaking through to the financial mainstream, one immovable issue remains ever-present: scalability. The crypto community is abuzz with new projects relating to the issue, from the Bitcoin (BTC) Lightning Network to a brand new cryptocurrency designed by some of the top names in crypto and American academia. Cointelegraph takes a look at the latest scalability developments and what they can bring to blockchain and crypto. Some of the United States’ finest academic and technological have come together in a new project aiming to launch a …
Blockchain / Jan. 24, 2019
Shopify Bitcoin payments integration triggers legal questions from the community
Following the announced integration of the payment app Strike with e-commerce platform Shopify to accept Bitcoin (BTC) through the Lightning Network, the crypto community raised concerns over the legal implications of the move. Crypto researcher Matt Ahlborg believes that the event is a very significant development for BTC as it allows the offloading of BTC without the need to go through the know-your-customer (KYC) process. What Jack Mallers is really saying is that you will be soon be able to offload your Bitcoins in the real world without KYC'ing through an exchange first. If this is true, it is actually …
Adoption / April 8, 2022