引言
随着加密货币的应用不断普及,区块链网络的扩容问题也愈发亟待解决。网络拥堵不仅会拖慢交易速度,还会推高交易费用。为应对这些挑战,我们可以从两类方案入手:Layer 1 和 Layer 2。
- Layer 1 方案会直接改造区块链的底层架构,分片就是其中一种代表性做法。它将区块链拆分成多个独立分片,从而提升系统整体容量,并支持并行处理交易。
- 相比之下,Layer 2 方案构建在区块链底层基础设施之上。交易先在链下处理,再批量汇总到主链。状态通道、侧链和 Rollup 都是常见技术;在各类 Rollup 中,利用零知识证明的 ZK Rollup 尤为值得关注。
ZK Rollup 是什么?
要理解 ZK Rollup,首先得弄清楚 Rollup 和零知识证明这两个概念。

什么是 Rollup?
简单来说,Rollup 能把多笔交易数据汇总起来,并在链下处理。处理完成后,再将最终结果提交到底层区块链。一次处理大量交易,可以降低区块链日益臃肿的风险,让计算更快、成本更低。Rollup 主要分为两类:Optimistic Rollup 和 ZK Rollup。
- Optimistic Rollup 默认其处理的交易都是有效的。不过,在交易正式写入区块链之前,会有一段等待期,网络参与者可以在此期间提出异议,质疑可疑交易。Optimism、Arbitrum 和 opBNB 都是这类方案的代表。
- 顾名思义,ZK Rollup 会利用基于零知识证明的有效性证明,逐笔验证交易。实现起来虽然更复杂,但它无需像 Optimistic Rollup 那样设置争议处理期,因此有望更快地处理交易。
接下来,我们来看看零知识证明。
什么是零知识证明?
零知识证明(ZKP)是一种密码学工具,能让一方(证明者)在不透露陈述具体细节的情况下,向另一方(验证者)有力地证明该陈述为真。
要让零知识证明可靠,必须具备三个关键性质:
- 完备性:如果陈述确实为真,且双方都诚实行事,证明就一定能确认其真实性。
- 可靠性:除极少数特殊情况外,不诚实的证明者几乎不可能让诚实的验证者相信一个虚假陈述。
- 零知识性:这是零知识证明最鲜明的特点。证明结束后,验证者只会知道陈述是否成立,而无法得知陈述的实际内容。
零知识证明的运作机制可以分为三个基本步骤:
- 见证:第一步,证明者向验证者提供一项隐秘信息,称为“见证”。证明者要让验证者相信自己掌握特定数据,却不直接透露数据本身。见证会围绕这些信息生成一组问题,只有真正掌握相关信息的证明者才能回答。
- 挑战:在这一阶段,验证者会从预先设定的问题中随机选取问题,向证明者发起挑战。
- 响应:最后,证明者回答验证者的问题,以证明自己确实可信。
了解了 Rollup 和零知识证明之后,现在可以把这两个概念结合起来,进一步看看 ZK Rollup 是如何运作的。
ZK Rollup 如何运作?
ZK Rollup 的运行离不开两个核心组成部分:
- On-chain contracts: Within the zk-rollup protocol, on-chain contracts play a pivotal role by defining the operational rules. This segment comprises two key contracts, namely the main contract and the verifier contract. The main contract functions as a repository for rollup blocks oversees deposit tracking, and facilitates critical updates. In contrast, the verifier contract is responsible for the validation of the Zero-Knowledge Proofs (ZKPs) generated.
- Off-chain virtual machines: Another crucial element in the zk-rollup ecosystem is the off-chain virtual machines, which carry out transaction execution beyond the primary Ethereum blockchain on Layer 2 (L2). These virtual machines operate autonomously, separate from the Ethereum chain.

ZK Rollup 与以太坊区块链紧密协作,但运行在独立的层上。它不会用海量交易细节淹没以太坊,而是提交汇总后的信息,让底层网络保持简洁、高效。
使用 ZK Rollup 的优缺点
先来看看使用 ZK Rollup 有哪些好处。下面逐一了解它的优势。
ZK Rollup 的优点
- Enhanced throughput: Zk-rollups excel in boosting transaction throughput by transferring transaction executions from the base layer to a more efficient computational environment. This approach prevents individual on-chain processing of transactions, resulting in a significant overall throughput increase.
- Alleviating congestion: Zk-rollups play a pivotal role in optimizing Layer 1 operations by reducing blockchain bloat. Moreover, they streamline the storage requirements for full nodes, as they only need to maintain zero-knowledge proofs rather than the entire dataset.
- Fee reduction: The decrease in network congestion achieved through zk-rollups translates into lower transaction fees for users, making it a cost-effective choice.
- Robust security measures: Zk-rollups integrate advanced security measures that empower users to withdraw their funds even in the event of issues within the rollup network. This unique feature sets them apart from sidechains, which may jeopardize funds during network failures.
- Expedited transaction challenge period: With zk-rollups, the verification process only involves validating the authenticity of proofs within the rollup, thereby significantly accelerating the transaction challenge period.
当然,ZK Rollup 也有自己的短板,例如:
ZK Rollup 的缺点
- Inherent complexity: The foremost disadvantage of zk-rollups is their inherent intricacy. They are considerably more intricate to implement compared to optimistic rollups.
- Constrained by the base layer: Despite their efficiency, zk-rollups still face limitations imposed by the underlying base layer of the blockchain ecosystem.
- Liquidity fragmentation: Implementing any Layer 2 solution, including zk-rollups, can lead to the dispersion of liquidity within the ecosystem. This fragmentation of liquidity in base-layer protocols may potentially lead to issues in the long run.
ZK Rollup 与 Optimistic Rollup 对比
下面来具体比较一下 Optimistic Rollup 和 ZK Rollup。
| ZK Rollup | Optimistic Rollup | |
|---|---|---|
| 挑战机制 | 没有挑战期 | 设有挑战期,网络参与者可在此期间质疑欺诈交易。 |
| 对交易的假设 | 所有交易都通过零知识证明验证 | 默认交易有效 |
| 复杂程度 | 使用零知识证明,技术实现较复杂 | 实现起来相对简单 |
| 证明机制 | 有效性证明 | 欺诈证明 |
| 采用情况 | 普及程度相对较低 | 由于实现较简单,应用较为广泛 |
| 示例 | zkSync 和 Starknet | Optimism、Arbitrum 和 opBNB |
结语
扩容常被视为区块链技术的终极目标,也是系统发挥最佳性能的关键。无论是 Optimistic Rollup 还是 ZK Rollup,都为这个由来已久的难题提供了精巧的解决方案。ZK Rollup 以独特的方式,有望提升交易速度、缓解网络拥堵并增强安全性。它确实也有复杂之处,但潜力不容小觑。对于关注数字货币未来的人来说,全面了解 ZK Rollup 至关重要。要让区块链跑得更好,我们就得认识 ZK Rollup,了解它如何为未来带来新的可能。










