The main task for increasing the TPS of the Ethereum network without increasing the load on the nodes was the introduction of Sharding in combination with the transition to PoS (Proof of Stake) consensus. This involved dividing validators into subgroups to process separate segments of the network, thereby reducing the overall load and increasing throughput. However, the community has focused on Layer 2 solutions, considering their rapid development.
In addition to the idea of implementing Sharding in Ethereum, other scalability solutions have emerged, such as:
- Payment and State Channels
- Sidechains
- Plasma
- Optimistic Rollup
As well as technologies based on Zero-Knowledge Proofs (ZKP), including:
- Validium
- zkRollup
- Volition
More detailed information can be found here.
Although Sharding is still under development, the Dencun hardfork is planned for early 2024, which will implement Proto-Danksharding. This intermediate step is aimed at improving Layer 2 solutions, making data storage on L1 more economical. Thus, Proto-Danksharding promises to reduce transaction costs on L2, as a step towards a full-fledged Sharding solution.
At first glance, L2 blockchains may seem similar, as their main task is to increase the number of transactions outside of L1 while delegating the role of security guarantor to L1. Developers of such blockchains often claim that their solutions are the fastest, most reliable, and simplest. In reality, each approach to scaling has its nuances, and inevitable compromises regarding transaction speed, security level, or degree of decentralization. Fully centralized solutions are also common. All these aspects bring us back to the fundamental issues of the blockchain trilemma.
In this article, key criteria for evaluating protocols used in Layer-2 solutions are proposed. They include:
- security,
- performance and economic efficiency,
- ease of use,
- additional aspects such as smart contract support, EVM bytecode compatibility, and privacy options.
Important! The article is written by Matter Labs and, in my opinion, some things are "stretched" in favor of zkRollup (since there is a clear conflict of interest), but that's not so important, the main thing is to see what differences exist between Layer-2 protocols.
Below I will provide a table, and here I will briefly describe its contents.
Security
Assumption of Liveness or "viability" of Layer-2. It is assumed that for maintaining the functionality of Layer-2, some participants will always be onchain at Layer-1 level to respond to potential fraud cases. These are either validators who stake a certain amount of funds (marked as "Bonded" in the table) on L1, or third parties who ensure the security of the protocol for a reward. As seen in the table, solutions using ZKP (Validium and zkRollup) do not have this necessity.
Mass Exit Problem. A problem that arises if, for security reasons, it is necessary to initiate the withdrawal of funds by all users from L2 to L1. As seen in the table, this problem exists only with the Plasma protocol, more about which can be read here.
Custodianship. The question of whether L2 validators can temporarily block or confiscate users' funds.
Economic Vulnerabilities. Includes various attacks on L2 validators, including bribing L1 miners, creating "shadow" DAOs, and other economically motivated attacks.
Cryptography. The difference between standard and new cryptographic primitives. Standard ones are more studied and potentially vulnerable, while new ones (such as SNARK and STARK) provide greater reliability but require additional knowledge and audits from developers.
Performance and Economics
With performance, it's straightforward. TPS (Transactions Per Second) indicates the network's throughput, and in the context of scaling, it's the most crucial parameter.
Economic aspects:
Capital Efficiency: This aspect is especially important for Payment Channels. They require freezing funds equal to the average volume of operations in the channel, making them less efficient in terms of capital investment.
L1 Transaction for Creating an L2 Account. Also a drawback for payment channels, as in all other solutions an account created in L1 works in L2 by default.
Transaction Cost: Along with TPS, this is one of the most critical factors of scalability, determining the economic attractiveness of the solution.
Ease of Use
Withdrawal Time from L2 to L1: This period can vary from several minutes to several weeks. Optimistic Rollups and Plasma are particularly inconvenient in this regard, as they require more time for fund withdrawal.
Time to Subjective Finality of Transaction: Determines how quickly a transaction becomes irrevocable on L1 from the perspective of external observers. For example, in Optimistic Rollups, achieving finality on L1 requires only one confirmation on Ethereum, but full transaction finality takes about a week.
Verifiability of Subjective Finality with Client Code: Determines whether the time to subjective finality can be checked by light clients (browsers/mobile wallets). Continuing with the example of Optimistic Rollups, to confirm transaction finality, a user must download and verify the entire state rollup for the past week.
Instant Transaction Confirmations. Can the protocol provide instant transaction confirmations with full guarantee? Or does it guarantee this only at the L2 consensus level.
Instant Visible Finality: Can be implemented on top of most L2 protocols, meaning transactions are instantly confirmed in the user interface. Only payment channels (state channels) offer full security guarantees for these confirmations, while in other protocols these transactions can still be reversed within a certain time before they are confirmed in L1.
Other Aspects
Smart Contracts: Consideration of whether the L2 solution supports fully programmable smart contracts, or only a limited subset of functions through predicates.
Compatibility with EVM Bytecode: Evaluates the feasibility of transferring existing Ethereum EVM bytecode smart contracts to L2 without significant changes.
Built-in Privacy Support: Consideration of the efficiency of privacy protection in L2 solutions, especially in the context of the availability and cost-effectiveness of confidential transactions.
Below is a comparative table of the main ZKP-based solutions:
For a more detailed understanding of Zero-Knowledge Proofs (ZKP), I recommend referring to this article in our blockchain-wiki, created by developers for developers with a love for proofs and deep dives into details.