What are Rollups?
Rollups execute transactions outside the main Ethereum blockchain (L1) and then post transaction data to the blockchain. Rollups inherit the security properties of the Ethereum blockchain since transaction data or proof of transaction is located on the blockchain (L1). Rollups require “operators” to stake a bond in the rollup smart contract (L1) which incentivizes operators to verify and execute transactions correctly.
The main goals of rollups are to:
Reduce transaction fees for users.
Increase open participation.
Increase the transaction throughput to decrease network congestion.
There are two different types of rollups: 1) Zero-knowledge rollups and 2) Optimistic rollups. Both types of rollups achieve the goals of rollups albeit with varying security models.
Zero-Knowledge Rollups
Zero-knowledge rollups (“ZK-rollups”) bundles transactions off-chain and submits them to the Ethereum blockchain in a single transaction. The proof of validity used by ZK-rollups is a cryptographic proof called a SNARK (Succinct Non-Interactive Argument of Knowledge). The ZK-rollup smart contract is located on Layer 2 and maintains the state of all transfers on Layer 2 that can only be updated with a validity proof. Because only the validity proof is required by ZK-rollups rather than the transaction data which results in faster and cheaper block validation. The validity proof has also already verified the funds on Layer 2 so there are no delays when transferring funds between Layer 2 and Layer 1. ZK-rollups can reduce the transaction size and lower gas usage by index mapping accounts with integers rather than using addresses. This reduces the transaction from 32 bytes to 4 bytes and is written to the Ethereum blockchain via “calldata”.
Initially, ZK-Rollups are assumed to be in a trusted state and a small group of developers are the experts on this initial trusted state. This means that control is somewhat centralized and these experts are susceptible to attacks.
Examples of ZK-Rollups are:
Table 2. ZK-Rollups Pros vs Cons.
Optimistic Rollups
Optimistic rollups are similar to ZK-rollups as they also bundle transactions and submit them to the Ethereum blockchain in a single transaction. Optimistic rollups assume that the transactions are valid and only run transaction computations in the event of suspected fraud or if the transaction is challenged via a Fraud Proof. The Fraud Proof will run the transaction’s computation using the state data from L1 if there is a challenge. Like ZK-rollups, Optimistic rollups reduce transaction data size via indexing and are written to the Ethereum blockchain as “calldata”. The transaction provider is also required to post a bond of ETH that will be seized or “slashed” if the transaction is proven to be a fraud. This ETH is used to reimburse the gas costs incurred for running the Fraud Proof.
Figure 4. Optimistic rollup overview.
Examples of Optimistic rollups are:
Table 3. Optimistic Rollups Pros vs Cons.
What are State Channels?
State channels allow participants to conduct numerous off-chain transactions while only submitting two on-chain transactions. A channel is first opened with a participant depositing ETH into a smart contract “locking up” the state (1). Any number of transactions can then be performed freely off-chain between participants without the need for validation like in rollups (2). To unlock and update the state, an on-chain transaction is submitted by all participants closing the channel (3). This ensures that the transfer happens immediately without any delays like with Optimistic rollups.
Figure 5. State channels overview
All parties must submit the state back to the blockchain (3) in order to close the state channel and unlock the state again. State channels have a “dispute window” where one party has an opportunity to refute the submitted state if one party tries to fraudulently close the channel. The guilty party will have their deposited funds (1) slashed in case of fraud.
If the state being updated between participants is a digital currency balance, then the channel is considered a payment channel. A key concept with state channels is that the last signed update to the state trumps all previous updates.
State channels are particularly useful when:
There are a lot of state updates
The participants are known
The participants are always available
Examples of payment channels:
Table 4. State Channels Pros vs Cons.
Stay tuned for… Part 3 - What about Validium and side chains?
Nice!