What is the difference between optimistic rollups and ZK-rollups?

Answer

Both rollup types batch L2 transactions and post compressed data to Ethereum L1 for data availability, but differ in how they prove transaction validity: Optimistic Rollups: (1) Assume all transactions are valid by default ("optimistic"); (2) Post transactions to L1 without validity proofs; (3) Anyone can submit a fraud proof during a challenge window (7 days) to prove a transaction was invalid; (4) Withdrawals take 7 days (challenge period) unless using fast exit liquidity providers; (5) EVM-equivalent (simpler to support arbitrary smart contracts); (6) Examples: Arbitrum One, Optimism, Base. ZK-Rollups (Validity Rollups): (1) Generate cryptographic zero-knowledge proofs (ZK-SNARKs/STARKs) proving all transactions in the batch are valid; (2) L1 verifies the proof mathematically — invalid transactions cannot be included; (3) Withdrawals are fast (~minutes) — no challenge period needed; (4) Higher computational cost for proof generation (specialized hardware); (5) EVM compatibility harder to achieve (zkEVM development is complex); (6) Examples: zkSync Era, Polygon zkEVM, Starknet, Scroll. Long-term, ZK-rollups are likely superior in security and UX but remain more complex to build.