Concise understanding of migration mechanism and Layer 2 interoperability


 109 total views

Author: Hermez Network

Translation: Min Min

We are happy to announce that we are developing a new feature of Hermez zk-rollup, which may improve Layer 2 communication within the entire rollup ecosystem.

Hermez will launch the first version of the zk-rollup network in early 2021, and will implement a large-scale migration mechanism for Layer 2 transactions for the first time.

Why is mass migration transformative?

Most people are already aware of the usability issues of switching between Layer 1 and Layer 2 and the resulting high gas fees.

As more and more Layer 2 solutions for different use cases emerge, the usability problem will become more serious because users need to pay high transaction fees when transferring tokens from one rollup chain to another rollup chain or Layer 1 smart contract . This situation may reduce the liquidity of users’ funds and discourage users’ interest in the Layer 2 solution.

Under the current paradigm, if Bob wants to transfer funds between Layer 2 solutions (for example, from RollupA to RollupB), he needs to first withdraw funds from RollupA to Layer 1, and then deposit funds from Layer 1 to RollupB. In this way, Bob will have to pay the gas fee twice, which may make Bob feel uneconomical.

Introduction to mass migration

The solution to this problem is simple, but it is very complicated to implement. Hermez implementation is very close to the concept proposed by Barry Whitehat.

Through large-scale migration, users can handle external Layer 1 smart contracts as they handle token transfers between Layer 2 users.

These Layer 1 smart contracts need to have a Layer 2 address first. Users need to know this address in order to transfer funds to this address.

The Hermez protocol can group and extract Layer 2 transfers received by the same Layer 1 smart contract at the target address on Layer 2.

The purpose of the user’s funds going to the rollup smart contract will use the standard Hermez function to withdraw the total amount of the same batch of transfers from Layer 1. Although the contract requires the payment of a withdrawal fee, this fee can be allocated to all transfers in the same batch, so the cost is not high.


The recipient’s L2 network coordinator needs to process L1 withdrawal transactions, and decompose the flow of funds from the information, and then remit it to the new rollup corresponding to the aggregate account of the initial rollup.

All of this can be achieved because the Hermez protocol includes the information required to reconstruct the original transfer in Hermez Layer 2 on the target rollup and the corresponding account information in the aggregate withdrawal transaction. This can be achieved through circuit processing in the target Layer 2 (if supported).

Suppose a group of users (including Bob) all want to transfer tokens to another rollup chain. Now, each of them needs to pay the Layer 1 withdrawal fee for their respective transactions. With a large-scale migration mechanism, Hermez can handle multiple transactions in one Layer 1 transaction. All transfer transactions can be executed, and the transferor needs to pay a transaction fee to Hermez Layer 2. In addition, the target rollup may charge a small fee for these transfers. Bob is satisfied with this.

When the first version of the Hermez network is released, the Layer 2 solution will not have inbound processing capabilities, but this feature will be implemented in the next version. In fact, the large-scale migration mechanism is very useful for users who migrate between different versions of the Hermez network. In addition, this mechanism can also be used to connect to other Layer 2 solutions.

The possibilities brought about by this new mechanism will create great value for the Layer 2 ecosystem and the entire Ethereum community.

If you want to learn more about the technology behind Hermez, please check out our latest smart contract. We have also released the Circom circuit on Github, you can read this article for details. We are currently looking for code auditors to work with our technical lead Jordi Baylina. For more information, please contact us.