Featured Image

The Lightning Network, What Is It. And How Will It Leverage Bitcoin to Buy Your Coffee Before It Gets Cold

Posted by Hicham ALAOUI RIZQ on 09 Nov, 2020

What is the lightning network and why is it important?

Introduction

Bitcoin is an electronic cash system or a network where it is easy to send btc. Btc is the digital coin for bitcoin that doesn't need a bank to be transferred. Furthermore, You can at any time notice, cash out your btc instead of major fiat such as dollar, euro and more..

With that being said, some early adopters and shops start to accept the btc as a payment method. Although it seems a perfect payment system. It has a major drawback which is the time needed for any transaction to be confirmed. A single transaction takes on average 10 minutes.

In other words, If you pay for your morning coffee with btc. The payment would be done more probably when your coffee gets super cold.

Visa network vs Bitcoin network

Visa credit card is able to proceed a 65000 transaction per second. Bitcoin can handle only 7 TPS or transaction per second.

Which leads that, the Bitcoin network can't be a medium of exchange. For the reason, that it is slowly and expensive to send small payments through the network.

The lightning Network

Wouldn't be great to have instant and feeless transactions! This is where the lightning network comes in.

Introduction

The lightning network is sets of protocols that are built on the top of the bitcoin blockchain, to facilitate the micro payment or small transactions.

The concept was first introduced in 2015 and it is credited to two brilliant developers. Tadge dryja and joseph poon, who first pend their white paper at the annual bitcoin conference in San Fransisco where they met a year before.

The main idea behind their fast payment solution (The lightning network) was that, A small transactions don't need to be recorded directly on bitcoin blockchain but rather "Off chain". Which provides all the beneficial bitcoin has and without its drawbacks.

Lightning network

Technical gibberish

Bitcoin is no where close to the optimal speed of transactions, because of its block size and block time!

Let me explain! The bitcoin network is a blockchain which is a distributed record of transactions. These transactions are shared by all computers connected to the network. These transactions are batched into blocks which are only 1 MB large.

If we consider, the btc transaction which has a digital size 2. Only, 2700 transactions can fit in each block. This limited space is the reason why there was a need for transaction fees. In order to incentives computer or miners to include transaction in the next block.

When We divide the number of transactions in one block, and the time for creating a new block which is roughly 10 minutes. We got 4-7 TPS (Transaction per second) which could be handled by the bitcoin network.

With those facts, you might be thinking that the solution for a scalable and fast bitcoin network, would be to increase the block size, the block time or both. But here is the issue!

If the block size is too large, there would be a handful of computers that would be able to store the full history of transactions and would be too large for most of computers to handle, on the other hand, same if we increase the time of creating new blocks. For the same reason, there would be less computers that are able to verify transactions on time.

This leads finally to one solution left. Which is the off chain or the lightning network. Which suggest simply to process btc transaction outside of the Bitcoin network. Or what we call off chain without compromising security or increasing costs.

Lightning Lab

January 2016 was marked by the foundation of the Lightning lab, a company that focused on developing the lightning network. After two years of hard work of bitcoin developers, the lightning network was completed in February 2018, where this occasion was marked by the purchase of two pizzas using btc on the lightning network by Laszlo Hanyecz.

For those who don't know Laszlo Hanyecz. He was known as the first person to use bitcoin in a commercial transaction. He purchased in 2010, two pizzas with 10000 BTC.

Later in march 2018, Lightning lab received $2.5 millions of funds from investors including twitter CEO, Jack Dorsey. And since than. The lightning network was deemed ready for regular bitcoin users. Including states such as Salvador who claimed this year the official use of lightning network for btc payment across the country.

How the lightning network works

The lightning network is not a blockchain. Instead it is an interconnected payment channel created by the two parties on the bitcoin network. Let's break down the definition with a simple example.

Payment channels

As you may understand already, the basic concept behind the lightning network is the payment channel.

Let's imagine, every morning I take a cup of coffee from the coffee shop nearby. Because I am a loyal customer. I don't have to pay in every occasion I got my cup of coffee. Rather than, Me and the coffee shop owner, agreed to open a payment channel or a record of payment that I only pay the total amount at the end of the month.

The lightning network is here to help to store all these payment records that occur during the whole month.

Lightning network usage

After agreement to use the lightning network, We start by opening a channel payment on the bitcoin blockchain. Then, send a deposit of btc to what we call a multi signature wallet. This deposit must be greater or equal to the amount supposed to be spent when the month is over.

As the name suggests, multi signature wallet is a crypto wallet where both parts (Me and the coffee shop owner) have access. In other words, any transaction can't be proceed unless, we both unlock the wallet with our signatures.

To be precise, what we transact across the lightning network is not btc but nothing else than what we call an IOU or " I owe you " a digital written acknowledgment of debt to another party. Differently, before we close the payment channel we are just adjusting how much btc each of us will get when the payment channel is closed. This IOU set of records is kept on both of our computers as receipt waiting for the final balance when the month is over.

To store the IOU updates, We don't need to create a new block on the bitcoin blockchain. Rather than, we just need both, hardware and fast internet.

Finally, When the month is over, the btc in the multi signature wallet is sent back to each of our btc own wallet based on the balance of the digital IOU receipt, This creates a second transaction on the bitcoin blockchain and closes the payment channel.

Note that the payment channel, cannot be kept open indefinitely and can be close by one or both parties.

Global network or a two way street between two people

In case you have to route your payment to your restaurant next door, which you have never set a payment channel with previously. But your coffee shop owner already does. The lightning network has got you covered.

You don't need to open a new payment channel with the restaurant rather than, let the lightning network automatically route your btc through your coffee shop to minimise the distance it needs to travel, in the same way the lightning find its path to the ground based on the least resistance on the atmosphere.

If you think that the coffee shop will keep your btc for himself and not forward them to their destination through his payment channel, No worries. Lightning network has again got you covered, because btc payment made by intermediate payment channel is secured by a technology called: hash time locked.

hash time locked technology

Without getting too technical, this technology consist on an exchange of a secret code with the end recipient first before sending any btc. If anything goes wrong along the way, the btc exchange is canceled and the appropriate parties are punished if it was a malicious act.

The far reaching connectivity of the lightning network, depends on the more payment channel created. This connectivity would allow to the whole planet to conduct payments using btc the way Satoshi Nakamoto envisioned.

Interoperability feature of the lightning network

The lightning network can be used with any cryptocurrency which supports multi signature wallet and hash time locked technology, Which almost all of them.

Growth

With all these crazy features, the lightning network has grown exponentially over the last year, at the time of writing this blog, there are 60000 lightning network payment channel around the world, with over $100 million worth of btc locked in multi signature wallets.

Larger player adoption

After lightning lab declares that they increased the amount of btc allowed to transact over the payment channels, This allowed more adoption for the lightning network by larger players and evangelist across the crypto space including crypto exchanges. Kraken, Paxful, Bluesky, Liquid fintech to name a few.

Conclusion

If you think that this network is too good to be true, then you are partially correct. The main reason is that, thousands of code vulnerabilities have been found since the network was launched in 2018. Even though the network is fully operational.