What is the challenge?
Ethereum blocks are restricted to the amount of data they can maintain. For instance, image a block can only do 10 transactions. For example, if 10,000 people want to do a transaction simultaneously, Ethereum will pick 10 of the highest bidding fees first.
Because gas fees are based on the present demand on the blockchain at a given point, these fees can become super expensive. However, because a transaction can be a piece of data as well, what if you could contain 10 transactions in one piece of data. In this case, we would have scaled to 100 transactions per block (instead of 10), simply by using the data portion instead of the transaction portion.
What is an Ethereum transaction?
Ethereum transactions are like instructions that accounts give to the network. Hence, the Ethereum network state will be updated when a transaction has been sent.
The easiest type of transaction is a token transfer, which involves transferring ETH from one account to another. Also, each time a smart contract gets deployed onto the testnet or mainnet, it must be done with a transaction. And each time a user interacts with a smart contract, this interaction also takes place through a transaction.
A submitted transaction includes the following information:
- recipient — the receiving address
- signature — the identifier of the sender (when the sender’s private key signs the transaction and confirms the sender has authorized this transaction)
- value — the amount of ETH to transfer (in WEI)
- data — an optional field to comprise arbitrary data
- gasLimit — the maximum amount of gas units that the transaction can consume.
- maxPriorityFeePerGas — the maximum amount of gas to be included as a reward to the miner
- maxFeePerGas — the maximum amount of gas willing to be paid for the transaction (retains baseFeePerGas and maxPriorityFeePerGas)
Gas refers to the computation needed to process the transaction by a miner.
What are Ethereum rollups?
Rollups are layer 2 scaling solutions that execute transaction operations off the main Ethereum blockchain while still posting the transaction data onto layer 1. Considering the transaction data is on layer 1, the same layer 1 security measures secure rollups. This is the descriptive feature that rollups offer to users. Rollups are helpful because they reduce gas fees, increase transaction throughput, and expand participation.
Two main categories of rollups
The main concern of rollups is how Ethereum knows that the posted data is valid and wasn’t submitted by someone trying to exploit the system? The answer depends on the specific rollup implementation, but in general, each rollup deploys a set of smart contracts on Layer 1 responsible for processing deposits and withdrawals and verifying proofs. Let us look at some of the rollups currently utilized on the Ethereum blockchain and how they work.
Category 1: Optimistic rollups (fraud-proofs)
Optimistic rollups suppose transactions are valid by default and only run computation via a fraud-proof. It only proves that a state transition was false when somebody decides to challenge the transaction. Optimistic rollups pose in parallel to the Ethereum Mainnet on layer 2 and do not perform any mathematical calculation by default. Instead, after the transaction is finished, they propose the new state to the Ethereum Mainnet, virtually notarizing the transaction. Optimistic rollup transactions are written into the main Ethereum blockchain, besides optimizing transactions by decreasing the cost of gas.
Advantages of optimistic rollups include:
- Boosted throughput
- Lower gas fees
- Smart contract capability
- Security guaranteed by the Ethereum Mainnet
Disadvantages of optimistic rollups:
- If a fraudulent transaction is found, the rollup will automatically invoke a fraud-proof and conduct the transaction’s computation using the available written data, guiding to long withdrawal times if the transaction is doubted.
- Lengthy withdrawal time because challenge periods can last for weeks
There are a couple of optimistic rollups as follows:
- Fuel Network
Category 2: Zero-knowledge rollups (validity-proofs)
Zero-knowledge rollups (ZK rollups) collect thousands of transactions off the main Ethereum chain and make a cryptographic proof known as validity proof, namely SNARK (succinct non-interactive argument of knowledge), shipped to the Ethereum Mainnet.
The smart contract for a ZK rollup saves the data of all transfers on layer 2, and the data can only be edited with validity proof. This means that ZK rollups only require validity proof instead of all the transaction data. This function lowers the cost to transact due to less data being included.
When it comes to ZK rollups, there is small hesitance when moving assets from layer 2 to layer 1, considering the validity proof has already been approved by the ZK rollup and has already authorized the transaction.
One drawback of ZK rollups is that generating a validity proof is a complex and time-consuming task. Another drawback is the inability to execute smart contracts, although there are some exceptions.
On the other hand, ZK rollups do not require a challenging period, as the validity proof has already verified the legitimacy of transaction data. This is why ZK rollups allow for speedy withdrawal times. Thus, while ZK rollups are typically not good for general-purpose applications, they are great for exchanges or dApp that require small payments.
Advantages of ZK rollups :
- Quick transfers
- Secure against the attacks that optimistic rollups may be affected by
- Still decentralized
Disadvantages of ZK rollups:
- Validity proofs are intense to compute for smaller applications with less on-chain activity
- A user can change transaction ordering
There are numerous applications of ZK rollups, such as:
- Matter Labs zkSync
- Polygon Hermez
In the end, rollups are Ethereum’s solution to solve low transaction times, crazy gas fees, and improve scalability at the Ethereum Layer 1 level.