A Complete Guide On The Lightning Network In Bitcoin

Mayur Nathani
Coinmonks

--

Lightning Network

The Lightning Network is designed to fix the scalability issue of the Bitcoin blockchain, which can help the users to send or receive Bitcoins almost free. The transactions between two parties happen on the Off-chain/Layer 2. The Lightning Network is the most promising innovation that has helped the Bitcoin blockchain problem, and in this blog, I will be explaining everything that you should know about the Lightning Network -

What is a Lightning Network?

The Lightning Network is a 2nd layer of the Bitcoin network, which is known to handle off-chain transactions. The off-chain transactions happen between two parties. A Lightning Network channel makes transactions easier between two parties where they can send or receive transactions from each other. The scalability of the Bitcoin blockchain can be enhanced through the Lightning Network because it runs on the 2nd layer of the Bitcoin blockchain.

The scalability is the barrier restricting the Bitcoin blockchain from scaling properly, and the Lightning Network, which charges low fees and settles the transactions off-chain, helps the Bitcoin blockchain. Moreover, the Lightning Network has solved the problem of creating micro-payments like buying coffee with crypto is possible now, which speeds up the processing times and reduces expenses related to the Bitcoin blockchain.

Though the Lightning Network has solved the scalability issue in the Bitcoin blockchain, some issues are yet to be solved: malicious attacks and low routing fees.

Founders of the Lightning Network -

Thaddeus Dryja and Joseph Poon were two researchers who proposed the Lightning Network in 2015 in a paper titled “The Bitcoin Lightning Network.” The discussions of the payment channels were made by Satoshi Nakamoto, the anonymous creator of the Bitcoin Blockchain. The discussion of payment channels made by Satoshi Nakamoto was shared with his fellow developer Mike Hearn, and later, the discussion was published in 2013.

In 2016, the Lightning Labs were founded by Dryja and Poon, and there were a few other contributors, all of them focused on developing the Lightning Network. And finally, with various changes, the Lightning Network became compatible with the Bitcoin blockchain.

SegWit-based soft fork launched under Bitcoin in 2017 to free the space under each block for more transactions and remove a bug called transaction malleability. With the help of this bug, the user can lie to the network, fake transactions, and keep Bitcoins in their wallet.

In 2018, Lightning Labs launched the first beta version of its Lightning Network on the Bitcoin Mainnet. And thus, Twitter founder Jack Dorsey began their involvement in this project.

Lightning Network — Current State -

There has been impressive growth in the Lightning Network since its first beta launch in 2018.

As of 14th August 2022, the Lightning Network has boosted upwards of 17,796 online nodes, 87,122 active channels, and over 4,589 BTC capacity.

The figure 4,589 BTC is more than 300% compared to the mid of 2021, reflecting the explosive growth of the Lightning Network.

Twitter has rolled out a new tipping feature known as Tips, where the tipping can be done with the Bitcoin with the Lightning Network using Strike, a payment platform built on the Lightning Network that allows users to send and receive Bitcoin between two parties.

Moreover, Bitcoin can only handle 7 transactions per second (TPS). But, the Lightning Network helps solve those limitations by achieving 1 million transactions per second.

What is a Lightning Node?

The responsibility of the Lightning Network node is to monitor the underlying blockchain where it holds the token. Funds can be stolen from the user if the Lightning Network fails to do this responsibility.

Moreover, the responsibility of the Lightning Network node is to keep track of who holds what in their payment channels under the Lightning Network.

What is the difference between the Lightning Network Node and Bitcoin Node?

A Lightning Network node verifies the validity of the transactions between the users. And a Bitcoin node verifies the different transactions performed on the Bitcoin network.

The Upgrade of the Lightning Network -

Lightning Labs released the beta version upgrade of the Lightning Network Daemon (Ind), which is an implementation of the Lightning node. It includes the latest protocol upgrades, including Taproot and Musig2, making it a 0.15 beta version.

Ind is a component under the Lightning Network that handles various aspects like generating payment invoices, managing a database, revoking payments, etc. The latest update aims to help developers to create solutions under Bitcoin’s Lightning Network.

Conditional Smart contract under the Lightning Network -

Hashed Timelock Contract (HTLC) is a conditional contract under the Lightning Network. Using Hashed Timelock Contract (HTLC) reduces counterparty risk as this smart contract is a time-based escrow that will require a cryptographic passphrase to access the funds.

