In 2018, Ethereum’s inventor Vitalik Buterin termed the so-called ‘Blockchain Trilemma’. This is the assumption that no blockchain is powerful enough to stay decentralized, secure, and scalable at the same time.
In this text, we’re going to discuss scalability, i.e. the third part of this trilemma, in particular - the Layer-Two solutions as a mainstream method to advance the scaling of popular blockchains.
TL;DR: Layer-Two solutions should be referred to as a class of technical designs that allows to process some information off-chain, i.e. to reduce the usage of blockchain itself dramatically. This, in turn, results in increased TPS and lowered transactional costs for end users.
In general, what are L2s?
Every blockchain is a system for data transfer and storage. Actually, cryptocurrencies constitute just the most popular use case for blockchain-based data systems. And just like that for centralized data systems (servers, data drives, Internet channels, and so on), the capability of this or that blockchain system is always limited.
Typically, this capability is measured in ‘transactions per second’ or TPS, i.e. the maximum number of transactions this or that blockchain is available to handle every second. For instance, Bitcoin, the first blockchain, has 3 TPS capabilities, Ethereum’s bandwidth is around 15 transactions per second, and so on. That said, Bitcoin and Ethereum can confirm only 3 and 15 transfers every second, the 4th and 16th will be delayed, and so on. To provide the context, MasterCard has 2500 TPS.
In 2015-2016, when the number of blockchain users was low, nobody needed them to accomplish high transactional capability. But with the increased interest in blockchains, their operations were getting slower and slower.
As such, the engineers decided to reduce the volume of information transferred through blockchains directly. Say, 10% of sensitive data about this or that transaction is sent to blockchain while 90% is processed through some infrastructure that doesn't rely on blockchain. By the way, this 10% batch is enough for the entire transaction to be verified.
Infrastructure systems designed to partially process transactional data without accessing the main chain are known as ‘Layer-Two’ (second-layer, L2) platforms. They exist as a ‘second layer’ add-on built on the top of some blockchain - largely, the programmatic one.
First-gen L2s: Bitcoin’s Lightning Network, Ethereum’s Raiden
For the first time ever, this approach to scalability was proposed in 2015 when the Bitcoin’s Lightning Network was introduced by researchers. Initially, Bitcoin devs proposed to scale it by increasing the block size. In 2017, Bitcoin development studio Blockstream launched a viable prototype of Lightning.
The idea behind Lightning looks like that of BitTorrent or mesh communications networks. The transactions are sent between the ‘nodes’ and ‘payment channels’ instead of Bitcoin’s mainnet. Lightning Network is designed to find the optimized routing through existing infrastructure of the nodes.
Once the payment channel is ‘closed’, the data is broadcasted to Bitcoin’s mainnet.
LN makes Bitcoin (BTC) suitable for microtransactions, that’s why it is used by Twitter’s BTC integration.
In 2017, a similar protocol, Raiden Network, was proposed for Ethereum (ETH). When one or both of the participants in a payment channel wish to access their funds on-chain, they will present the Raiden balance proof which is digitally signed, and the final balance from the payment channel is then broadcasted directly on-chain with a transaction that closes the channel. This design is suitable for every ERC-20 token.
Ecosystem of Ethereum’s L2s: Plasma, ZK-rollups, What Else?
However, channel-oriented scalability solutions are suitable for value transfer, not for dApps operations. That’s why the new generation of L2 networks is designed to address Ethereum scalability in a more generalized manner eliminating the need to create channels between accounts.
All second-gen solutions leverage the same idea: they built a chain of transactions that operates in parallel to Ethereum’s mainnet. Periodically, the data about say 10 transactions is ‘rolled up’ and broadcasted to blockchain in the form of a single transaction through a specific structure dubbed ‘Merkle tree’.
Here’s how four transactions are ‘rolled up’ and sent to Ethereum // Image by Vitalik Buterin
The most primitive implementation of this idea is called Plasma; it is based on simply sending data from L2 to L1 every 10 seconds.
By Q2, 2022, two more complicated implementations are actively used by DeFis: Optimistic rollups and ZK-rollups (‘zero knowledge rollups). Optimistic rollups broadcast batches of data to Ethereum until someone proves that the network is corrupt while ZK-rollups modify the data structure before sending them to Ethereum and dramatically reduce its volume.