Originally Posted by Young, Scroll Researcher; Babywhale, Foresight News
At the end of February this year, ZK Rollup-based Ethereum Layer 2 network Scroll officially launched the Alpha test network open to all users, and said that it will improve zkEVM performance in the next few months. Just a week after the launch of the new testnet, Scroll announced that it had completed a $50 million financing with Polychain Capital, Sequoia China and others at a valuation of $1.8 billion.
In June 2022, the author briefly introduced the design framework of Scroll in "Understanding Scroll in Three Minutes: New ZK Rollup Expansion Players". Scroll aims to establish an "EVM-equivalent" zkEVM expansion network to achieve seamless migration of applications on Ethereum.
In July, Scroll launched the Pre-Alpha test network that requires application qualifications. As of the launch of the Alpha test network, the Pre-Alpha test network has processed more than 15.4 million transactions, confirmed more than 1.8 million blocks, and submitted 64.1 Thousands of batches of validity certificates, and a total of more than 100,000 users participated. Since the opening of the Alpha test network, there are about 2,145,099 wallet addresses, about 10,102,684 user transactions have been processed, 886,701 blocks have been generated, and the average block time is about 3 seconds.
In this article, the author will introduce the mechanism by which Scroll can inherit the security of the Ethereum mainnet under the premise of decentralization.
The structure of Scroll
Scroll architecture mainly consists of 3 parts: node network, proof network and Rollup contract.
Node network (Scroll Node)
Scroll's node network consists of three parts: Sequencer, Coordinator and Relayer.
Sequencer
Sequencer (Sequencer) provides JSON-RPC (JSON is a lightweight data exchange format that can represent values, strings, sequences, and name/value pairs. JSON-RPC is a stateless, lightweight remote procedure call protocol) interface and accept 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. Scroll's sequencer is implemented by forking the widely used Ethereum node Go Ethereum (Geth), and thus achieve better compatibility and security that can stand the test of time.
Coordinator
Once a new block is generated, the Coordinator will be notified and receive the execution trace of the block from the sequencer. Then, the coordinator assigns the Execution trace to a prover randomly selected from the decentralized proof network to generate a proof.
Relayer
The relayer (Relayer) is used to observe the cross-chain bridge and Rollup contract deployed on Ethereum and Scroll. It has two main responsibilities, one is to monitor the Rollup contract and track the status of the L2 block, including its data availability and validity proof. The second is to monitor the deposit and withdrawal activities of the cross-chain bridge contract deployed on Ethereum and Scroll, and pass messages from one party to the other.
Proof Network (Roller Network)
Rollers, as provers in the network, are responsible for generating validity proofs for ZK Rollups. Roller can take advantage of hardware devices like GPUs, FPGAs, and ASICs to reduce verification time and verification costs.
The figure below shows how Roller generates validity proofs for each block, with the following steps:
Roller first converts the execution Trace received from the coordinator into a circuit witness.
Proofs are generated for each zkEVM circuit.
Using proof aggregation, proofs from multiple zkEVM circuits are merged into a single block proof Rollup and cross-chain contracts.
It is worth mentioning that Scroll team members said that Scroll plans to launch the Proof Network testnet before the mainnet goes live. On the one hand, it proves that the decentralization of the network has found a temporary use for GPU mining machines that have nowhere to be placed after the merger of Ethereum. On the other hand, the future main network’s incentives for provers may stimulate the development of zero-knowledge proof chips, which will eventually be widely adopted by a large number of ZK projects, forming another entity industry chain after Pow ASIC mining machines.
Rollup and cross-chain bridge contract
Scroll is connected to Ethereum through Rollup and cross-chain bridge contracts. This ensures data availability for L2 transactions and allows users to transfer assets and information between L1 and L2.
Rollup contract
The Rollup contract receives the L2 state root and blocks from the sequencer. It stores state root in Ethereum state, L2 block data as Ethereum calldata. This provides data availability for Scroll blocks and leverages Ethereum's security to ensure that indexers, including Scroll relayers, can rebuild L2 blocks. Once the proof of the validity of the L2 block is verified by the Rollup contract, the corresponding block is considered to be completed on the Scroll.
Cross-chain bridge contract
The cross-chain bridge contract deployed on Ethereum and Scroll allows users to transfer arbitrary information between L1 and L2. On top of this messaging protocol, we also built a trustless cross-chain protocol that allows users to bridge ERC-20 assets in both directions. To send messages or funds from Ethereum to Scroll, users need to call the sendMessage transaction on the cross-chain bridge contract. The relayer will index this transaction on L1 and send it to the sequencer to include it in the L2 block. Sending a message from Scroll to Ethereum, the process of the L2 cross-chain bridge contract is similar to the above process.
How does Scroll implement ZK Rollup?
The L2 block in Scroll is generated and submitted to Ethereum, and will be finalized in the following order:
The role of the sequencer is to generate blocks. For the i-th block, the sequencer generates an execution Trace: T and sends it to the coordinator. The sequencer also submits the transaction data D as CallData to the Ethereum contract, guarantees data availability and the resulting state root and commitment to the transaction data of the Rollup contract as the state.
The coordinator will randomly select a prover 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 by different provers.
After generating a block proof P for the ith block, the prover will send it back to the coordinator. Every K blocks, the coordinator assigns an aggregation task to another prover to aggregate the k block proofs into an aggregation proof A.
Finally, the coordinator submits the aggregation proof A to the Rollup contract, and by verifying the state root and transaction data commitment previously submitted to the Rollup contract, the L2 Block from i+ 1 to i+k can be finally determined.
The figure above illustrates that the Scroll block will be finalized on L1 after a multi-step process. Each L2 block will go through the following three stages until finalized:
pre-commit. A precommit indicates that the block has been proposed by the sequencer and sent to the prover. Although pre-committed blocks are not yet a canonical part of the Scroll L2 chain, since they have not yet been published on Ethereum, users of the trust sequencer can choose what action is expected to be taken on them.
submit. Commit means that the transaction data of this block has been published on the Rollup contract of Ethereum. This ensures the data availability of the block, but does not prove that it was executed in an efficient manner.
end. The final state indicates that the transactions in the block have been correctly executed and passed the validation verification on Ethereum. The finalized blocks are considered a canonical part of the Scroll L2 chain.
The difference between Scroll and other ZK Rollup schemes
Overall, the biggest difference between Scroll and the Polygon zkEVM, StarkNet and zkSync Era that have been launched on the mainnet is that Scroll is closer to the native Ethereum implementation and is more friendly to EVM developers.
Scroll vs Polygon zkEVM
There are some technical differences between the two in terms of implementation. One is that Scroll directly forks the widely used Ethereum node implementation Geth to generate Layer 2 blocks, which is close to the native Ethereum implementation. Scroll designed different subcircuits to prove that Geth executes every opcode in the trace, and it is easier to verify that the circuit has the exact same behavior as native Ethereum. Polygon zkEVM, on the other hand, rewrites each EVM opcode in a new assembly language and then generates a proof for its underlying state machine.
Another difference is that Scroll uses SNARKs for both zkEVM circuits and aggregation circuits. Polygon zkEVM is using STARK as their zkEVM circuit and using SNARK as aggregation circuit to aggregate STARK proofs.
Scroll vs StarkNet
Compared with StarkNet, Scroll aims at EVM equivalence, and hopes that the native zkEVM solution can achieve bytecode-level compatibility, which is more friendly to Ethereum developers; while StarkNet is a ZK-friendly but not developer-friendly plan. Therefore, StarkNet has a certain learning cost to establish a developer and project ecology, and there are also many challenges.
Scroll vs zkSync
Compared with Scroll's compatibility at the EVM bytecode level, zkSync is compatible with the EVM at the language level, so for smart contract developers, additional trust in deploying a compiler with BlackBlox is required, and more time to conduct security audits.
Scroll's Decentralized Dream
Zhang Ye, a member of the Scroll team, published an article calledThe Idea Behind Scrollarticle. This article describes Scroll's vision in detail: In addition to the Scroll project itself, the team hopes to contribute to Ethereum's zkEVM research.
It is mentioned in the article that, compared to "building a car behind closed doors", Scroll has made the decision to develop together with the community from the very beginning, and has been practicing this, including the development of zkEVM driven by the community and the development of zero-knowledge proofs. Education, maintaining the Python version of the zkEVM specification, etc.
In addition to the above-mentioned aspects of community-based operations, Scroll also emphasizes more aspects of decentralization, including sequencers, certifiers, and more. In general, Scroll hopes to become a protocol similar to Ethereum, which has a core development team, but is still open at the underlying technology and infrastructure level, and ultimately promote the vigorous development of the zkEVM ecosystem and the compatibility of the main network and zkEVM. Even the ultimate goal that Ethereum Layer 1 itself wants to achieve.
