First conceptualized by Joseph Poon and Tadge Dryja to help scale up Bitcoin, the lightning network has become one of the most critical layer-2 innovations in the crypto space. The chances are that in the near future, you are probably going to exclusively use the lightning network to conduct all your Bitcoin transactions. So, what exactly is and how does it work? Plus, why did we need this in the first place? We will learn all about that in this guide.
The Need for Lightning Network
Bitcoin’s scalability problem is nothing new. The community has been talking about this issue for the last three years. Long story short, the original architecture of Bitcoin isn’t suited for mass adoption and use. We have talked about this in detail before. However, there is one more potential obstacle that is inhibiting mainstream adoption. Towards the end of 2019, Blockchain Capital predicted that on-chain Bitcoin transaction fees will reach $100 in 2020. This makes sense because of the following reasons:
- With increased use-cases and mainstream acceptance, the demand for Bitcoin will rise, which will inevitably increase the transaction fees.
- Many users will want to jump the queue and get their transactions processed faster by increasing their fees. If a majority of the users follow suit, then it will inevitably increase the average fees.
Note: When all the Bitcoins will be mined out, it’s speculated that the transaction fees will be high enough to economically incentivize the miners to continue serving the network.
However, this is not ideal for mainstream adoption. 3.4 billion people earn less than $5.50 a day. For them, it’s not really practical to pay such high fees. This is the exact reason why Lightning Network is such an important innovation. According to Blockchain Capital’s Spencer Bogart, this increase in mining fees is only going to increase the demand for Lightning Network.
Lightning Network – Looking underneath the hood
The lightning network is a two-way payment channel between users, which enables them to conduct transactions, which would typically occur on the blockchain, off the blockchain. A payment channel is a specialized form of state channel. In a state channel, a portion of the blockchain is sealed off via multi-signature or smart contract, which is pre-agreed upon by the participants. In this channel:
- The participants can directly interact with each other without submitting anything to the miners.
- These participants can engage in multiple microtransactions with each other.
- When the payment channel is closed, the final transaction set is added to the blockchain.
Think of it as a series of IOUs between two parties. Consider this example. Alice and Bob have to transact frequently with each other. However, the amount that they actually transfer during these transactions isn’t significant. In this case, using the bitcoin blockchain will not be practical for them. Instead, this is what they can do:
- Both Alice and Bob each set aside $20.
- The combined $40 is kept inside a locker. Both of them own half of the access code
- There is also a ledger that notes the balance that each of them owns. So, in the beginning, both of them have $20 against their names.
- If Alice has to pay Bob $10, she doesn’t need to have the cash on hand. Both of them can simply open the locker and update their balance in the shared ledger. So, following this particular transaction, Alice’s balance will be $10 and Bob’s will be $30.
- As long as the parties can trust each other, they don’t need to settle the balances in the real world. Think of how you keep tabs with your friends in real-life.
This state channels can be closed at a point that is predetermined by the participants. These predetermined conditions could be one of the following:
- A certain amount of time has passed.
- A certain amount of transactions have been processed.
As mentioned before, state channels that deal only in payments are called payment channels. The following are the most important form of payment channels:
- Nakamoto High-Frequency Transactions.
- Spillman-Style Payment Channel.
- CLTV-Style Payment Channels.
- Hashed Timelock Contracts (HTLC)
HTLCs are the most convenient application of the payment channels. Using HTLC, one can open up payment channels where funds can get transferred between parties before a pre-agreed deadline. The payments get acknowledged between the parties via the submission of cryptographic proofs. HTLCs have three pretty amazing features:
- It allows a party to forfeit the payment given to them and return it to the payer. This wouldn’t be possible in a conventional blockchain transaction.
- It makes cross-chain transactions aka atomic swaps possible. In simple terms, this feature will allow users to swap one cryptocurrency on one chain with a cryptocurrency on another chain.
The Lightning Protocol happens to be an implementation of the HTLC.
- The Lightning Network is a technological solution intended to solve the problem of transaction speed on the Bitcoin blockchain by introducing off-chain transactions.
- Like a primary blockchain, the Lightning Network disintermediates central institutions, such as banks, which are responsible for routing most transactions today.
- The Lightning Network was first formally proposed in a paper by Joseph Poon and Thaddeus Dryja in 2016.
How do the nodes in the lightning network link up?
The lightning network can be used to link up to become payment networks of thousands or even millions of users. Let’s take an example. Imagine this situation:
- Bob and Charlie are partners in a company and already have a payment channel between them for expense purposes.
- Bob’s wife, Alice, wants to transact with Charlie. Bob and Alice happen to have a payment channel between them for household expenses.
- Through Bob, Alice and Charlie will be able to create a payment channel for their lightning transactions.
- Now, let’s scale this up. Imagine that Alice, Bob, Charlie have 50 unique payment channels with other users and each one of those users has 50 other payment channels. This potentially leads to millions of unique nodes being capable of transacting with each other through the lightning network.
How does the Lightning Network maintain its security?
It’s safe to assume that all these lightning network channels in total will transact millions of dollars every single day in the near future. So, this begs the question. How are these channels maintaining their security? What is going to prevent a malicious user from taking off with all the money inside these channels? Well, let’s take a look.
#1 Guided by smart contracts
The lightning network is guided and governed by smart contracts. Smart contracts are self-executing, automated contracts which can be used by two parties to directly interact with each other, without having to go through an intermediary. A smart contract will make sure that users don’t interfere with transactions and act in the interest of the system.
As mentioned before, the participants need to agree beforehand as to how long they want the payment channel to be open. Timelocks can be used to set an upper limit on the channel’s lifespan. Not only will this make transactions more efficient, but it will also stop a participant from disappearing and leaving the balance locked in the wallet.
#3 Asymmetric Revocation Commitments
Asymmetric revocation commitments are a technique that can be used to punish users who try to cheat the system. The lightning network uses this to allow users to set conditions where the cheated user could claim the full balance of a wallet.
How expensive is the lightning network?
The fees connected in the lightning network are negligible compared to the fees charged by the miners on the Bitcoin blockchain. The reason behind this is straightforward. The work done by miner nodes is significantly harder and more vital than the work done by the lightning nodes. However, since the lightning network will be heavily used, the cumulative fees collected should be more than enough to compensate the nodes for their services.
How do you use lightning network?
Going back to our previous example, Alice wants to conduct transactions with Charlie via Bob.
- Alice opens a channel with Bob and Bob opens a channel with Charlie.
- Suppose Alice declares that she wants to interact with Charlie.
- Charlie declares a random number and generates its SHA256 hash and hands it to Alice. Basically, if Charlie chooses a number A then he will give the hash of the number H(A).
- Alice sends 0.1 BTC to Bob with the condition that only someone who can submit the data required to get the same hash can retrieve the payment. For Bob to misuse the funds, he will need to have the data, aka the pre-image necessary to generate that hash. Basically, Bob will have to give “A,” which he doesn’t have.
- Bob now hands over the funds to Charlie using the same condition. Charlie finalizes the payment from Bob by handing him over the pre-image “A.”
- Bob finalizes the payment from Alice by handing her “A.”
Is lightning network live? Statistics
We will take our stats from 1ml.com.
As per the screenshot, here are some key stats that you need to take note of the following key stats:
- There are 11,563 nodes, of which 6,379 with active channels.
- In total, there are 36,328 total channels.
- As of right now, these channels have a capacity of 897.91 BTC, which is roughly equal to $8.7 million.
Now, let’s look at the distributions of these lightning nodes throughout the continents:
- North America and Europe have, by far, the densest concentration of nodes and channels.
- North American channels have the most capacity with 223.60 BTC, while Europe is a distant second 186.82 BTC.
- Interestingly, Asia only has 89 nodes and 390 channels with a 26.57 BTC capacity.
Now let’s look at the countries with the highest number of lightning nodes and channels:
- The United States is the runaway leader in this department with a staggering 413 nodes and 2,598 channels.
- Both Germany and France have more nodes and channels than Australia, but the latter has a higher capacity than both of them.
We can even look at the cities with the most lightning activity.
- Columbus has the highest capacity of nearly 32 BTC.
- Ashburn has the highest amount of nodes and channels.
- The only non-American cities in the top five are Cape Town and Dublin.
Advantages of the Lightning Network
So, why use the Lightning Network? Let’s look at the advantages:
- Fast Transactions: The average confirmation time for Bitcoin is about 10 mins. This time can be significantly reduced with the Lightning Network. Through these channels, microtransactions can be done in a matter of seconds.
- Low Transaction Fees: Normal Bitcoin transaction fees can range anywhere between $0.2 – $4. However, as we said before, the fees paid for lightning transactions are significantly lower. In fact, these fees range between 1–10 satoshi ($0.00008 — $0.0008), making them ideal for quick daily transactions.
- Reduce Blockchain Bloating: Since the lightning network conducts transactions in layer-2, it doesn’t bloat the base blockchain.
- Atomic Swaps: Different blockchains can link with each other via payment channels. Through these channels, users can perform atomic swaps to exchange cryptocurrencies with each other.
- High Security: The protocols within the Lightning Network make the payments secure and not vulnerable to attacks. In particular, it utilizes onion routing for its HTLCs.
- Constant Upgradation: Being one of the hottest projects in the crypto space, it’s no surprise that the lightning network has managed to attract a very healthy developer community. New and more exciting features and upgrades are added pretty regularly to the Lightning Network.
- Seamless User Experience: On paper, the Lightning Network sounds pretty complicated, right? However, its user interface has been designed specifically to provide a seamless user experience. It uses an appropriate amount of abstraction to hide all the complicated details from the user.
Flaws of the Lightning Network
- Participants need to be online: Traditional Bitcoin transactions are asynchronous, meaning, participants don’t need to be online to receive transactions. However, for a lightning channel to be functional, the participants will need to be online to conduct transactions.
- Private keys may be vulnerable: To use these lightning channels, participants will need to keep their relevant funds in a hot wallet. However, hot wallets are incredibly unsafe and may make you susceptible to hacks.
- This is still early days: While the lightning network is a great innovation and has a very active developer community, the reality is that this is still early days. As such, the code may still be susceptible to bugs. One bug, in particular, could have allowed an attacker to claim to open a channel but either not pay to the peer, or not pay the full amount. Thankfully the bug was identified and eventually dealt with.
Best Lightning Network Wallets
So, you are excited to use the lightning network? Here are some of the wallets that you can use to access the network with ease.
- Bitcoin Lightning Wallet (BLW): BLW has a powerful and well-supported Lightning app which the users can use to send and receive Bitcoin payments. This wallet is available on Android.
- Eclair: Created by ACINQ, Eclair is one of the most popular Lightning wallets and allows its users the ability to create traditional Bitcoin wallets. Backed by an active developer team, Eclair enjoys frequent updates, which could be pretty exciting for a crypto enthusiast. This wallet is available on Android.
- Zap: Zap provides a clean and simple user interface that could be used to perform transactions on the Lightning Network. This wallet is available on iOS, Windows, Mac, and Linux.
- Tippin.me: This is a custodial wallet that can be easily accessed via a web browser like Chrome or Firefox. As the name suggests, users can use this to tip others via the Lightning Network technology and even add a “Lightning tip” button to their own websites.
- Bluewallet: The Bluewallet was created to bring zero-configuration Lightning Network transactions to both Android and iOS devices. While this one is custodial by default, you have the option of connecting it to your node. Bluewallet also has a marketplace of “Lapps” (Lightning applications) like Bitrefill, Yalls, Zigzag, Ln Roulette, and Pollo feed.
Litecoin and Lightning Network
While we have talked about the lightning network in the context of Bitcoin, the concept of bi-directional payment channels is nothing new. Litecoin also has its own iteration of the lightning network. Here are some of the stats surrounding Litecoin’s lightning network.
- There are 220 nodes in Litecoin’s Lightning Network with 666 channels.
- This network currently has a capacity of 162.04 LTC or ~$12,800.
Along with Bitcoin, several projects like Decred, Ethereum, etc. are working on their own implementations of bidirectional payments channels.
The Lightning Network may go down as one of the most significant innovations in the crypto space. The biggest obstacle holding back mainstream adoption of cryptocurrencies was that they weren’t practical to use in real life. However, now with the Lightning Network, transactions can become extremely fast, making cryptocurrencies highly usable. It will be exciting to see how the network grows in the near future.
The future of Lightning Network
Fortunately for the Lightning Network, however, adoption is on the rise. According to DappRadar, there is over $110 million in Bitcoin locked into the Lightning Network. These could be people paying for goods and services, utilizing apps, gambling and more.
Some apps are vital to network usage, such as Lightning Network compatible wallets. Considering that the Lightning Network is a separate protocol from Bitcoin’s mainnet, it requires a different type of wallet so users can create payment channels. Traders cannot utilize the Lightning Network without optimized wallets. If Lightning Network adoption continues to grow, the industry can expect more wallet developers to integrate Lightning Network support. Dedicated users can also become a node, speeding up Lightning Network transaction times.