In short, the user has to perform 2 actions to access the funds — Enter a proper cryptographic passphrase and claim funds within a specific time. The user can lose their funds if they enter an incorrect cryptographic passphrase or if there is a delay in claiming the funds.

Bitcoin Scalability Issue -

As Bitcoin started gaining popularity, more transactions started happening on the blockchain. Blockchain is a technology that is a shared database that allows participants to check their transactions which are recorded under distributed ledger. The transactions performed on the Bitcoin blockchain are known as on-chain transactions.

Though every user or node receives copies of the transactions, every miner validates all the transactions, and thus, during high transaction volume, the transactions can bring down the system.

Thus, Bitcoin faces a scalability issue, which means there is an issue when more transactions are happening on the network. Thus, if Bitcoin needs to process more data, the networks need to scale, and it can allow more transactions to process efficiently.

How does the Lightning Network Protocol Work?

The Lightning Network protocol provides a peer-to-peer payment channel between two different parties. Once the channel is established between two parties, the payment channel allows unlimited, inexpensive, instant transactions. The Lightning Network acts as its own ledger for its transactions which could be anything for smaller goods or services, and those transactions won’t affect the Bitcoin network.

The user can create the payment channel by locking a certain amount of Bitcoin in the network. Once the Bitcoin is locked into the network, the user can invoice the amount to whatever seems fit for them. If the user wants to keep the payment channel ongoing, they must add Bitcoin consistently.

With the help of the Lightning Network, two parties can do the transactions without informing the Bitcoin blockchain. As all transactions within a blockchain do not require approval by all nodes, this strategy speeds up the transaction time. The routing transactions of Lightning Network nodes are formed by combining payment channels between the two parties. Therefore, the Lightning Network is said to combine many payment channels linked together.

Two parties can close the payment channel once the transaction is finished. The database on the payment channel is combined under one transaction and is sent for the recording to the Bitcoin mainnet. Combining dozens of small transactions under one transaction helps the nodes to validate the transaction in less time. And, without payment channels, minor transactions come in the way of bigger transactions, which congests the networks and require more nodes to validate.

Smart contracts are created between two parties when using the Lightning Network. The agreement rules cannot be broken as they are coded in the contract. Once the users agree to the requirements in advance, the contracts are created, and the Smart Contracts ensure that contract fulfillment becomes automatic. Once those contract requirements are met, like a customer paying the transaction amount, the contract fulfillment is done automatically without needing the assistance of any third party. Once the payment channel is validated under the Lightning Network, the transaction becomes anonymous. No one could see individual transactions, but only the total transfer value could be seen.

The transaction can be possible without any restriction on the off-chain/layer 2 of the Bitcoin blockchain. Off-chain transactions can be trusted because once the transaction is completed, the combined data is sent on the Bitcoin mainnet blockchain for recording once the payment channels are closed. As the layer 2/ Off-chain protocol has its own ledgers, the ledger always integrates back to the mainnet of the Bitcoin blockchain.

Importance of Watchtowers under Lightning Network -

Watchtowers act as a protector of the blockchain and identify malicious users who cheat other users within the channel under the Lightning Network. Moreover, Watchtowers monitors the Bitcoin blockchain 24/7 on behalf of their users. This helps the users that they are safe and can’t be cheated by anyone when they are offline.

Watchtower is an ecosystem of third parties that the users employ for their on-chain transactions, which is relevant to their lightning channels.

For the services of the Watchtowers, they receive a fee from the users, and two existing monetization methods can be deployed. The two monetization methods are subscription services and penalty transaction fees.

With recent developments in Watchtowers, they play a crucial role in the Lightning Network with scaling.

3 problems with the Lightning Network -

Though Lightning Network solves the Bitcoin blockchain problem by taking the transaction off-chain/ layer 2 and thus, it can process micro-payments between two parties.

But still, the Lightning Network doesn’t solve the whole problem of the Bitcoin blockchain and comes with 3 problems -

1. Opening and Closing Channel in Lightning Network -

Opening and Closing channels are divided into two costs under the Lightning Network between two parties. Though the Lightning Network provides unlimited transactions between two parties, opening transactions or deposits must be made via on-chain transactions on the Bitcoin network.

The two parties can make multiple transactions on the payment channel. Once the transactions are settled, and the users want to close the payment channel, the closing transaction has to be recorded on the Bitcoin blockchain for the settled amount.

