Scaling the blockchain- Why Decred chose to scale using the Lightning Network
If you have a use case that involves frequent, micro and instant transactions, as is the case with Bison Relay. The Lightning Network facilitates this with ease.
LISTEN TO THE PODCAST:
The scaling debate is an interesting topic that has got extremely heated over the last few months. With advocates for both sides putting forward valid points. Personally, I don’t think it’s a binary decision, “one way is not always better than the other”. In each example, there are trade-offs, and depending on your position, you will likely decide in favour of one or the other.
In this article, we’ll have a look at some of these arguments and identify why Decred has taken its scaling route.
Scaling Layer 1 – Block size, speed, sharding and pruning
Advocates of layer 1 scaling will usually point to the fact that if you have larger blocks (e.g. 100 MB per block), that are mined more frequently (e.g. every 1 second), you can scale to accommodate a global economy. This, of course, is true, but there are side effects that should be considered.
The first being, is this action will lead to extremely large blockchains that will no longer, be able, to be run from home on a personal computer. Instead, the blockchain will need to be housed in a data centre. This will increase centralisation, that will eventually prevent peer to peer transactions, in the purest sense.
- Larger blocks = more transactions per block
- Fast blocks = more transactions and quicker settlement times
- Larger blockchain = reduced accessibility for independent full node operators
- Data centres = more centralised
People in favour of layer 1 scaling also point to pruning and sharding solutions, which allow the network to remove transactions before a particular time or distribute the ledger among various machines.
The main risks here will come down to incorrect pruning, distribution and ledger manipulation. One possibility, is that the history of coins gets distorted and there are limited ways to validate correctness, due to the history of these transactions no longer being available in their fullest state.
- Pruning - Remove transaction history to reduce the size of the blockchain
- Sharding - Distribute the blockchain ledger across trusted validating nodes
One example where I see this being a huge problem is with privacy coins or blockchains that include privacy features. Privacy transactions that have been completely anonymised to the point it’s impossible to tell which coins belong to which balances, makes these solutions almost impossible to deploy with 100% accuracy.
Non-scaling Layer 1 blockchains
Advocates for not scaling layer 1, will normally point out the opposite to scaling issues. For instance, leaving the blocks small (e.g. 0.5 MB per block), and having a longer time between blocks (e.g. 5 mins) will lead to a significantly smaller blockchain. If the blockchain remains small enough to run on a home computer, this will preserve the peer to peer nature of the network.
The downside is that blocks will fill quickly if the project becomes popular, transactions will take longer to process, and transaction fees will become expensive.
- Small, slow blocks = less transactions & slower settlement
- Small blockchains = more decentralised
- No data centres = P2P network
If you are a non-scaling advocate, you need to realise, what you put on-chain has to be limited and data efficient. It’s for this reason, non-scaling layer 1s, are not efficient at storing small or micro-transactions or being used to store excessive data, like images, audio, and video.
- Micro-transactions are not possible on-chain
- Storing excessive data is not a good idea
- Layer 1s processes transaction slower with higher fees
- Layer 2s can process micro-transactions
- Layer 2s are near instant and cheap
Layer 2 solutions
For non-scaling layer 1 blockchains, layer 2 solutions become essential for the purpose of growth and additional use cases. These solutions allow for extensive transaction activity, without the data weight being passed to the blockchain.
Advocates for scaling blockchains are mainly against layer 2 solutions, due to the fact, they facilitate uses and use cases that can be conducted on-chain on the layer 1. For scaling blockchains, layer 2 solutions are considered an unnecessary fragmentation of liquidity for the entire network. Scaling advocates will also point to the fact these solutions are taking fees and rewards away from the miners and validators, which in turn reduces profitability for these entities and reduces security for the network.
- Layer 2s facilitate the same uses and use cases as layer 1
- An unnecessary fragmentation of liquidity
- Layer 2s Reduces layer 1 profitability
- Layer 2s Reduces layer 1 security
The same is not necessarily true for non-scaling blockchains, as the expectation for fee and block rewards are mostly pre-determined. Although miners, would like full blocks, layer 2 functionality is not taking away this profitability. In fact, having layer 2 functionality adds and increases the transaction count as these solutions become more popular.
- Layer 1 can’t facilitate the same uses and use cases as layer 2
- Enables micro-transactions
- Enables cheap & instant transactions
- Layer 2s have very little impact on layer 1 profitability or security
The Lightning Network
In my opinion, the Lightning Network is currently the best solution for non-scaling blockchains, as it has the most development and has been vigorously tested. The Lightning Network is definitely not perfect and can be improved with time and the use of additional opcodes.
If you have a use case that involves frequent, micro and instant transactions, as is the case with Bison Relay, you literally can’t do this on-chain with non-scaling blockchains. But the Lightning Network does this with ease and adds no data bloat back to the chain.
The Lightning Network conducts the bulk of its transaction activity off-chain, periodically settling on-chain as a single transaction. This basically means you can conduct thousands of transactions off-chain and, when ready, bundle all of this activity back to the blockchain in a single transaction. Effectively acting as an efficient pruning solution for participating coins.
- Thousands of transactions per second
- Instant settlement
- Micro-transaction
- A standard transaction fee of 1 Atom (0.00000001 DCR)
The Lightning Network enables blockchains like Decred to facilitate new peer to peer use cases like social media, tipping, messaging, file sharing and marketplaces without adding undesirable bloat.
Value extraction
How do people benefit from a blockchain scaling or not scaling? In the scaling world, value extraction is big money. If a scaling blockchain removes layer 2 solutions, all value extraction from transactions and block production will be conducted on layer 1. Value extractors would no longer have to split their investments between the most popular layer 2s and layer 1.
In the non-scaling world, profits are made by block production rewards and transaction fees. On some blockchains, miners are incentivised to fill blocks and the mempool, to increase the fee a user will pay for a transaction to be processed. This can be done in several ways. For example – producing empty blocks, not accepting transactions with low fees, or dumping excessive data into the mempool to increase the minimum fee to get a transaction added to a block.
As a side note, Decred has written consensus rules to mitigate against these scenarios and shenanigans, these rules are enforced by proof of stake validators.
Layer 2’s deliver worse UX
This is an easy theory to dismiss, and it’s mostly nonsense. A user only needs to try Bison Relay to know that layer 2 applications offer an equal user experience to layer 1 applications.
Although, it’s fair to say, until using Bison Relay, my experience of the Lightning Network had been fragmented at best. Bison Relay shows the true potential of what can be achieved with the Lightning Network and how streamlined the layer 2 experience has become.
- Lightning Payments and tipping
- On-chain payments
- Messaging and group chat
- Social news feed
- Storefronts
- Web pages
Why did Decred choose the Lightning Network to scale?
Although Decred handles on-chain transactions very efficiently and is a long way from having full bocks. If and when the network gets popular, it will face similar issues to the majority of blockchains, congested blocks with high fees. Decred is building a digital ecosystem with a wide array of user experiences and use cases, like Bison Relay. These kinds of use cases can’t be built on-chain as there is a need to process high volumes of transactions, thousands per second, most of which are micro-transactions.
- To mitigate against congested blocks with high fees
- To increase user experiences
- To facilitate micro-transactions and transaction volume
- To facilitate cheap & fast transactions
- 1000s of transactions per second
- close to zero fees (1 atom)
- 1 atom micro-transactions
- Reliable and secure
In its current state of development, the Lightning Network is already capable of processing thousands of transactions every second. Without the Lightning Network, Decred’s current layer 1 consensus configuration is set to process approximately 5 transactions per second, or approximately 1500 transactions per block. This can be scaled to process more transactions per second, with a consensus vote if needed. But on-chain transactions, including micro-transactions, would still be slow and expensive to process. For example, a 1 atom (0.00000001 DCR) transaction would cost more than 1000 atoms (0.00001000 DCR) in fees. On the Lightning Network, this same transaction can be achieved at the cost of 1 atom (0.00000001 DCR) and processed almost instantly.
On-chain transaction details:
- Block interval = 5 mins
- Block size = approx 0.4 MB
- On-chain transactions = approx 1500 per block
- Average transaction fee = approx 1000 atoms (0.00001000 DCR)
Lightning Network transaction details:
- Transaction time = near instant
- On-chain weight = near zero
- Transactions per second = 1000s
- Average transaction fee = 1 atom (0.00000001 DCR)
Conclusion
In my opinion, layer 2 solutions offer a lot of hope for the future and are probably our best opportunity to remain true to a peer to peer economy. My main concern regarding scaling layer 1s, revolves around the need to house their infrastructure in data centres when the blockchain becomes too large. This would essentially remove the peer to peer, permissionless nature of the blockchain.
What do you think, are layer 2 solutions the future, or should we scale the blockchain at layer 1?
Debate Links:
Comments ()