Sequencer’s working principle, current situation and future

BeginnerJan 26, 2024
This article explains what a “Sequencer” is and how it works in Layer2 blockchain
Sequencer’s working principle, current situation and future

Currently, the main source of revenue for Layer2 is the gas fees paid by users when they perform transactions on Rollup. After subtracting the gas fees paid by Layer2 when submitting data to Layer1, the remaining amount is almost pure profit. As shown in the figure below, rough calculations indicate that the profit for OP Mainnet for the period of June to December 2023 is approximately $5.23 million, the profit for Arbitrum for the entire year is $16.5 million, and the profit for zkSync Era for the period of March to December 2023 is $22.24 million.

What’s the secret behind achieving such huge profits? In fact, this has a lot to do with the Sequencers they are running.

So, what is a sequencer and how does it work in Layer2? What are the problems faced by centralized sorters? How will concurrent sequencers develop in the future? This article explores these issues in depth.

Sequencer’s Principle

Sequencer plays a critical role in Layer2. Its main function is to receive transactions from Layer2 users and execute them, and finally submit the batch processing formed by sorting and compressing the transactions to Layer1.

Perhaps this is still too abstract, so let’s use a concrete example for analogy. In the past, when users made transactions on Ethereum, it can be likened to driving to the city (Ethereum) to handle business. When there is a peak in transaction volume, traffic congestion naturally occurs. At such times, users can only wait or pay more money to hire assistance (referring to validators) to pick them up; otherwise, there is no other way.

In the real world, there are many solutions to solve traffic congestion, such as developing public transportation, widening roads, building more roads, or implementing staggered travel restrictions. Layer2 is Ethereum’s public transportation solution, and the sequencer serves as the bus driver. The bus driver tells everyone that they don’t need to drive into the city themselves anymore. As long as they give me some service fees (which are lower than the cost of driving by themselves), I will guarantee to take everyone to their destination. This way, it saves both money and effort. At the same time, in order to maximize the use of space on the bus, the bus driver usually fills it up with passengers as much as possible. They may also give instructions and rearrange passengers, such as putting a thin person between two overweight people, making the passengers “fit together perfectly.”

After understanding this process, let’s answer some of the questions that everyone is concerned about.

Who can run the sequencer?

There are several common scenarios:

  • Centralized sequencer

This solution is for the Layer 2 team to personally or designate an organization to only run the sequencer. Because this method is very efficient and low cost, it is the favorite solution of the Layer 2 team.

Of course, there are other solutions to decide who can run the sequencer which I will introduce in detail in the “Decentralized Sequencer” section.

  • Completely permissionless sequencer

This means that anyone can sort transactions and submit them to Layer1. However, this solution, although seemingly simple and fair, also has obvious drawbacks. After all, sorters are not equivalent to miners or validators in Layer1, and they do not enhance the final security. They only submit batch processing to the main chain. Even if multiple participants submit batch processing simultaneously, only one will be included in the end, resulting in a waste of computing resources and gas for other sorters.

What criteria does the Sequencer use to sort?

Typically, there are two sorting methods. The first one is first-come, first-served, similar to allowing the first person to board a bus to claim a seat and prioritizing transactions that are submitted earlier. The second method is sorting based on Gas fees. If a user is in urgent need of their transaction, they can offer a higher fee to the sorter. In this case, the sorter will prioritize packaging their transaction regardless of its submission order.

The mainstream Layer2 mostly adopts the first method, but in essence, both the first and second methods are just in line with common sense. There is no strict rule for how to sort in Layer2. The sorter can even sort as they wish, just like a bus driver can refuse someone to board or give priority seating to their relatives and friends, even though it is not in line with common sense.

Can sequencers be malicious? How can we prevent it?

Theoretically, sequencers can do evil.

The power of a sequencer is actually very significant. They can intentionally cancel someone’s transaction and falsely report that it has been successful. They can also include a malicious transaction (such as transferring a user’s assets in Layer2 to their own address) among numerous transactions to profit themselves.

