Interpret the architecture design of Scroll
Original text: “ Technology and Architecture Design of Scroll “
Author: Elen
Scroll has performed very well in the primary market recently, so today we are going to delve into the technology and architectural design of Scroll.
croll is an EVM-equivalent zkRollup Ethereum scaling solution, with zkEVM as its core module, which is used to prove the correctness of EVM execution on Layer2. It has been under development for one year and has had extensive collaboration with the privacy team of the Ethereum Foundation.
To turn zkEVM into a complete zkRollup, Scroll has built a comprehensive Layer2 architecture around zkEVM.
The current architecture includes centralized ordering nodes and decentralized proof networks, but in the future Scroll will also decentralize ordering nodes, making the entire network more robust.
Architecture of Scroll
The current Scroll architecture consists of three main components:
- Scroll nodes: blocks that build L2 from user transactions, commit to the Ethereum mainnet, and pass information between L1 and L2.
- Roller Network: Generates proof of zkEVM, ensuring transactions are executed correctly.
- Rollup and Bridge Contracts: Provides data availability for Scroll transactions, verifies zkEVM proofs, and allows users to transfer assets between the Ethereum network and Scrolls.
The roles of these components can be derived from the following figure:
Scroll node
Scroll nodes are the main way for applications and users to interact with the Scroll network. Scroll nodes contain three modules.
Sequencer (sequencer)
Sequencer provides a JSON-RPC interface to obtain transfer information on Layer2. Every few seconds, Sequencer will obtain a series of transfer records from the L2 memory pool, execute these transfers, and generate a new L2 block and a new state root.
Sequencer on Scroll was developed based on the time-proven Geth (Go-ethereum) to guarantee compatibility and security .
Coordinator (Coordinator)
After the new L2 block is generated, the Coordinator will obtain the transaction execution record from the Sequencer. The Coordinator then dispatches the execution record to a randomly selected roller from the roller pool to generate the proof.
Relayer (Repeater)
Relayer monitors rollup and bridge contracts deployed on Ethereum and Scroll, which serves two main purposes.
The first is to monitor Rollup contracts to track the status of L2 blocks , including data availability and proof of validity.
Secondly, Relayer monitors deposit and withdrawal events of bridge contracts deployed on Ethereum and Scroll, and relays messages between the two chains .
Roller network
Rollers act as provers in the network and are responsible for generating proof of validity for zkRollup. Rollers are expected to utilize accelerators such as GPUs, FPGAs, and ASICs to reduce verification time and verification costs. The following diagram shows how Roller generates proof of validity for each block:
- The Roller first converts the execution sequence received from the Coordinator into circuit witnesses.
- Second, Roller generates a proof for each zkEVM circuit.
- Finally, Roller uses proof aggregation to combine proofs from multiple zkEVM circuits into a block proof.
Rollup and bridge contract
Scroll connects the Ethereum mainnet and Scoll network through Rollup and Bridge contracts , ensuring data availability for L2 transactions and allowing users to transfer assets between L1 and L2.
The Rollup contract takes the state root of L2 from the Sequencer as calldata. This provides data availability for Scroll blocks and utilizes the security of Ethereum to ensure that indexes including Scroll Relayers can rebuild L2 blocks. Once the block proof establishing the validity of the L2 block has been verified by the Rollup contract, the corresponding block will be considered final on the Scroll.
Bridge contract deployed on Ethereum and Scroll allows users to pass arbitrary messages between L1 and L2 . On top of this messaging protocol, Scroll has also built a trust-free bridge protocol that allows users to bridge ERC-20 assets in both directions.
To send messages or funds from Ethereum to a Scroll, users need to call sendMessage on the Bridge contract.
The Relayer will index on L1 and send it to the Sequencer for inclusion in the L2 block. Messages sent back to Ethereum from the Scroll use a similar process on the L2 Bridge contract.
How does Scroll’s zkRollup work?
Putting the above three modules together, we can know the entire workflow of Scroll zkRollup, as shown in the following figure:
After the L2 block in the Scroll is generated, it will be submitted to the Ethereum mainnet. The specific process is as follows:
- The Sequencer generates a series of blocks. For the i-th block, the Sequencer executes the trace T and sends it to the Coordinator. At the same time, the Sequencer submits the transaction data D as calldata to the Rollup contract on Ethereum for data availability, and then submits the resulting state root and transaction data as state to the Rollup contract.
- The Coordinator randomly selects a Roller to generate a proof of validity for each block. To speed up the proof generation process, different block proofs can be generated in parallel on different Rollers.
- After generating proof P for the i-th block, Roller sends it back to the Coordinator. Every k blocks, the Coordinator sends an aggregation task to another Roller to aggregate the k block proofs into a single proof A.
- Finally, the Coordinator submits the aggregation proof A to the Rollup contract, verifies the aggregation proof against the state root and transaction data commitment previously submitted to the Rollup contract, and finally determines the blocks between [i + 1, i + k] on L2.
After such a process, the blocks on Scroll will be finalized, and each L2 block will go through three processes in this process, which are:
- Precommitted : Indicates that a block has been committed by Sequencer and sent to Rollers.
- Committed : Indicates that the transaction data of the block has been published to the Rollup contract of the Ethereum network.
- Finalized ( completed): Indicates that the transactions of this block have been executed correctly.
In summary, Scroll can execute EVM bytecode on L2 while inheriting strong security guarantees from the Ethereum mainnet. This is also the biggest difference between Scroll’s EVM equivalence and other EVM compatibility schemes.