# Rollups - Main idea - Store only the transaction data to layer1 and put all execution and storage off-chain - Method - Deploy smart contracts on layer1 - Types - Optimistic rollups - Fraud proof - Idea - Assume the posted data is valid (optimistic) - If not valid, others can submit fraud proof - There is a dispute resolution system to disincentivize bad actors - Only when there is a dispute, the tx will be executed on layer1 to check its validity - The one (Alice) who submits tx to layer1 needs to provide a bond (ETH) - The one (Bob) who submits fraud proof also needs to provide a bond (ETH) - If the fraud does exists, Alice’s bond will be slashed. Otherwise, Bob’s bond will be slashed - Dispute resolution rarely happens because of the incentive mechanism - Projects - Optimism - Uniswap, synthetix - Arbitrum - Uniswap, sushi, augur, aave, chainlink - Difference - Optimism - Run whole tx on layer1 to check validity - Handling tx ordering (MEV) - The ordering of tx can be auctioned off - Arbitrum - Use an interactive multi-round model, narrow down the scope of dispute, and potentially execute a smaller portion of tx on layer1 to check validity - Smart contracts can be larger than the max contract size on layer1 - Handling tx ordering (MEV) - Running a centralized sequencer to order tx (plan to decentralize in the future) - ZK rollups - Validity proof - Idea - Use zero knowledge proof - When submitting a tx batch, a zk-snark proof, which can be quickly verified by the layer1 smart contracts, is posted. - Invalid zk-snark proof can be rejected straight away - Projects - Loopring, Hermez, Aztec (privacy focused), StarkWare (used by dyed) - Differences - Optimistic rollups - Have to give enough time for ppl to submit fraud proofs before finalizing a tx - Withdrawal from layer2 to layer1 is slow (7 days) - Fast withdrawal that charges a small fee: Hop protocol, Connext - 99% of the EVM smart contracts can be ported without making changes - Zk rollups - Fast withdrawal since the validity proof is submitted with the tx batch (already proven valid) - Difficult to make it EVM compatible - Zksync is working on this - More computational heavy - Nodes that compute zk proof have to be high spec machines - hard to run for normal ppl - Similarity - Can scale ethereum from 15 TPS to 1000-4000 TPS - Can even be higher if allocated more space on layer1 - If integrated with ETH 2.0 (save more data with sharding), can scale to 100k TPS - Challenges - Different rollup solutions are not compatible - Fractional liquidity - Split across layer1 and different layer2 solutions - Notes - If centralized exchanges enable easy withdrawal and deposit between rollup chains, the adoption can raise quickly - Will rollup threaten side chains? - No, side chains have lower fee than rollups <iframe width="560" height="315" src="https://www.youtube.com/embed/7pWxCklcNsU" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>