0Pricing
Web3 & DApp Development Fundamentals · 课时

Rollups

Optimistic 与 ZK

Rollups 是 CoddyKit 上的免费 Web3 & DApp Development Fundamentals 课时。 这是第 2 节课,共 4 节。 你可以在下方免费阅读本课时的完整内容 — 然后在浏览器中使用内置代码编辑器和全天候 AI 导师进行实践。 这是 Web3 & DApp Development Fundamentals 学习路径的一部分,你的进度在网页和 CoddyKit 应用中同步。 Web3 & DApp Development Fundamentals 课程共包含 4 节课。

本课时的部分内容尚未翻译,以英文显示。

What Is a Rollup?

A rollup executes transactions on a Layer 2 and posts the transaction data (and a state commitment) back to Layer 1.

The L1 stores enough information to reconstruct and verify the L2 state, which is what gives rollups their security.

Two Main Types

There are two dominant rollup families:

  • Optimistic Rollups — assume transactions are valid, allow challenges
  • ZK Rollups — prove validity with cryptographic proofs

They differ in how they convince L1 the L2 state is correct.

Optimistic Rollups

Optimistic rollups assume every batch is valid by default — hence optimistic.

They post the new state to L1 without proving it immediately, relying on the threat of fraud proofs to keep operators honest.

Fraud Proofs and the Challenge Window

After a batch is posted, a challenge window (often ~7 days) opens. Anyone can submit a fraud proof showing the batch was invalid.

If a valid challenge succeeds, the bad batch is reverted and the dishonest operator is penalized.

post batch -> 7-day challenge window
  no valid challenge -> finalized
  valid fraud proof  -> batch reverted

Withdrawal Delays

The challenge window means withdrawing from an optimistic rollup back to L1 takes time (often a week).

Liquidity providers offer instant withdrawals for a fee by fronting the funds during the wait.

ZK Rollups

ZK rollups generate a cryptographic validity proof (a zero-knowledge proof) for each batch.

L1 verifies the proof mathematically, so there is no need to trust the operator or wait for a challenge period.

Validity Proofs

A validity proof (such as a SNARK or STARK) demonstrates that the new state was computed correctly from the old state and the transactions.

If the proof verifies, the state is definitively correct — no challenges needed.

proof = prove(oldState, txs, newState)
L1.verify(proof) == true
-> newState accepted instantly

Faster Finality on ZK

Because ZK proofs are verified immediately, ZK rollups offer fast finality and quick withdrawals.

The trade-off is that generating proofs is computationally expensive and historically harder for general smart contracts.

Optimistic vs ZK Trade-offs

Comparing the two:

  • Optimistic: EVM-compatible, cheaper proving, slow withdrawals
  • ZK: instant finality, fast withdrawals, complex proving

Both post data to L1, so both inherit Ethereum security.

Data Availability

Rollups must publish transaction data so anyone can reconstruct the state — this is data availability.

Posting data to L1 (calldata or blobs) is a major cost; innovations like EIP-4844 blobs made it much cheaper.

Putting It Together

Rollups execute off-chain and settle on L1. Optimistic rollups assume validity and use fraud proofs; ZK rollups prove validity cryptographically. Data availability anchors their security.

Next we look at moving assets between layers with bridges.

Quick Check

Test your rollup knowledge.

Recap: Rollups

You learned that:

  • Rollups execute off-chain and settle data on L1
  • Optimistic rollups use fraud proofs + a challenge window
  • ZK rollups use validity proofs for instant finality
  • Data availability on L1 anchors security

Next: bridging assets between layers.

常见问题解答

「Rollups」课时是免费的吗?

是的 — 「Rollups」的完整文本可在网页上免费阅读。要进行交互式练习(内置代码编辑器和全天候 AI 导师)并解锁 Web3 & DApp Development Fundamentals 课程的其余内容,请升级到 CoddyKit PRO。 Web3 & DApp Development Fundamentals 课程共包含 4 节课。

「Rollups」这节课中我会学到什么?

Optimistic 与 ZK 你通过在浏览器中直接运行的动手代码来练习 Web3 & DApp Development Fundamentals,全天候 AI 导师会在你学习这节课的过程中回答你的问题。

学习 Web3 & DApp Development Fundamentals 需要有经验吗?

无需任何先前经验。CoddyKit 上的 Web3 & DApp Development Fundamentals 课程适合初学者到高级学习者,你可以从这里开始或从头开始,按照自己的节奏学习。 这是第 2 节课,共 4 节。

「Rollups」课时需要多长时间?

大多数 CoddyKit 课程大约需要 5–10 分钟。每节课都很精短且互动,所以你能稳步进步,并在网页和应用中从离开的地方继续。

我能在这节 Web3 & DApp Development Fundamentals 课中编写并运行代码吗?

能。每节 Web3 & DApp Development Fundamentals 课都包含内置代码编辑器,你可以在浏览器中直接编写并运行真实代码,并获得即时 AI 反馈 — 无需本地设置。

此课程中的所有课时

  1. 为什么需要 Layer 2
  2. Rollups
  3. 跨层转移资产
  4. 选择 Layer 2
← 返回 Web3 & DApp Development Fundamentals