So WTH is Lightning Network?

TL: DR;

The Bitcoin Lightning network is a layer 2 built on the Bitcoin Core network to allow instant near-free transactions with Bitcoin. The Bitcoin Lightning Network was built to address the scalability issues of the Bitcoin Core; it allows fast payments within nodes in its network.

The Bitcoin scalability problem

The Bitcoin scalability problem refers to the limited capability of the Bitcoin network to handle large amounts of transaction data on its platform in a short span of time. It is related to the fact that records (known as blocks) in the Bitcoin blockchain are limited in size and frequency. - Wikipedia.

Hardforks and Alt-coins

This problem including others have led to ongoing conversations within the community and have led to several blockchain currencies like Litecoin, Ethereum, Bitcoin Cash, etc. Or hard forks on the Bitcoin Core like Bitcoin XT, Bitcoin Classic, Bitcoin Unlimited.

However, these forks were not accepted by the Bitcoin developers community. This is because it goes against the core principles of Bitcoin Core from Satoshi's whitepaper.

Due to the fact that these standards were not approved by the community, they went ahead to be rather standalone coins and what Bitcoin developers refer to as altcoins.

"Layer 2" systems

The Lightning Network is a “layer 2” payment protocol that is layered on top of a blockchain cryptocurrency. To allow fast micropayments of its cryptocurrency among its network nodes. There are currently only two lightning network implementations on Bitcoin and Litecoin cryptocurrency.

With the layer 2 system, there is no change on the Bitcoin Core, it neither needs approval from the Bitcoin developers nor is there any need for an upgrade from all running nodes on the Bitcoin network.

How does the lightning network work underneath?

The lightning network consists of nodes that connect to form channels, thereby forming a matrix of peers who can send and share money with each other through the basic invoicing protocol.

A Lightning node is a software that connects and interacts with the Bitcoin mainet network as a backend and also connects and interacts with other nodes within the Lightning Network itself.

The lightning Network works on a peer system between its channels, allowing the flow of payments bidirectionally without delegating custody of funds.

Alice and Bob

Alice and Bob are trying to set up a channel to make micropayments between each other and other nodes in the lightning network. First, off they will have to set a lightning node running on their bitcoin node.

To open a channel, funds will have to be made to a two-party, multi-signature "channel" bitcoin address. A multi-signature bitcoin address is one that requires funds leaving the address will have to be signed by all parties, in this case, two lightning nodes. So, Alice creates a channel with Bob, with 0.5 BTC. A channel funding transaction can also be made by both parties.

After this transaction is confirmed on the bitcoin blockchain and a channel is created with the amount used in the multi-signed bitcoin address, in the channel, a balance is shown to display how much Alice and Bob have in regards to the channel's total balance. In this instance the channel’s total balance is 0.5 BTC, Alice has 0.5 BTC and Bob has 0BTC.

Alice makes a payment to Bob of 0.2 BTC, the channel’s balance is still 0.5 but Alice currently has 0.3BTC and Bob has 0.2 BTC of the total balance. The current balance is stored as the most recent transaction signed by both parties, spending from the channel address.

Alice and Dave

If Alice wants to make a payment to Dave, she doesn’t need to set up a channel with Dave. All nodes have multi-signature channels with many different nodes on the network, so one can make a payment to any other node within the network.

If both parties(Alice and Dave) are participating nodes with channels on the network, payment can be routed between both nodes using peers(other channels and nodes in the network).

For Alice to make a payment, she requests a payment invoice from Dave, using this invoice she can get the route and the number of hops(hops are channels found in the payment route) to send her payment to Dave. In this case;

  • Alice has a channel with Bob
  • Bob has a channel with Carol
  • Carol has a channel with Dave

Alice gets a 0.1BTC invoice from Dave, and sends a 0.1 BTC to Bob, to make Bob have 0.3 BTC and her 0.2BTC, included in that payment has a hashed information that Bob has to make that payment to Carol. With that information, Bob makes a 0.1BTC to Carol between their channel(Bob<>Carol) channel, and that also includes hashed information to make that same payment between Carol’s channel with Dave, rebalancing their individual percentage of the (Carol<>Dave)channel’s balance.

Note: The Lightning Network does not require cooperation from the counterparty to exit the channel. Both parties have the option to unilaterally close the channel, ending their relationship.

Lightning Network specifications (BOLTs)

The lightning network in its core is a set of specifications called BOLTs. Basis of Lightning Technology (BOLT) are sets of protocols that supervise the creation and management of nodes, channels and invoices. These BOLTs are released and Lightning network managements like the following implement these standards and make them accessible to the community to build on.

Software implemented these BOLTs specifications that help developers set up and manage nodes and lightning payments. They are;

Benefits of the Lightning Network

Privacy: Individual payments are not recorded on the blockchain giving people much needed privacy. Also, payments being routed through channels don’t display who the source(sender) and destination(receiver) are. Speed: Lightning network transactions are settled in a minute and can occur in milliseconds. Compared to Confirmation time on the bitcoin blockchain, of an average of 10 minutes. Less Transaction fees: Transactions are near-free payments with just fees ranging from 0.0001 to 1 satoshi for payment. Large volume of transactions: Large payments can also be made in seconds on the lightning network benefit from the above.

Lightning Network Ecosystem

Currently, this is what the Lightning Network Ecosystem looks like. It is notable to see how the network is growing.

Source: The state of lightning

P.S: This article is a rough overview of the workings of the lightning network and is the beginning of a series that a deep dive into the lightning network.

Reference:

Other Posts

Powered By Swish