Layer 2 Solutions — Roll-ups

Okereke Israel
7 min readSep 30, 2022

--

Ethereum is one of the most popular blockchain networks in use presently, and there are no doubts regarding this fact. According to a new industry report published by DappRadar, the number of users engaging in decentralized applications, or DApps, surged 396% year-over-year to 2.4 million every day. In addition, the potential of Ethereum for boosting the DeFi space also indicates possibilities for a massive upsurge in the number of applications and users on the Ethereum network.

The continuously rising number of users on the Ethereum network has resulted in certain network limitations. This is where the best Ethereum layer 2 solutions come into the picture. What are layer solutions on Ethereum? Let us find the answers in the following discussion.

An Overview of LAYER 1 AND LAYER 2 SOLUTIONS

Some of the most contentious modern blockchain debates revolve around how to accommodate more transaction volume while remaining secure and decentralized (Scalability). Many believe that the best mechanisms to scale are by creating better, more efficient blockchains — known as Layer 1— while others believe that building off-chain options — known as Layer 2 — that settle to existing blockchains is the path forward.

What is Layer 1?

Layer 1 is what we traditionally think of as a “blockchain” — a network of computers that come to a consensus on some form of information in a decentralized and trustless manner. Some examples of Layer 1s are Bitcoin and Ethereum. All of these platforms have a native token (BTC and ETH respectively) that can be transferred between users. Layer 1s are traditionally public and permissionless, meaning that any computer can enter and exit the network as a node or miner at will.

But what happens when there’s more transaction volume than Layer 1 can handle? Traditional Layer 1s like Bitcoin and Ethereum have strict upper limits on how many transactions per second can be processed. When demand exceeds these limits, bidding wars begin to get transactions included on the blockchain, leading to the high transaction fees we all know and hate.

What is Layer 2?

Layer 2 is a collective term for solutions designed to help scale applications by handling transactions off the Ethereum Mainnet (layer 1) while taking advantage of the robust decentralized security model of Mainnet (layer 1). Transaction speed suffers when the network is busy, making the user experience poor for certain types of dapps. And as the network gets busier, gas prices increase as transaction senders aim to outbid each other. This can make using Ethereum very expensive.

Most layer 2 solutions are centred around a server or cluster of servers, each of which may be referred to as a node, validator, operator, sequencer, or block producer. Depending on the implementation, these layer 2 nodes may be run by the individuals, businesses or entities that use them, or, by a 3rd party operator. Generally speaking, transactions are submitted to these layer 2 nodes instead of being submitted directly to layer 1 (Mainnet).

For some solutions, layer 2 instances then batch them into groups before anchoring them to layer 1, after which they are secured by layer 1 and cannot be altered.

Why is layer 2 needed?

  • Increased transactions per second greatly improves user experience and reduces network congestion on Mainnet (L 1).
  • Transactions are rolled up into a single transaction to Mainnet, reducing gas fees for users and making Ethereum more inclusive and accessible for people everywhere.
  • Any updates to scalability should not be at the expense of decentralization or security — layer 2 builds on top of Ethereum.
  • There are application-specific layer 2 networks that bring their own set of efficiencies

In the context of Layer 1s and Layer 2s, Layer 1s are often referred to as the “settlement layer,” where transactions that occur on Layer 2 are eventually “settled,” or confirmed by Layer 1.

ROLL-UPS

Off-chain solutions are implemented separately from layer 1 Mainnet — they require no changes to the existing Ethereum protocol. Some solutions, known as “layer 2” solutions, derive their security directly from layer 1 Ethereum consensus, such as optimistic rollups, zero-knowledge rollups or state channels. Other solutions involve the creation of new chains in various forms that derive their security separately from Mainnet, such as sidechains, validiums, or plasma chains. These solutions communicate with Mainnet but derive their security differently to obtain a variety of goals.

Rollups perform transaction execution outside layer 1 and then the data is posted to layer 1 where consensus is reached. As transaction data is included in layer 1 blocks, this allows rollups to be secured by native Ethereum security.

There are two types of rollups with different security models:

  1. Optimistic rollups: assumes transactions are valid by default and only runs computation, via a fraud-proof, in the event of a challenge.

An optimistic rollup is an approach to scaling Ethereum that involves moving computation and state storage off-chain. Optimistic rollups execute transactions outside of Ethereum but post transaction data to Mainnet as calldata.

