What are Rollups?
Rollups offload computation (and state storage) from the blockchain while keeping some data for each transaction on the blockchain. They employ various advanced compression techniques to increase efficiency and, wherever possible, substitute data with computation. The result is a system whose scalability is still constrained by the underlying blockchain’s data bandwidth but is better than the current system. Where an Ethereum base-layer ERC20 token transfer costs 45000 gas, an ERC20 token transfer in a rollup takes up 16 bytes of on-chain space and costs under 300 gas. The fact that data is stored on the blockchain is crucial because putting information “on IPFS” does not work because IPFS does not provide consensus on whether or not any given piece of data is available; the data must go on a blockchain. Anyone can locally conduct all of the operations in the rollup if they desire, allowing them to identify fraud, commence withdrawals, or personally start manufacturing transaction batches after putting data on-chain and gaining consensus on that fact. There are no data availability issues, so a malicious or offline operator can do significantly less harm (for example, they couldn’t cause a one-week delay), allowing for a considerably bigger design space for those who have the permission to publish batches and make rollups much easier to reason about. The lack of data availability issues means that there is no longer any need to map assets to owners, which leads to the key reason why the Ethereum community is so enthusiastic about rollups over previous forms of layer 2 scaling. Rollups are fully general-purpose, and one can even run an EVM inside a rollup, allowing existing Ethereum applications to migrate to rollups with little to no new code.
Optimistic rollups run parallel to the main Ethereum chain. They can increase scalability because they don’t execute any calculation by default. Instead, they suggest a new state to Mainnet or “notarise” the transaction. Transactions are written to the Ethereum blockchain as calldata, further optimizing them by lowering the gas cost. Because processing is the sluggish, expensive component of utilizing Ethereum, optimistic rollups can boost scalability by up to 10-100x, depending on the transaction. With the advent of shard chains, this figure will rise even further, as more data will be available if a transaction is challenged. The two most widely used optimistic rollups are Optimism and Arbitrum.
ZK-rollups (zero-knowledge rollups) combine hundreds of off-chain transfers to provide cryptographic proof. These proofs can be in the form of SNARKs (succinct non-interactive argument of knowledge) or STARKs (scalable transparent argument of knowledge). Validity proofs, such as SNARKs and STARKs, are posted to layer 1 for settlement. The ZK-rollup smart contract maintains the status of all transfers on layer 2, and this state can only be altered with validity proof. This means that instead of complete transaction data, ZK-rollups require validity evidence. Validating a block using a ZK-rollup is faster and less expensive because less data is provided. When moving your assets from layer 2 to layer 1 blockchain, there are no delays with a ZK-rollup because the funds have already been validated by a validity proof acknowledged by the ZK-rollup contract. ZK-rollups can be optimized to minimize transaction size further because they are on layer 2. An account is represented by an index rather than an address, reducing a transaction from 32 to 4 bytes. Transactions are also written as calldata to Ethereum, which saves gas. Currently, ZK sync and Starkware are the leading ZK rollups.