As blockchain networks grow, they must decide which compromises they’re willing to make to scale. In line with Bitcoin ethos, the most uncompromising of these scaling solutions so far is the Lightning Network. It’s mechanics are fascinating, and even more impressive is the scale the LN can achieve: large enough to handle all global payments. Let’s see how.
Sections
Why Is Scaling So Hard?
How Can I Start Using the Lightning Network?
How Does the Lightning Network Solve Scaling?
What are Payment Channels?
How do Payment Channel Work?
What Keeps Payment Channels Secure?
How do Payment Channels Form the Lightning Network?
Closing Thoughts
My Other Writings
Why Is Scaling So Hard?
You may have heard of the blockchain trilemma, perhaps even in one of my past write-ups. The gist of it is that changing a blockchain to make it more scalable (in other words, faster or cheaper to use), often sacrifices decentralization or security.
As an example, if Bitcoin wanted to increase the number of transactions it could process by making every block larger, then every miner would need to download more data for every block, and they’d need stronger hardware and internet connections to do so. Those higher requirements means fewer miners can participate, and less miners means more centralization. We don’t want that.
How Can I Start Using the Lightning Network?
Before we get into the details, you can get your hands dirty using the Lightning Network with Bitcoin wallets that specifically support it. The Sparrow wallet is one example, another is Wallet of Satoshi, but keep in mind the latter is a custodial wallet, meaning they share control of your coins. Neither are sponsors, this newsletter is ad-free.
How Does the Lightning Network Solve Scaling?
The Lightning Network recognizes that Bitcoin blocks don’t need to be bigger, if instead we can minimize the number of transactions that need to be posted there. That number of actual Bitcoin transactions are minimized because most of them go through payment channels.
What are Payment Channels?
It’s best to explain this through an analogy (one that would entirely work on the Lightning Network, too). Imagine going to a restaurant with some friends and expecting to spend a lot of time there ordering many dishes. It would be pretty time-consuming (and honestly, quite bothersome) if the restaurant owner wanted payment for every dish as it comes out (beyond being expensive, considering credit card transaction fees).
Instead, you create a tab. You order as many dishes as you and your friends would like to enjoy, and when the night is over you pay the restaurant owner the final balance you’ve racked up. Instead of many transactions, you’ve only really performed that final one at the end of the night.
Payment channels work the same way. They’re like a tab between two people showing the balance they owe to each other. The only difference is that there’s no dishes on Bitcoin, so the payment channel starts by being loaded up with some BTC.
How do Payment Channel Work?
A channel can be created between you and I, for example, if I send 0.1 BTC to a “channel address.” A channel address is one that we both control; both of us need to approve a transaction to spend some of it. Spending basically involves moving some of that 0.1 BTC from being on my side of the channel over to being on your side. And crucially, this transaction isn’t posted to the Bitcoin blockchain, it just happens between us.
This could happen if I need to pay you 0.01 BTC (perhaps it’s your restaurant I’m dining at and I expect to do so again tomorrow), and when I send that 0.01 to you, that becomes the latest transaction in our channel. We can do as many of these as we like. Perhaps one of my steaks wasn’t cooked right and you refund me a small amount. All we need to do is update the tab.
Since we’re just updating the tab between us, we don’t need to post every single transaction to the Bitcoin blockchain. We only need to do that when we decide we want to close that tab out, and that can happen at any time.
What Keeps Payment Channels Secure?
You may have already picked up on a problem here. How does the Bitcoin blockchain know what transaction is the latest one in our channel? Well, it doesn’t. I may decide to dine-and-dash, and claim the entire 0.1 BTC that’s in our tab for myself. I could try this by claiming that no transactions happened, so that starting balance is what I’m entitled to.
This claim involves huge risk to me, though. If you can prove that a transaction did in fact happen that changed that balance afterwards, you’ll be entitled to all of the BTC in our channel. I’ll lose everything. With the brilliance of cryptography, it’s very easy to prove that a transaction happened afterwards, and a timelock exists to ensure you have an opportunity to do exactly that.
Timelocks don’t count time, but blocks instead. When one of us tries to close the channel without the other, the timelock determines how many blocks need to pass before that transaction can go through. In our case, you have that many blocks worth of time to contest my claim.
If you don’t contest my false claim that doesn’t mean I’ve won yet, thanks to watchtowers. These are nodes that watch transactions on the Lightning Network with one purpose only: calling out false claims that would award an attacker with the money in the channel in case of no dispute.
Alternatively, if we both agree to close the channel, it happens instantly.
How do Payment Channels Form the Lightning Network?
Our example so far imagines a single payment channel between you and I, but let’s start adding more to see how a network quickly forms. If I have a payment channel with Bob and you have a payment channel with Alice, those two could also pay each other by routing those payments through us. In other words, Alice pays you, who pays me, who pays Bob.
To ensure the money reaches its destination, there’s a password on those funds called a hashlock that only the intended recipient can “open.” Though the payments go through us, there’s no risk we can run off with that money ourselves. Furthermore, as “nodes” in this new network, we can demand fees for routing those payments, making it profitable to participate.
For users, the network offers incredibly low fees and the possibility of millions of transactions per second across the network. The limiting factor is how powerful a path of nodes may be. But all those nodes have to do is talk to the node that sent them the payment, and the next one that’s routing that payment along to its final destination.
Since the bandwidth requirements aren’t high at all, we can also have some nodes be able to process far more transactions than others. This is quite different from the reality on Bitcoin L1 or any other blockchain, where all nodes must move in lockstep together, never one getting ahead of the other.
Now imagine thousands or millions of channels, connecting people around the world with near instant and low-cost payments. And there you have the Lightning Network.
Closing Thoughts
The Lightning Network is perhaps the most scalable scaling solution in crypto; it can expand to encompass millions of transactions per second, beating today’s payment processors by miles. There are also unique features that have become possible thanks to the LN.
As an example, AI agents based off of ChatGPT can be given access to a wallet on the Lightning Network and spend money to access pages on the internet that they couldn’t otherwise. Innovation fosters innovation, and there’s plenty more that the Lightning Network can offer.
Thank You & Additional Reading!
Thank you for reading! Here are some more resources if you'd like to dive deeper.
[Video] Non-Technical: Lightning Network Explained by Andreas Antonopoulos (Love this guy)
Subscribe below if you enjoyed the write-up. If you already have, thank you! Consider sharing the write-up with others please <3
Stay kind. Stay curious. 😶🌫️
My Other Writings!
Here you’ll find the other articles I’ve written since my last write-up. Check them out for more blockchain content!
Wanna lose money? Buy bonds instead of Bitcoin w/ Cryptonary
KPMG greenlights Bitcoin, now heading towards $32,000 w/ Cryptonary