Optimistic rollup operators bundle multiple off-chain transactions together in large batches before submitting them to Ethereum. This approach enables the spreading of fixed costs across multiple transactions in each batch, reducing fees for end-users. Optimistic rollups also use compression techniques to reduce the amount of data posted on Ethereum.

Optimistic rollups are considered “optimistic” because they assume off-chain transactions are valid and don’t publish proofs of validity for transaction batches posted on-chain. This separates optimistic rollups from zero-knowledge rollups that publish cryptographic proofs of validity for off-chain transactions.

Pros and cons of optimistic rollups

PROS:

Offers massive improvements in scalability without sacrificing security or trustlessness.

Transaction data is stored on the layer 1 chain, improving transparency, security, censorship resistance, and decentralization.

Fraud proving guarantees trustless finality and allows honest minorities to secure the chain.

Computing fraud proofs is open to regular L2 nodes, unlike validity proofs (used in ZK-rollups) that require special hardware.

Rollups benefit from “trustless liveness” (anyone can force the chain to advance by executing transactions and posting assertions).

Optimistic rollups rely on well-designed crypto-economic incentives to increase security on the chain.

Compatibility with EVM and Solidity allows developers to port Ethereum-native smart contracts to rollups or use existing tooling to create new dapps.

Cons:

Delays in transaction finality due to potential fraud challenges.

Centralized rollup operators (sequencers) can influence transaction ordering.

If there are no honest nodes a malicious operator can steal funds by posting invalid blocks and state commitments.

The security model relies on at least one honest node executing roll-up transactions and submitting fraud proofs to challenge invalid state transitions.

Users must wait for the one-week challenge period to expire before withdrawing funds back to Ethereum.

Rollups must post all transaction data on-chain, which can increase costs.

2. Zero-knowledge rollups: runs computation off-chain and submits validity proof to the chain.

Zero-knowledge rollups (ZK-rollups) bundle (or ‘roll up’) transactions into batches that are executed off-chain. Off-chain computation reduces the amount of data that has to be posted to the blockchain. ZK-rollup operators submit a summary of the changes required to represent all the transactions in a batch rather than sending each transaction individually. They also produce validity proofs to prove the correctness of their changes. The validity proof demonstrates with cryptographic certainty that the proposed changes to Ethereum’s state are truly the end result of executing all the transactions in the batch.

The ZK-rollup’s state is maintained by a smart contract deployed on the Ethereum network. To update this state, ZK-rollup nodes must submit valid proof for verification. As mentioned, the validity proof is a cryptographic assurance that the state change proposed by the rollup is really the result of executing the given batch of transactions. This means that ZK-rollups only need to provide validity proofs to finalize transactions on Ethereum instead of posting all transaction data on-chain like optimistic rollups.

There are no delays when moving funds from a ZK-rollup to Ethereum because exit transactions are executed once the ZK-rollup contract verifies the validity proof. Conversely, withdrawing funds from optimistic rollups is subject to a delay to allow anyone to challenge the exit transaction with a fraud-proof.

ZK-rollups write transactions to Ethereum as calldata. Calldata is where data that is included in external calls to smart contract functions gets stored. Information in calldata is published on the blockchain, allowing anyone to reconstruct the rollup’s state independently.

Pros and cons of ZK-rollups

Pros:

Validity proofs ensure the correctness of off-chain transactions and prevent operators from executing invalid state transitions.

Offers faster transaction finality as state updates are approved once validity proofs are verified on L1.

Relies on trustless cryptographic mechanisms for security, not the honesty of incentivized actors as with optimistic rollups.

Stores data needed to recover the off-chain state on L1, which guarantees security, censorship resistance, and decentralization.

Users benefit from greater capital efficiency and can withdraw funds from L2 without delays.

Doesn’t depend on liveness assumptions and users don’t have to validate the chain to protect their funds.

Better data compression can help reduce the costs of publishing calldata on Ethereum and minimize rollup fees for users.

Cons:

The cost associated with computing and verifying validity proofs is substantial and can increase fees for rollup users.

Building EVM-compatible ZK-rollups is difficult due to the complexity of zero-knowledge technology.

Producing validity proofs requires specialized hardware, which may encourage centralized control of the chain by a few parties.

Centralized operators (sequencers) can influence the ordering of transactions.

Hardware requirements may reduce the number of participants that can force the chain to make progress, increasing the risk of malicious operators freezing the rollup’s state and censoring users.

Some proving systems (e.g., ZK-SNARK) require a trusted setup which, if mishandled, could potentially compromise a ZK-rollup’s security model.

--

--