Layer 2 refers to technologies that allow an application to scale by processing transactions outside of the Ethereum Mainnet (layer 1) while preserving the same security and decentralization as the mainnet. Layer 2 solutions boost transaction speed, or throughput, while at the same time lowering gas costs. Polygon and Polkadot are popular Ethereum layer 2 solutions.
What makes Layer 2 solutions so important?
Although the Ethereum blockchain is the most commonly utilized and likely the most secure, it is not without flaws. The Ethereum Mainnet is notorious for its long transaction times (13 per second) and high gas fees. Layer 2s, which are built on top of the Ethereum blockchain, ensuring that transactions are secure, fast, and scalable.
Each system has its own set of advantages and disadvantages to consider, including throughput, gas costs, security, scalability, and, of course, functionality. At the moment, no one layer 2 solution can meet all of these requirements. However, there are layer 2 scaling techniques known as rollups that try to improve all of these qualities.
Layer 2 solutions are significant because they provide scalability and greater throughput while maintaining the Ethereum blockchain’s integrity, allowing for complete decentralization, transparency, and security while lowering carbon emissions. Less gas means less energy is utilized, which means less carbon is produced.
Rollups on the Ethereum Blockchain
Rollups are layer 2 scaling solutions that offload transaction processing off the main Ethereum network while still posting transaction data to layer 1. Because the transaction data is on layer 1, the same layer 1 security requirements apply to rollups. This is, in fact, the distinguishing feature of rollups for users.
A layer 2 rollup has three characteristics.
- Transactions take place outside of layer 1.
- Data and proof of transactions are stored on layer 1 (maintains security).
- By utilizing the transaction data saved on layer 1, a rollup smart contract found on layer 1 can ensure correct transaction execution on layer 2.
There are two types of rollups, each with its own set of security features.
- Optimistic rollups presume transactions are valid by default and only compute, using a fraud proof, when a challenge is issued. Optimistic rollups run on layer 2 in parallel to the Ethereum Mainnet and by default do not do any calculation (mathematical equations). Instead, they publish the modified state to the Ethereum Mainnet after the transaction is complete, thereby notarizing the transaction.
- Zero-knowledge rollups perform computations off-chain and transmit a proof of validity to the main chain. ZK rollups (zero-knowledge rollups) combine thousands of transactions off the main Ethereum chain to construct a cryptographic proof known as SNARK (succinct non-interactive argument of knowledge). This is referred to as a validity proof, and it is published on the Ethereum Mainnet.
The data of all transfers is kept on layer 2 by the smart contract for a ZK rollup, and it can only be modified with validity proof. In other words, instead of all the transaction data, ZK rollups just require validity confirmation. Because less data is included in this function, the cost of transacting is reduced.
Ethereum layer 2 solutions have the potential to drastically alter the blockchain ecosystem. Layer 2 solutions ensure that users may preserve all of the security features found on the Ethereum Mainnet while also transacting swiftly and for little to no cost.