What is Bitcoin Lightning?
Let's unravel the mystery behind Bitcoin's most highly acclaimed second-layer technology and explore how this innovative solution enhances the network.
Why is this important?
In my previous publication What is Bitcoin, I guided readers through a comprehensive, high-level exploration of Bitcoin's essence and fundamental operations. While the code for Bitcoin, known as Bitcoin Core, is expected to remain unchanged for the foreseeable future, Bitcoin as a whole is still in its infancy as a financial and cybersecurity technology.
Bitcoin Core excels in numerous aspects, yet there are notable areas requiring improvement. For instance, traditional Bitcoin transactions tend to be relatively slow, rendering them unsuitable for swift settlements essential for day-to-day purchases. Additionally, the limited block size leads to a significant increase in on-chain transaction costs over time. While a $5 transaction fee for the final settlement of a $1,000,000 transaction within 30 minutes is unprecedented in the fiat currency realm, Bitcoin cannot be considered a comprehensive solution if it costs $5 and takes 30 minutes to settle a mere $15 purchase at a grocery store.
Moreover, Bitcoin inherently provides transparency for every on-chain payment ever made. I extensively discussed this in my previous publication and offered my insights. While having an on-chain history is advantageous, particularly when purchasing property, we must resist the surveillance of our transactions by governmental bodies, financial institutions, intelligence agencies, or any other intrusive entity. In my view, the Keep It Cash Movement, despite its (in my opinion) attempt to address a profound issue with superficial solutions, correctly identifies the threat to individual autonomy posed by the increasing reliance on fiat digital payments and the gradual elimination of cash as a medium of exchange. Digital payments overseen by central banks are subject to monitoring, blocked payments, and potential debanking, as seen during the peaceful 2022 Ottawa Trucker Rally. Privacy is indispensable for preserving freedom, and surrendering it jeopardizes both.
Given this context, it is a legitimate and rational concern that Bitcoin could facilitate monitoring of users' transaction activity. In fact, I would argue that it already does to some extent. While some claim it to be a Trojan horse for Central Bank Digital Currencies (CBDCs), I personally disagree. However, I do acknowledge that Bitcoin could potentially be wielded in a hostile manner against humanity if we, the people, become complacent, fail to educate ourselves, and neglect active engagement with Bitcoin. The adage "If you don't use it, you'll lose it" applies here. Moreover, if you misuse it, someone else may exploit you.
In summary, for a fair, decentralized, ethical, and secure alternative to the dollar bill, we require a method to execute small Bitcoin transactions rapidly, affordably, and privately. Fortunately, the solution already exists and is continuously evolving; it´s called the Lightning Network.
The Lightning Network: Real-world Applications
If you find Bitcoin to be conceptually alien, I assure you that the Lightning Network is even more so. The understanding of Lightning, which we will reach together today, is not required to use it, but I think it is important for us all to have an adequate comprehension of the technology which surrounds us. An understanding of Bitcoin Lightning and its limitations does help to prevent and resolve potential issues.
For context before we delve into unfamiliar technical territory, please take a moment to watch these brief video demonstrations of the Lightning Network in action.
Showcasing Lightning Payments: Seamless Transactions Between Two Phoenix Wallet Applications
Lightning-Enabled ATM: Selling Bitcoin for Local Currency - Live Demonstration
Bitcoin Burrito: Lightning-Fast Purchase Demonstration
Lightning-Powered Bitcoin Debit Card Demo: Seamless Online Purchase from Retailer Without Native Bitcoin Payment Option
How Bitcoin Lightning Works
This high-level overview of how the Lightning Network functions is meant to provide readers with a basic understanding of the technology. As with anything complex, delving deeper reveals even more intricacies. While I'll include advanced material at the end for those interested in exploring topics like Lightning cybersecurity and conditional logic, my main goal is to ensure that the general audience grasps the topic well, while also providing a gateway for those with a deeper interest in the finer details.
Contents:
What is a Lightning channel?
Opening a Lightning channel and making a transaction
What are the transaction fees?
What does it mean to close a Lightning channel?
How do channels connect to form a network?
What is a Lightning Channel?
The fundamental components of the Lightning Network are referred to as Lightning channels. These channels establish a direct connection between two parties, enabling a seamless flow of off-chain transactions with virtually no limit to their volume or speed. Essentially, this means that these transactions occur without the need to broadcast any information to the main Bitcoin blockchain, thus bypassing public ledger recording.
Opening a Lightning channel and making a transaction
To initiate a Lightning Channel, both parties contribute an initial balance of Bitcoin to a shared on-chain multi-signature address - a shared Bitcoin wallet with special configurations. This initial contribution, termed as collateral, determines the maximum amount of Bitcoin that can be transferred between the parties. Once the channel is activated, both participants gain the ability to send funds back and forth as frequently as desired. Each transaction updates the channel's balance accordingly, ensuring accurate tracking of funds exchanged.
For instance, if Bellamy runs a bakery and Clarke is a recurring customer, they can open a Lightning channel between them in which Clarke deposits 0.01BTC in a shared multi-signature wallet, and Bellamy deposits none. Initially, Clarke has a balance of 0.01BTC in their Lightning channel, and Bellamy has a balance of 0BTC. When Clarke makes a purchase, Bitcoin is moved from her balance to Bellamy´s by exchanging a special ticket similar to a cheque. If she buys 0.002BTC worth of baked goods (roughly $194 thanks to food inflation), her balance within the channel will be updated to 0.008BTC, and Bellamy´s will be updated to 0.002BTC. When the next transaction is made, they both tear up their copies of the previous digital cheque (figuratively speaking) and replace it with a new one reflective of their updated balances
What are the transaction fees?
While there are use cases for it, it is unusual for a Lightning channel to be intentionally set up directly between two parties for the sake of buying bread. In a real-world scenario, Bellamy and Clarke would likely have opened their own Lightning channels with a service like Phoenix Wallet, and Clarke would have transferred her Bitcoin through a network of interconnected payment channels connecting her to Bellamy. The result, as seen in the earlier videos, is a seamless and simple user experience, but the underlying mechanism is far more complex. We will revisit the details shortly, but it's worth briefly mentioning that there is an incentive structure in place for other parties on the Lightning Network to connect and facilitate transactions between Clarke and Bellamy. This results in a current average network fee of 0.000083 satoshis per satoshi. A satoshi (sat) is equal to 0.00000001 BTC and is the smallest measurable unit of Bitcoin. Therefore, the 0.002 BTC transaction would incur a network fee of 17 satoshis, equivalent to 0.00000017 BTC, or $0.16 at current exchange rates.
Comparing this to fiat payments, an e-transfer typically costs $1, and an ATM cash withdrawal charges $3, and monthly service charges of regular bank accounts typically exceed interest rates. The Lightning Network champions inexpensive and instant sovereign transactions, with privacy that rivals and possibly exceeds cash as it is commonly used today.
Closing a Lightning channel
Similar to how a channel is opened, its termination employs a special on-chain closing transaction, which releases the funds from the shared multi-signature wallet and sends Bitcoin to both parties, true to their final balances recorded in the Lightning channel. The closing transaction is signed by both parties using their private keys and then broadcast to the Bitcoin network. Once confirmed on the blockchain, the funds allocated to each party are transferred to their respective private Bitcoin wallets, concluding the channel, as there is no longer collateral between them to move back and forth.
For the most part, there are two scenarios for closing a Lightning channel: cooperative closure and unilateral closure. In cooperative closure, both parties agree on the final balance, and the closing transaction is mutually signed. In unilateral closure, if one party becomes unresponsive or tries to cheat, the other party can unilaterally close the channel by broadcasting the most recent channel state, ensuring they receive their rightful share of funds from the multi-signature address.
In either case, both parties receive the correct sum of Bitcoin to their personal Bitcoin wallet from the now-empty multi-signature address, the channel is closed, and both parties gain access to their funds on-chain. From the ledger's perspective, Bitcoin went into a multi-signature address from two parties, and those two parties received a different output of Bitcoin from that multi-signature address after some time had passed; no data is collected regarding the activity in-between those two events. Additionally, these users can further protect their privacy by cleaning their Bitcoin with CoinJoin or other methods, or better yet, use non-KYC bitcoin to begin with.
How do channels connect to form a network?
In our previous example, Clarke and Bellamy transacted directly with no intermediaries, but (as mentioned in the section regarding transaction fees) this is rarely the case. We call it the Lightning Network because thousands of individual Lightning channels are interconnected, much like the roads that connect a country. Conceptually, since in our example Clarke and Bellamy did open up a channel together directly, now anyone who has a channel open with Clarke can transact with Bellamy through her (and vice versa).
If Jasper, having already opened a channel with Clarke, wants to buy baked goods from Bellamy, he can do so without opening up a new Lightning channel. This saves him from paying on-chain fees for an opening transaction, waiting a minimum of 10 minutes, and compromising his privacy on the public ledger. When Jasper “sends” bitcoins to Bellamy via Lightning in this case, it may appear that Bitcoin is going directly from Jasper to Bellamy, but in actual fact, Bitcoin is going from Clarke to Bellamy, and then Clarke is reimbursed by Jasper. Since Clarke´s current balance (her collateral) in her lightning channel with Bellamy is 0.008BTC, Jasper can send up to that amount to Bellamy through her.
This is where the transaction fees apply. Clarke, as an intermediary, is compensated for facilitating the transaction. The larger the collateral balance of a Lightning user, the larger transactions they can facilitate, and larger transactions yield greater compensation. This is why it is harder to do larger transactions through the Lightning Network; channels with smaller balances are more common than larger ones.
I personally had an incoming transaction equivalent to $1000 get stuck when I started experimenting with Lightning because I did not know this at the time. The explanation for this is that the protocol struggled to find intermediaries with sufficient collateral to connect me to the other party. In this case, it made more sense to make an on-chain transaction, so we reverted the payment and did just that.
In another example, Raven wants to send 0.004BTC to Jasper. She has a channel open with Bellamy; Bellamy has a channel open with Clarke; and Clarke has a channel open with Jasper. So for this transaction to succeed, Clarke must first send 0.004BTC to Jasper, then Bellamy must send 0.004BTC to Clarke, then finally, Raven sends 0.004BTC to Bellamy. Did you notice the issue in this circumstance? Bellamy, if you recall from earlier, only has 0.002BTC of collateral, so it is not possible for him to fulfill the conditional logic.
In practice, the Lightning Network dynamically selects intermediaries in a manner optimized for highest capacity, lowest fees, and reliability. In the real world, Bellamy would not be selected as an intermediary by the protocol for this transaction. Similar to the complex neural pathways of the human brain, the Lightning Network comprises a maze of pathways between nodes, with each channel serving as a conduit for endless routing possibilities.
In Closing
When it comes to unraveling the complexities of Bitcoin Lightning, I owe much to the pioneers in this field. One standout figure is the YouTuber Curious Inventor, whose insightful explanations shed light on the intricate technical aspects that underpin the security of the Lightning Network. My main motivation in crafting this article has been to address what I perceived as a lack of introductory material on the subject. I hope that my efforts have served to fill this gap. Through context, breakdowns, high-level overviews, and custom illustrations, my aim has been to lay a solid foundation for grasping this topic and prepare you for the deeper explorations that lie ahead, should you wish to delve further.
If you would like to support my work, please consider subscribing to receive updates of my future pubications, and if have found that my material has shined a light on this topic for you, please consider sharing it with others.
Thanks!
Excellently written, and good job at addressing Bitcoin as a digital currency in comparison with CBDCs and other cryptocurrencies. No tool is ever perfect, and Bitcoin is no exception. However, as you highlight here, it certainly does a better job at many things than the conventional digital payment infrastructure currently does. I can see a world using a hybrid of physical commodities like gold and silver combined with something like Bitcoin being something that covers all bases while not succumbing to many of the problems of government-inflated and digitally-tracked fiat currencies. Good stuff!