Scroll架构概览 (An overview of Scroll's architecture)


Scroll is an EVM-equivalent zkRollup to scale Ethereum. Technically speaking, Scroll is built upon two major pieces. The core piece is the zkEVM, which is used to prove the correctness of EVM execution in Layer 2. We have been building it in the open with the Privacy and Scaling Explorations group at the Ethereum Foundation for over a year. But to turn the zkEVM into a full zkRollup on the Ethereum, we also need to build a complete L2 architecture around it.

Scroll是一个用于扩荣Ethereum的,EVM等价的zkRollup。从技术上讲,Scroll是建立在两个主要部分上。核心部分是zkEVM,它用于证明第2层中EVM执行的正确性。我们与以太坊基金会的隐私和扩展探索小组一起,在公开场合构建它已经超过一年。但要把zkEVM变成以太坊上完整的zkRollup,我们还需要围绕它建立一个完整的L2架构。

In this post, we give an overview of Scroll’s overall architecture. More specifically, we will cover the initial version of Scroll which is composed of a centralized sequencing node and decentralized proving network. We are committed to decentralizing the set of sequencing nodes in the future and will share our design for this in future articles.

在这篇文章中,我们对Scroll的整体架构做了一个概述。更具体地说,我们将介绍Scroll的初始版本,它由一个集中的序列节点和去中心化的证明网络组成。我们致力于在未来将序列节点集去中心化,并会在未来的文章中分享我们的设计。

Scroll的架构 (Scroll's architecture)

The current architecture consists of three infrastructure components (see Figure 1):

目前的架构由三个基础组件组成(见图1)。

  • Scroll Node: Constructs L2 blocks from user transactions, commits them to the Ethereum base layer, and passes messages between L1 and L2.
    Scroll节点: 从用户交易中构建L2区块,将其提交给以太坊基础层,并在L1和L2之间传递消息。

  • Roller Network: Generates the zkEVM validity proofs to prove that transactions are executed correctly.
    滚动器网络: 生成zkEVM有效性证明,来证明交易被正确执行。

  • Rollup and Bridge Contracts: Provides data availability for Scroll transactions, verifies zkEVM validity proofs, and allows users to move assets between Ethereum and Scroll.
    汇总和跨链合约: 为Scroll交易提供数据可用性,验证zkEVM有效性证明,并允许用户在Ethereum和Scroll之间移动资产。

In what follows, we detail the role of each of these components.

在下文中,我们将详细介绍这些组件中每一个的作用。

Figure 1. Scroll architecture

图1. Scroll结构图 (Figure 1. Scroll architecture)

Scroll节点 (Scroll Node)

The Scroll node is the main way for applications and users to interact with Scroll. It consists of three modules, the SequencerCoordinator, and Relayer.

Scroll节点是应用及其用户与Scroll互动的主要方式。它由三个模块组成:序列器协调器中继器

The Sequencer provides a JSON-RPC interface and accepts L2 transactions. Every few seconds, it retrieves a batch of transactions from the L2 mempool and executes them to generate a new L2 block and a new state root. Our sequencer implementation is based on the Go-Ethereum (Geth), one of the most popular Ethereum node implementation. By forking Geth, we can achieve the best compatibility and inherit security that has stood the test of time.

序列器提供一个JSON-RPC接口,接受L2交易。每隔几秒钟,它从L2内存池中检索一批交易,并执行这些交易,生成一个新的L2块和一个新的状态根。我们的序列器实现基于Go-Ethereum(Geth),这是最流行的Ethereum节点实现之一。通过分叉Geth,我们可以实现最佳的兼容性,并继承经得起时间检验的安全性。

Once a new block is generated, the Coordinator is notified and receives the execution trace of this block from the Sequencer. It then dispatches the execution trace to a randomly-selected Roller from the roller pool for proof generation.

一旦产生一个新的区块,协调者就会收到通知,并从序列器中接收这个区块的执行轨迹。然后,它将执行轨迹分配给从滚动器池中随机选择的滚动器生成证明。

The Relayer watches the bridge and rollup contracts deployed on both Ethereum and Scroll. It has two main responsibilities. First, it monitors the rollup contract to keep track of the status of L2 blocks including their data availability and validity proof. Second, it watches the deposit and withdraw events from the bridge contracts deployed on both Ethereum and Scroll and relays the messages from one side to the other.

中继器观察部署在Ethereum和Scroll上的跨链桥和汇总合约。它有两个主要职责。首先,它监视滚动合约,进而跟踪L2区块的状态,包括其数据可用性和有效性证明。其次,它观察部署在Ethereum和Scroll上的跨链桥合约的存款和提款事件,并在两者间通传消息。

滚动器网络 (Roller Network)

The Rollers serve as provers in the network that are responsible for generating validity proofs for the zkRollup. Rollers are expected to utilize accelerators such as GPUs, FPGAs, and ASICs to reduce the proving time and proving cost. Figure 2 shows how a Roller generates the validity proof for each block. The process consists of the following steps:

滚动器作为网络中的证明者,负责为zkRollup生成有效性证明。滚动器有望利用加速器,如GPU、FPGA和ASIC,来减少证明时间和证明成本。图2显示了一个滚动器是如何为每个区块生成有效性证明的。该过程由以下步骤组成。

  • A Roller first converts the execution trace received from the Coordinator to circuit witnesses.
    一个Roller首先将从**协调器收到的执行轨迹转换为回路见证。

  • It generates proofs for each of the zkEVM circuits.
    它为每个zkEVM的回路生成证明。

  • Finally, it uses proof aggregation to combine proofs from multiple zkEVM circuits into a single block proof.
    最后,它使用证明聚合,将多个zkEVM回路的证明合并为一个单一的区块证明。

Figure 2. Roller workflow

图2.滚动器工作流程 (Figure 2. Roller workflow)

汇总和跨链合约 (Rollup and Bridge Contracts)

Scroll connects to the base layer of Ethereum through the Rollup and Bridge smart contracts. Together, these ensure data availability for L2 transactions and allow users to pass assets and messages between L1 and L2.

Scroll通过汇总(Rollup)跨链(Bridge) 智能合约连接到Ethereum的基础层。这些共同确保了L2交易的数据可用性,并允许用户在L1和L2之间传递资产和消息。

The Rollup contract receives L2 state roots and blocks from the Sequencer. It stores state roots in the Ethereum state and L2 block data as Ethereum calldata. This provides data availability for Scroll blocks and leverages the security of Ethereum to ensure that indexers including the Scroll Relayer can reconstruct L2 blocks. Once a block proof establishing the validity of an L2 block has been verified by the Rollup contract, the corresponding block is considered finalized on Scroll.

汇总合约从序列器接收L2状态根和区块。它将状态根存储在以太坊状态中,并将L2区块数据作为以太坊的调入数据(calldata)。这为Scroll区块提供了**数据可用性,并利用Ethereum的安全性来确保包括Scroll中继器在内的索引器能够重建L2区块。一旦建立L2区块有效性的区块证明被Rollup合约验证,相应的区块就被认为是在Scroll上最终完成的。

The Bridge contracts deployed on the Ethereum and Scroll allow users to pass arbitrary messages between L1 and L2. On top of this message passing protocol, we have also built a trustless bridging protocol to allow users to bridge ERC-20 assets in both directions. To send a message or funds from Ethereum to Scroll, users call a sendMessage transaction on the Bridge contract. The Relayer will index this transaction on L1 and send it to the Sequencer for inclusion in an L2 block. Sending messages from Scroll back to Ethereum uses a similar process on the L2 Bridge contract.

部署在以太坊和Scroll上的跨链合约,允许用户在L1和L2之间传递任意消息。在这个消息传递协议的基础上,我们还建立了一个去信任化的跨链协议,允许用户在两个方向上跨链ERC-20资产。为了从以太坊向Scroll发送消息或资金,用户在跨链合约上调用一个sendMessage交易。中继器将在L1上对该交易索引化,并将其发送至序列器,进而纳入L2区块中。从Scroll向Ethereum发送消息,在L2跨链合约上使用类似的过程。

Scroll的zkRollup如何工作?(How does Scroll's zkRollup work?)

Putting these three architectural pieces together, we can now explain the workflow of Scroll's zkRollup, summarized in Figure 3 below.

把这三块架构放在一起,我们现在可以解释一下Scroll的zkRollup的工作流程,总结起来就是图3。

Figure 3. Scroll workflow

图3. Scroll工作流程 (Figure 3. Scroll workflow)

L2 blocks in Scroll are generated, committed to base layer Ethereum, and finalized in the following sequence of steps:

Scroll中的L2区块被生成,提交给基础层Ethereum,并按以下顺序最终完成。

  1. The Sequencer generates a sequence of blocks. For the i-th block, the Sequencer generates an execution trace T and sends it to the Coordinator. Meanwhile, it also submits the transaction data D as calldata to the Rollup contract on Ethereum for data availability and the resulting state roots and commitments to the transaction data to the Rollup contract as state.
    序列器生成一连串的区块。对于第i个区块,序列器生成一个执行跟踪 T,并将其发送给协调器。同时,它还将交易数据 D 作为调入数据(calldata)提交给Ethereum上的汇总合约,获得数据可用性,并将产生的状态根和对交易数据的承诺作为状态提交给汇总合约。

  2. The Coordinator randomly selects a Roller to generate a validity proof for each block trace. To speed up the proof generation process, proofs for different blocks can be generated in parallel on different Rollers.
    协调器随机选择一个滚动器,来为每个区块追踪生成一个有效性证明。为了加快证明生成过程,不同区块的证明可以在不同的滚动器上并行生成。

  3. After generating the block proof P for the i-th block, the Roller sends it back to the Coordinator. Every k blocks, the Coordinator dispatches an aggregation task to another Roller to aggregate k block proofs into a single aggregate proof A.
    在为第 i 个区块生成区块证明 P 后,滚动器将其送回给协调器。每隔 k 个区块,协调人就会向另一个滚动器派发一个聚合任务,将 k 个区块证明聚合成一个聚合证明 A

  4. Finally, the Coordinator submits the aggregate proof A to the Rollup contract to finalize L2 blocks i+1 to i+k by verifying the aggregate proof against the state roots and transaction data commitments previously submitted to the rollup contract.
    最后,协调人将聚合证明 A 提交给汇总合约,通过验证聚合证明与之前提交给汇总合约的状态根和交易数据承诺,最终确定 i+1i+k 的L2块。

Figure 3 illustrates that Scroll blocks will be finalized on L1 in a multi-step process. Each L2 block will progress through the following three stages until it is finalized.

图3说明了Scroll区块将在多步骤过程中于L1上最终完成。每个L2区块将经过以下三个阶段,直到最终完成。

  • Precommitted indicates a block has been proposed by a Sequencer and sent to Rollers. Although Precommitted blocks are not yet a canonical part of the Scroll L2 chain because they have not been posted on the Ethereum base layer, users who trust the Sequencer can choose to take action on them in anticipation.
    Precommitted表示一个区块已经由序列器提出并发送给滚动器。虽然Precommitted区块还不是Scroll L2链的典型部分,因为它们还没有在Ethereum基础层上发布,但信任序列器的用户可以选择在预期中对它们采取行动。

  • Committed indicates the transaction data of this block has been posted on the rollup contract on Ethereum. This ensures that the block data is available, but does not prove that it has been executed in a valid way.
    Committed表示这个区块的交易数据已经发布在以太坊的汇总合约上。这确保了区块数据的可用性,但并不证明它已经被有效的方式执行。

  • Finalized indicates the correct execution of transactoins in this block has been proven by verifying a validity proof on-chain on Ethereum. Finalized blocks are considered canonical parts of the Scroll L2 chain.
    Finalized表示该区块交易数据的正确执行,已经通过在以太坊链上验证有效性证明得到证实。终态化的区块被认为是Scroll L2链的典范部分。

Putting all of these together, Scroll is able to execute native EVM bytecode on L2 while inheriting strong security guarantees from base layer Ethereum. In the next post in this series, we will explain the workflow for developers to deploy dapps on Scroll and how users can interact with them.

把所有这些放在一起,Scroll能够在L2上执行原生的EVM字节码,同时从基础层Ethereum继承强大的安全保证。在本系列的下一篇文章中,我们将解释开发者在Scroll上部署dapp的工作流程,以及用户如何与他们互动。

更多内容 (Learn more)

We have designed Scroll's architecture to align with our vision and values and our technical principles. In upcoming articles, we explain how Scroll will use this architecture to provide a more scalable user and developer experience on Ethereum. Stay tuned to learn more, and sign up to try out our pre-alpha testnet at signup.scroll.io!

我们设计的Scroll架构与我们的愿景和价值观技术原则相一致。在接下来的文章中,我们将解释Scroll将如何使用这个架构,在以太坊上提供一个更可扩展的用户和开发者体验。请继续关注,以了解更多信息,并在signup.roll.io上注册试用我们的alpha前测试网!

If our vision of scaling Ethereum in an open and community-driven way resonates with you, we are looking for values-aligned individuals to help Scroll become the most developer- and user-friendly scaling solution for Ethereum.

如果我们以开放和社区驱动的方式来扩展以太坊的愿景,与你产生了共鸣,那我们正在寻找价值观一致的人,帮助Scroll成为最适合开发者和用户的以太坊扩展解决方案。

  • If you are a ZK researcher, ZKP, Go or Solidity developer, or a GPU engineer, we are working on many interesting technical challenges at the edge of what’s possible. Come build cutting-edge solutions to these problems with us in the open!
    如果你是ZK研究员、ZKP、Go或Solidity开发人员,或者是GPU工程师,我们正在研究许多有趣的技术挑战,处于可能的前缘。请来和我们一起在开放的环境中建立解决这些问题的最前沿解决方案吧

  • If you love nurturing and growing ecosystems or communities, we are looking for developer advocates and community organizers to make sure we are building in a community-aligned and user-friendly way.
    如果你喜欢培育和发展生态系统或社区,我们正在寻找开发者倡导者和社区组织者,来确保我们以一种与社区融洽和用户友好的方式进行建设。

To learn more about these roles and about Scroll, check out our websiteTwitterDiscord, or jobs page. If you want to get straight to the code and build with us, you can find our repos at github.com/scroll-tech and github.com/privacy-scaling-explorations/zkevm-circuits.

要了解更多关于这些角色和Scroll的信息,请查看我们的网站TwitterDiscord,或工作机会页面。如果你想直接接触代码并与我们一起构建,你可以在github.com/scroll-techgithub.com/privacy-scaling-explorations/zkevm-circuits找到我们的资料库。

赞赏