However, to prevent potential malicious behavior of the sequencer, different Layer2 solutions have different constraint mechanisms. Optimistic Rollup adopts a fraud proof approach, which assumes optimistically that the sequencer is honest. During the dispute period (usually one week), if there is no validator proof that the data submitted by the sequencer to Layer1 is incorrect, the submitted data cannot be changed. On the other hand, ZK Rollup uses validity proofs, which means that batch processing published by the sequencer will be verified in real time. Once the verification is successful, the transactions will be confirmed on Layer1 without a dispute period.

Starknet’s sequencer operation diagram

Current Situation: Problems Caused by Centralized Sequencers

The current mainstream Layer 2 such as OP Mainnet, Arbitrum One, Starknet and zkSync Era all use a centralized sequencer solution, with sequencers run by official or affiliated organizations. For example, the Optimism Foundation runs the sequencer of OP Mainnet and Offchain Labs. Works on Arbitrum One’s sequencer, etc.

A centralized sequencer has many benefits for Layer2 projects, such as ease of management, increased efficiency, and the ability to earn some revenue. Although almost all of them promise to safeguard the interests of users and not do evil (at this stage, they strictly follow the first-come, first-served sorting standard), centralized sorters still cause worries to many users.

Weak censorship resistance

If the sequencer is run by a single centralized entity, its censorship resistance cannot be compared to the tens of thousands of validators or miners in Layer 1. The team may exclude some transactions due to regulatory requirements, or blacklist some transactions for certain reasons. Although most Layer2 currently have designed mechanisms that allow users to bypass the sequencer and submit transactions directly to Layer1, users still need to pay additional costs.

Users submit their own transaction plans (Source: L2BEAT)

Weak activity

Weak Activity can also be understood as a single point of failure. In comparison to thousands of transaction requests per second, a centralized sorter may not be able to handle such a high volume of requests simultaneously due to hardware limitations and other factors. When a sequencer becomes overloaded and there are no backup sequencers available, it can cause the entire system to crash. For example, there was a period of downtime during the distribution of airdrops in Arbitrum.

Obtaining Improper MEV Gains

MEV stands for Maximal Extractable Value, which refers to the additional income that miners/verifiers can obtain by manipulating transactions (adding, deleting, and rearranging transactions). Although they usually determine the order in which transactions are included in the block by sorting the gas fee from high to low, once they monitor the occurrence of significant profits, miners can add transactions to the block, delete transactions, or change the order of transactions, in order to obtain benefits other than block rewards. In simple terms, it can be understood as “being both a player and a referee.”

In Layer2, the sequencer has the power to manipulate the order of transactions, similar to the miner/validator in Layer1. Although the sequencer is operated by the Layer2 team, we still cannot fully trust them in essence, especially when OP Mainnet uses a private memory pool (a place where users temporarily store transactions awaiting processing by the sequencer). This can be seen as a black box operation, even though they claim to do so in order to prevent others from monitoring transactions and gaining improper MEV profits.

Future

Mainstream Layer2 (OP Mainnet, Arbitrum One, Starknet, zkSync Era) are aware of the problems caused by centralized sequencers. So they all proposed their own decentralized sorter solutions.

However, it is currently only reflected in official documents or white papers. It seems that they are now more focused on building their core competitiveness (network performance, ecosystem construction) than dispersing their power and benefits.

Decentralized Sequencers

Next, I will briefly introduce several decentralized sequencer solutions:

  • Geographical decentralization

This is a brutally simple way to distribute several sequencers in different geographical locations around the world and have them operated by reputable and relevant companies/organizations. They can determine who performs transaction sorting during a certain period through rotation. Although still problematic, this solution offers better resistance to censorship and liveliness compared to a single centralized sorter.

  • Sequencer Auction

