Apr 11, 2024
Are you sick and tired of paying exorbitant gas fees when using Ethereum? Well, these L2 scaling solutions may be the key to circumventing these issues. Creating a scalable, cost-efficient, and decentralized means of using Ethereum.
The congestion and high costs associated with Ethereum’s network have led to the development of layer 2 solutions, each designed to tackle these challenges head-on. These include rollups, state channels, plasma, sidechains, and validium, each with its unique approach to improving Ethereum’s network performance.
Rollups: A Game-Changer in Transaction Efficiency
Rollups have emerged as a pivotal layer 2 solution, processing transactions outside the main Ethereum chain and posting transaction data back to it. They come in two flavors:
- Optimistic Rollups: Operating on the principle of assumed validity, these rollups only verify transactions when challenged. Notable examples include Optimism and Arbitrum.
- Zero-Knowledge Rollups (ZK-Rollups): These rollups take hundreds of transactions off-chain, produce a cryptographic proof (zero-knowledge proof), and post this proof alongside the transaction data to the main chain, exemplified by zkSync and Loopring.
Please note that Zk Rollups consist of Zk-Snark and ZK-Stark, however, for simplicity purposes, I will only be discussing Zk-rollups as a whole.
Simple Explanation: Rollups
Rollup: multiple transactions ROLLED into one transaction.
Example:
Imagine Ethereum is a busy motorway with a toll booth, the cars on the motorway are the transactions. During peak hours, the motorway becomes congested, leading to delays and higher toll fees (gas fees). To alleviate congestion, two new lanes are introduced: zk-rollups and optimistic rollups. These two new lanes allow cars to group into buses (bundled transactions), which means instead of having individual toll fees for each car, you now just have one toll fee for the whole bus (which consists of individual cars).
The toll booth only needs to process fewer transactions (buses) instead of individual cars. The rollups increase the scalability of the highway and reduce the costs (transaction fees).
Simple Explanation: Zk-Rollups
Zk rollups: combine a bunch of things into one rolled-up thing, HOWEVER, they do not use smart contracts.
Zk-Rollups (zero knowledge rollups): take all transactions off-chain combine them into a single transaction, and then generate a cryptographic proof known as zero-knowledge proof. The cryptographic proof + data about transactions is submitted to the Ethereum blockchain. The zero-knowledge proof attests that all transactions in the bundle are valid without revealing specific details about them.
Essentially, you are bundling transactions into one single transaction and then generating a cryptographic proof called a ZKP which is submitted to the Ethereum blockchain and attests all bundled transactions are valid without actually revealing details about the transaction.
Example:
– Send secret message to a friend in a locked box
– You send the key to open the box via a secure courier
– Your friend receives the box and the key but doesn’t know the courier’s identity or how the key was sent
- Similarly, zk-Rollups ensure transaction validity without revealing transaction contents through zero-knowledge proofs
Optimistic Rollups
Optimistic rollups: optimistic rollups have their own optimistic virtual machine, which allows them to do stuff with smart contracts HOWEVER they are slower and less efficient.
Optimistic rollups assume all transactions bundled together and submitted to the Ethereum blockchain are valid by default, however, there is a challenge period during which these transactions can be disputed if someone believes a transaction is fraudulent. If a transaction is fraudulent, it is rolled back (transaction reversed/unsent). i.e. optimistic rollups are OPTIMISTIC about all transactions being valid.
Here’s a step-by-step process of how optimistic rollups occur:
1) Submission: transactions bundled together and submitted to the Ethereum blockchain as a single batch via the optimistic roll-up system. The optimistic rollup system assumes these transactions are valid, without performing validation checks.
2) Challenge period: after submission, there is a designated waiting period (challenge period) where anyone can challenge and question the validity of the transactions in the batch. If someone detects a fraudulent or incorrect transaction, they can submit a challenge against it
3) Challenge process: if the challenge is valid, and proves that a transaction within the batch was invalid, the specific transaction is targeted for reversal
4) Rollback: reverse specific transactions, not all the bundled transactions. The blockchain ledger is updated to reflect the state before the invalid transaction was executed. For example: if the transaction involved transferring 10ETH from Alice to Bob, rolling back the transaction would restore the 10 ETH to Alice’s account as if the transfer to Bob never happened
5) Impact on the Batch: the rest of the transactions in the batch, if they are not challenged would remain valid and processed.