This is an opinion editorial by Stanislav Kozlovski, a software engineer and macroeconomic researcher.
Many Bitcoiners have heard of Bitcoin’s “lack of scalability” — it is one of the most common critiques waged against the project by both gluttonous cryptocurrency competitors and incumbent establishment actors.
Some oldtimers may remember the heated, bathed-in-controversy Blocksize Wars of 2015 to 2017 which, aided by industry insiders, most shallowly aimed to make Bitcoin scale to more transactions by increasing the maximum block size and by doing so, almost set precedent and changed Bitcoin’s future course forever.
Both of these issues will ultimately prove to be left on the wrong side of history. In this piece, we are going to show how the Lightning Network addresses Bitcoin’s scalability problems and undoubtedly proves that the small-block decision was ultimately the right one.
Base Layer Limitations And Choices
Before we understand what the Lightning Network is solving, we should first understand what the inherent problem is. Simply put: You cannot scale a blockchain to validate the entire world’s transactions in a decentralized way.
Blockchains suffer from an inherent limitation which forces them to trade off between three qualities — one quality of their system has to go for the other two. As pictured above, a blockchain can only reliably have two of these three qualities:
- Decentralized: not controlled by any single party or a small number of elites
- Scalable: scale to a sufficient number of transactions
- Secure: not be easy to attack and break its invariants
It is worth noting that all of these characteristics sit on separate, complex spectrums. For example, you don’t become “secure” over a certain threshold, it is very dependent on the use case and many different characteristics.
Bitcoin is slow for a reason. It explicitly picked to optimize the “security” and “decentralization” sections of the trilemma, leaving “scalability” (transactions per second) on the sideline.
The key realization is that, much like today’s internet and financial system, it is more optimal to comprise the whole system of separate layers, where each layer optimizes for and is used for different things.
Bitcoin, the base layer, is a globally-replicated public ledger — every transaction is broadcast to every participant in the network. It is evident that one cannot practically scale such a ledger to accommodate the entire world’s growing transaction rate. Apart from being impractical and privacy damaging, its drawbacks vastly outweigh its insignificant benefits.
Back in the day, there was a major civil war between the online community in what Bitcoin should do to increase its transaction throughput capacity. There is major, infuriating controversy in this story and is in large part what shaped Bitcoin to remain what it is today — a grassroots, bottom-up movement where the average people (plebs), in aggregate with one another, dictate the rules of the network.
“The Blocksize War” by Jonathan Bier illustrates the battle between the decentralized network supporters wanting what’s best for the long-term viability of the network and the greed and propaganda perpetuated by major players and corporations to further their own power-gaining and profit-seeking agendas.
Long story short, Bitcoin was forked into a failed fork named “Bitcoin Cash.”
The little guy eventually won — Bitcoin did not rush any bad design choices that would come to compromise its decentralization, security or censorship resistance. The decision was effectively made to scale Bitcoin through layers, introducing second layers that work separately from Bitcoin and checkpoint their state to the main, slower-but-more-secure network.
In stark contrast, the evidently-unsuccessful fork Bitcoin Cash sacrificed all hopes of decentralization by increasing its block size to 32 megabytes, 32 times more than Bitcoin, for a mere maximum of 50 payments per second on the base chain.
Each Bitcoin block has a cap on its size and this denotes the upper bound on how many transactions can exist inside of a block. If demand grows to outpace the amount of transactions a block can have, the block becomes full and transactions get left unconfirmed in the mempool. Users begin to outbid each other via the adjustable transaction fee in order to have their transaction be included by the miners, who are incentivized to choose the highest-paying transactions.
A naive solution to this would be to simply increase the block size limit — that is, allow more transactions to be included in a block. The negative side effects of this are subtle enough that even intellectuals like Elon Musk make the mistake of suggesting it.
Increasing the block size has second-order effects which decrease the decentralization of the network. As the block size grows, the cost to run a node in the network increases.
In Bitcoin, each node has to store and validate each transaction. Further, said transaction has to be propagated to the node’s peers, which multiplies the network’s bandwidth requirements for supporting more transactions. The more transactions, the more the network’s processing (CPU) and storage (disk) requirements grow for each node. Because running a node yields no financial benefits, the incentive to run one disproportionately decreases the more costly it is.
To put it into numbers, if Bitcoin is to ever scale to Visa’s purported peak capacity levels (24,000 transactions per second) a node would need 48 megabits per second (Mbps) second just to receive the transactions over the network. The following is a map showing the average internet speed in the world:
As you can see, a massive part of the world’s average speed would exclude them from the ability to run a node under these conditions. Note that average speed implies that many are even lower than said threshold. Additionally, it doesn’t account for the fact that a user would have other uses for their bandwidth — few selfless people would dedicate 50% of their internet bandwidth for a Bitcoin node.
More importantly, the amount of data this would generate would make it impossible for anybody to practically store it — it would result in 518 gigabytes of data per day, or 190 terabytes of data a year.
Further, spinning up a new node would require one to download all of these petabytes of data and verify each signature — both of which would make it so that a new node would take a long time (years) to spin up.
And to make matters worse, 24,000 transactions per second doesn’t make for a truly unique global payments network in and of itself. Visa isn’t the only payments network in the world, and the world is growing more interconnected every day.
Lightning Network 101
The Lightning Network is a separate, second-layer network that works on top of the main Bitcoin network. Simply said, it batches Bitcoin transactions.
To access it, you need to run your own node or use somebody else’s. The network has two concepts worth understanding for the purposes here:
- A Lightning node: separate software that communicates with each other and constitutes a new peer-to-peer network.
- Channels: a connection opened between two Lightning nodes, allowing for payments to flow between them.
A channel is literally a Bitcoin base layer transaction, anchoring the channel to the secure chain.
Once two nodes open a channel between one another, payments start flowing between them. Each subsequent payment modifies the channel’s state, cryptographically revoking the old one and checkpointing the new one in memory and on disk of both nodes, but critically, not to the base chain.
Channels can and in my opinion ideally should stay open for a long time (e.g., a year or more). If the nodes ever decide to close down their channel, their latest balance after all the off-chain payments is restored to their original wallets. This is cryptographically-secured by hashed timelocked contracts (HTLC) and digital signatures, which we won’t get into detail for the purposes of this article.
This allows one to batch billions of payments into two on-chain transactions — one for opening the channel and one for closing it. Once a payment is complete, it is indisputable what the latest balance is between all parties (assuming nodes redundantly store their channel checkpoints).
Critically, one need not be directly connected to another party in order to pay them — channels can be used by other nodes in the network in order to increase their reachability. In other words, if Alice is connected to Bob and Bob is connected to Caroline, Alice and Caroline can seamlessly pay each other through Bob.
As we will now prove, the Lightning Network already scales to support 16,264 transactions a second today and therefore solves the scalability problem while preserving all the benefits Bitcoin has to offer — permissionlessness, scarcity, user sovereignty, portability, verifiability, decentralization and censorship resistance.
For a payment to make its way through the network, it typically has to go through multiple payment channels. To answer how many payments the network can do in a second, we need to understand how many an average channel supports.
Statistics show that the average payment goes through around three channels.
The benchmark numbers we will use for this analysis have per-node throughput capacity, not per-channel. Therefore, we will inaccurately assume that each node has just one channel. The default LND node is said to be able to do 33 payments per second with a decent machine (8 vCPUs, 32 GB memory) according to the benchmark.
With 16,266 nodes in the network (as of November 2022), assuming each payment has to go through three channels (four nodes), the network should be able to achieve around 134,194 payments per second.
That is, each payment has to go through a group of four nodes, and there are 4,066 such unique groups in the network. Assuming each node can do 33 payments a second, we multiply 4,066 by 33 to reach 134,194.
Now, to be realistic: Not every node is running a machine like the one in the benchmark — many are simply running on a Raspberry Pi. Thankfully, it doesn’t take much to be able to beat the current payment systems.
Lightning Vs. Traditional Payments
Finding authentic numbers about the peak capacity of traditional payment systems is hard, so we will rely on their average payment rate throughout the 2021 financial year. We will compare that to the theoretical capacity of Lightning, because conversely, getting the average rate of payments in Lightning is impossible due to its private nature, and is also not revealing of capability because the demand for Lightning payments is still relatively low. This comparison will give us an idea of how many payments a Lighting node needs to be capable of routing in order to out-compete traditional finance.
Visa saw 165 billion payments in 2021, PayPal saw 19.3 billion payments across its whole platform and FedWire saw 204 million. Respectively, these amount to 7,372, 612 and 6.5 payments per second on average for 2021. To put into perspective, Bitcoin did 2.44 payments per second in 2021 and scales up to a maximum of seven per second.
The numbers are promising — it takes each Lightning node to be capable of doing just four payments a second in order to beat the current payment networks by at least two times. At that rate, 4,066 unique four-node groups can achieve 16,264 payments per second — 2.2 times that of the largest competitor, Visa.
To make matters worse for traditional payment networks, the average Lightning transaction fee is 13 times less that of Visa — 0.1% compared to 1.29%.
It’s worth remembering that one could always continue to scale the Lightning Network by creating new nodes. Since it is peer to peer, its scalability is theoretically unlimited as long as nodes in the network grow.
Further, the aforementioned benchmark by Bottlepay makes the case that there are no real technical blockers for Lightning node implementations to eventually reach 1,000 payments per second. At such a number, the network’s current throughput would be closer to four million per second, not to mention what it would be with an increase in the number of nodes.
And lastly, it is worth remembering that the Lightning Network is still very much immature software and has a fair amount of future optimizations to be done, both in the protocol and its implementations. Resources in terms of developers are the only short-term constraint to increasing scalability, which has rightfully come second to more important matters like reliability.
To give a sense of the progress there, River Financial recently shared that its payment success rate is 98.7% at an average size of $46, which is astonishingly better than the earliest publicly-available data it could find from 2018, where $5 transactions were failing 48% of the time.
In this piece, we exposed all of the negative drawbacks of scaling the Bitcoin blockchain through increasing the base layer’s block size, most notably severely compromising its decentralization and ultimately failing to achieve its aim of reaching the immense scalability needed for the demands a global payments network has and will continue to increasingly have in the future.
We showed that the Lightning Network, as a second-layer solution, most elegantly solves the scalability problem by both preserving all of Bitcoin’s benefits while at the same time scaling it way beyond what any base-layer solutions promise.
This is a guest post by Stanislav Kozlovski. Opinions expressed are entirely their own and do not necessarily reflect those of BTC Inc or Bitcoin Magazine.
#Lighting #Network #Bitcoin #Scalable #Bitcoin #Magazine