2. Routing Fees -

Apart from the transaction fees required for Opening and Closing the payment channels, there is another fee known as the Routing fee, required to transfer the payment between the channels.

3. Susceptibility of the Nodes -

To send and receive payments, nodes on the Lightning Network should always be online. As the user uses private keys to sign in, thus, there is a possibility of the coins being stolen, and there will be a risk if the computer storing the private keys is compromised.

The Lightning Network provides the safest method to store cryptocurrency assets: Cold Storage.

3 ways to close the Payment Channel -

You can close the payment channel in 3 ways under the Lightning Network -

1. Collaboratively —

If one party in the payment channel initiates the channel’s closure in the Lightning Network and the other approves it. Then there will be no time lock, and the money is ready to be spent once the approval is confirmed. One of the best ways to select the payment channel is in the Lightning Network.

2. Unilaterally —

If the party wants to close the channel, then the party can initiate the closure of the payment channel in the Lightning Network even if the other party does not approve. This results in a time lock, and the other party can dispute the closure known as “Breach Remedy.” But if the other party does not dispute the closure, the funds will be free to use once the time-lock expires. This is also an acceptable way to close the payment channel in the Lightning Network.

3. Breach Remedy —

As a Lightning Network, transactions are timestamped. There is a possibility that one party attempts to cheat another party or breach trust by unilaterally closing a payment channel. This action results in a time-lock, and during this period, the party who was cheated can recover their funds and swap the entire payment channel using “Breach Remedy.”

Pros and Cons of Lightning Network -

The Pros of the Lightning Network -

The most important pros of the Lightning Network are cheaper and faster transactions which enable micro-payments. Without the Lightning Network, the users had to wait an hour to validate even a simple transaction and would have to pay high fees on the Bitcoin blockchain. Every small transaction comes with a longer wait because miners validate bigger transactions as they provide bigger rewards for mining the blocks.

The Lightning Network benefits from the Bitcoin blockchain protocol because the Lightning Network is the 2nd layer or handles the transaction off-chain. This means that the user can use the Bitcoin network for bigger transactions and can use the Lightning Network for smaller transactions without worrying about safety. The Lightning Network payment channel also provides private transactions, which means only the overall package is visible to other users, and individual transactions are hidden.

Atomic Swap is a technique where there is an exchange of cryptocurrencies between separate blockchains without any involvement of a third party. Atomic swaps are helpful compared to cryptocurrency exchanges and offer instant swapping with little to no fees or wallet transfers.

The Cons of the Lightning Network -

The user should have a compatible wallet to take advantage of the Lightning Network. Finding a wallet for the Lightning Network is easy, but the initial funding has to be done through the Bitcoin wallet, which costs a fee. So, to use the Lightning Network wallet, the users have to lose some Bitcoins from the Bitcoin wallet. Once the funds get transferred to the Lightning Network wallet, the user must lock their Bitcoin funds to create a payment channel.

Sending Bitcoin funds between different wallets can be annoying, so many new users are avoiding it. Though some wallets can manage both on-chain/ layer 1 and off-chain/ layer 2 transactions without paying fees, this will improve the convenience over time.

If the user decides to pull some funds back from the payment channel in the Lightning Network, then the user has to close the payment channel, and then he can receive the fund. But there is no possibility that the user can pull some funds from the existing fund and remain the payment channel open.

One of the major problems in the Lightning Network is offline transactions. If one party closes the payment channel while the other party is offline, the party triggering the closure can steal the fund.

Also, there are bugs in the Lightning Network, such as stuck payments, which means outgoing transactions don’t check for verification. Though the Bitcoin network can refund the stuck payment, it can take days because the first priority is the valid transaction over the stuck ones.

Closing Thoughts -

We can see the massive growth of the Lightning Network since its launch in 2018, and if the Lightning Network continues to grow in the future, there will be a demand for more wallet developers to integrate Lightning Network support. And this can speed up transaction times under the Lightning Network.

What are your thoughts about Lightning Network growth in the future?

New to trading? Try crypto trading bots or copy trading

--

--

Mayur Nathani
Coinmonks

Web3 Writer| Personal Brand Strategist | Co-Author of 2 Anthologies | International Guest Speaker. Connect - https://www.linkedin.com/in/learningwithmayur/