paint-brush
What is the Lightning Network?by@shaanray
2,110 reads
2,110 reads

What is the Lightning Network?

by Shaan RayMarch 8th, 2019
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Bitcoin’s blockchain suffers from a scalability problem.

Companies Mentioned

Mention Thumbnail
Mention Thumbnail

Coins Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - What is the Lightning Network?
Shaan Ray HackerNoon profile picture

Bitcoin’s blockchain suffers from a scalability problem.

While Visa handles 2000 transactions per second on average, Bitcoin can only handle only 7 transactions per second with a block capacity of 1 MB.

Bitcoin’s Lightning Network is an effort to tackle this scalability problem.

A Layer on top of the Bitcoin Blockchain

The idea behind the Lightning Network is that smaller, everyday transactions need not be stored on the main Bitcoin blockchain.

The Lightning Network is a second layer built on top of the main blockchain. It enables faster micro-transactions using ‘off-chain payment channels’. Using this off-chain approach, transactions deemed less important or peripheral are conducted off of the main chain.

Off-chain transactions using the Lightning Network only involve 2 entries on the main Bitcoin blockchain — one to open a private ‘payment channel’ between two parties, and the other to close it out. A payment channel is a private channel between two users which allows them to transact with each other off-chain. Since the latest balance sheet signed by both parties is used to close out the private channel through a main chain transaction, the integrity of payments is maintained.

Bitcoin’s Lightning Network visualized by https://graph.lndexplorer.com.

Lightning Network Example — Two Parties

To better understand the Lightning Network, let’s assume you purchase lunch from the same cafeteria at work every day.

These routine daily transactions between you and the cafeteria (two parties that trust each other) need not be recorded on the main Bitcoin blockchain. Instead, you and the cafeteria deposit a certain amount of Bitcoin into a ‘Multi-Signature Account’ (aka ‘Multi-Sig Account’).

You — 1 BTC

Cafeteria — 0 BTC

This transaction is recorded on the main Bitcoin blockchain. However, now you have a private off-chain channel to transact with the cafeteria. Transactions using funds from the Multi-Sig account can only occur when both parties agree.

The next day, you order lunch for 0.01 BTC

Both you and the cafeteria sign this transaction with your private keys. This transaction is recorded on the private channel and the Multi-Sig account now shows the following balance:

You — 0.99 BTC

Cafeteria 0.01 BTC

The off-chain payment channel can be closed at any time by either you or the cafeteria. All you have to do is present the latest balance sheet signed by both parties and broadcast it to the main Bitcoin network. The private channel is closed out through a transaction that distributes funds your respective accounts on the main Bitcoin blockchain.

Network Effects with Multiple Parties

In addition to allowing off-chain transactions between two trusted parties, the Lightning Network enables network effects. Using the previous example, let’s say you have two separate private off-chain channels open: one between you and the cafeteria, and another between you and a close co-worker.

One day, the co-worker accompanies you to the cafeteria for lunch. She wants to buy lunch from the cafeteria as well. Rather than open her own off-chain private channel, she can transfer money to the cafeteria by using your Multi-Sig account as a go-between between her and the cafeteria (with all the appropriate balance sheets becoming updated along the way).

Thanks to network effects, everyone in this network can purchase items from the Cafe as long as they have a positive BTC balance in their accounts.

If there are multiple people with Multi-Sig accounts between her and the cafeteria, the payment tries to get from your co-worker (the origin) to the cafeteria (the recipient) using the path with the fewest intermediaries and the least fees (as long as the intermediates have enough money in their individual accounts). A transaction can thus jump through connected payment channels.

Conclusion

Scalability has been a major problem facing leading public blockchains. Facing competition from EOS, Qtum, Ethereum and others, the Lightning Network is Bitcoin’s effort to tackle scalability by conducting large numbers of transactions off chain, thereby reducing the load on the main Bitcoin blockchain. The Lightning Network is a much-needed initiative to tackle scalability on the oldest, most established and best known public blockchain.