Rollup can conduct sequencer auctions directly through smart contracts. Anyone can bid for the right to run the sequencer. Such auctions are conducted for each block and can also be for a certain time period. Of course, the party that wins in the end still has to pledge a certain deposit so that they can be punished if they do evil. At the same time, the rollup of funds obtained from the auction can also be effectively distributed.

  • Leader Election

This solution allows anyone to stake tokens (ETH or Layer2 native tokens) into Layer2’s smart contracts. Each order who submits a batch is randomly selected from these pledgers (the probability of winning can also be determined) Proportional to the pledge amount).

  • Based Rollup

This is a proposal that has recently emerged in the Ethereum community, which is to directly let Ethereum validators take the lead in the ordering of Layer2 transactions, completely replacing Layer2’s own sequencer. However, this solution is more challenging compared to previous approaches, and there are still many technical issues to be resolved.

Shared Sequencers

The essence of the decentralized sequencer scheme is to discuss how Layer2 can distribute the authority to run the sequencer, with the Layer2 team still being the leader in this process. The concept of a shared sequencer refers to the elimination of a single Layer2 exclusive sequencer, and multiple Layer2s share a third-party sorter network.

This has many benefits, such as atomic composability between Layer2 (different Layer2 transactions in the same memory pool), preventing MEV fetches, etc. There are currently many projects building a shared sequencer network, such as Astria, Radius, and Espresso, among others.

Summary and Reflections

Eliminating single points of failure and mitigating systemic risks is one of the spirits of ctrypto, and the idea of ​​decentralizing the sequencer is also based on an extension of this spirit to some extent. But if we think about it from a practical perspective, is a decentralized sequencer or a shared sequencer now perfectly capable of mitigating the problems caused by a centralized sequencer? I don’t think so.

From the perspective of MEV, take Ethereum as an example. According to data from Flashbots, since the Merge of Ethereum, its statistical block proposers (Proposers) have achieved REV extraction of 288,829 ETH. (Note: REV is the MEV that has been extracted)

This is only the incomplete data compiled by Flashbots, which shows how huge the MEV market is in permissionless Ethereum.

MEV generated by benign and appropriate arbitrage operations is conducive to market stability, but malicious operations (such as sandwich attacks) carried out under the temptation of huge MEV interests will have an adverse impact on the entire network. Even if the miners themselves do not do evil, it will create an off-chain market for collusion and bribery. This obviously goes against the original intention of the Ethereum concept and will also seriously harm the interests of ordinary users. Although Ethereum is currently looking for solutions (such as separating orderers from proposers), this situation will still exist in the short term.

The current MEV pattern of Ethereum is formed spontaneously by the market. So when Rollup’s sequencer is also liberalized and decentralized, will such a market pattern also form over time? Compared with the possible single point of failure caused by trusting the Rollup team, the chaos and another kind of centralization caused by disorderly competition in the market are also frightening.

At the same time, although shared sequencers can make different Rollups interoperable at the sequencer level, if more and more such third-party shared sequencers are used in the future, they will essentially become a controller that controls multiple Rollups. The network will become more and more powerful. So, will the same centralization problem arise again? Do we need some solution to decentralize the shared sorter? These issues require further consideration.

The development and decentralization of blockchain is a long and difficult process. The reason why the sequencer attracts attention is because it plays an extremely important role in the entire Rollup. I believe that through continuous exploration and efforts in the future, the problems we face today will be appropriately solved.

Disclaimer:

  1. This article is reprinted from [深潮]. All copyrights belong to the original author [鑒叔]. If there are objections to this reprint, please contact the Gate Learn team, and they will handle it promptly.
  2. Liability Disclaimer: Th
    e views and opinions expressed in this article are solely those of the author and do not constitute any investment advice.
  3. Translations of the article into other languages are done by the Gate Learn team. Unless mentioned, copying, distributing, or plagiarizing the translated articles is prohibited.
Start Now
Sign up and get a
$100
Voucher!
Create Account