How Sei order engine reduces MEV?

“Seilor Rabbit hole series” Part 1

Sei is the first order book-specific L1 blockchain, custom-built for DeFi applications. One of its main features is the built-in order-matching module.

Designed to handle institutional order flows at scale, Sei Network features 3 major tech innovations:

  1. Native Order Matching

  2. Twin-Turbo Consensus

  3. Market-based parallelization

This first part of the “Seilor rabbit-hole series”, answers what it means to have a native Order Matching and why this feature brings MEV protection to a whole new level.

What is MEV and why it’s the biggest problem threatening all Layer 1s?

There are two types of MEV under Sei’s team radars, Front-running bots/validators, and liquidation/arbitrageurs. The former bring about negative consequences, whereas the latter are acceptable for a strong DeFi economic model.

Sei is trying to minimize bad MEV with frequent batch auctions (FBA) and maximize good MEV with an off-chain flash bots-style auction.

Deriving token value from gas fees is not profitable enough for high throughput chains like Sei and Solana. Therefore Sei is planning to get its value accrual by distributing the auction profits to validators and stakes, generated by good MEV bots. Sei auction will be private and off-chain, similar to the Flashbots model (an implementation built on mev-boost, that allows front-running protection on Ethereum). This system is private, meaning that it's a Blind Auction (also known as first-price sealed-bid auction) where the bidder can submit a precise transaction order preference without revealing his bid and without paying for failed bids.

This auction will allow bots to compete for typical MEV transactions such as liquidations and arbitrage. Rather than congesting the p2p network and increasing gas prices, the bots will bid for the economic value of the transaction, with the winning bid being close to the actual value of the transaction. With enough market actors, the winning bid may be slightly lower than the transaction value, with a portion going to the winner and the rest being distributed.

For instance, with a liquidation worth $100, bots will compete and bid up for inclusion in the liquidation transaction, but instead of spamming the Sei chain, they will do it off-chain, trumping gas fees. In an efficient market, the winning bid may be worth around $99, with $1 to be awarded to the bot and the remaining $99 distributed to validators and delegators.

Sei MEV Illustration by Delphi Digital
Sei MEV Illustration by Delphi Digital

Let’s take a step back and see what is MEV.

Maximal Extractable Value, is the process of maximizing economic value from block production, by including, excluding, and changing the order of transactions in a block”.

With MEV, validators gain from an increased gas fee paid by the “searchers” or arbitrage bots, that have to submit the arbitrage transaction with the highest gas price. Arbitrage bots, run algorithms to detect profitable MEV opportunities and execute the orders posted by unaware retail traders, seconds (or even milliseconds) before they can fill orders at a fair price, hence the front run.

For a more in-depth look at MEV check this guide.

Michael Lewis in his book ‘Flash boys’, investigated the original Wall Street “front-runners”, where High-Frequency Trading (HFT) and unethical arbitrage practices, led to a formation of a rigged market.

Constant information asymmetry (front-running) and a lack of deep liquidity, are stopping the next-generation DEXes from overthrowing their centralized counterparts and market makers from achieving on-chain capital efficiency with billions in size.

When choosing where to park their liquidity, Market Makers (MMs) value speed, finality, and latency. In order to provide market depth, MMs follow and update their price (on both sides) every block, so sub-second block times mean tighter spread updates, and therefore less risk of getting exploited by HFTs, who profit in the time frame between an external price update and a MM reaction.

A group of M&Ms choosing the real DeFi chain.
A group of M&Ms choosing the real DeFi chain.

How Sei Native hOMiE is achieving Front-running Protection?

Order Matching Engines (OMEs) are your homies when it comes to matching ask and bid orders for all kinds of exchanges including crypto markets.

Like your car engine, the OME is responsible for speed (TPS and Finality) and torque (Throughput).

Let’s break down why Sei has a Ferrari engine.

  • Sei’s OME is Native, meaning that order placement and matching can be used by any exchanges building on top of Sei infrastructure (“plug and play”), it’s not a smart contract that needs to be forked.

  • Sei’s OME uses Frequent Batch Auctioning* combined with Single Block Order Execution

    FBA can aggregate every single market order at the end of the block, then execute all orders at the same uniform clearing price.

    Sei also collapses order placing and execution into one block for a faster trading experience.

    It doesn’t matter what’s the order of your transaction, you still going to have the same price as everyone that posted TXs during that block time (around 450 ms).

Let’s say that there are two orders on the order book, one to sell $Sei for $10 and one to sell $Sei for $11 and then 2 buyers come in. Normally the 1st buy gets filled at 10$ and the 2nd at 11$, but with Frequent Batch Auctioning both orders get filled at $10,50, which is the uniform clearing price, obtained by the sum of the two prices divided by two, (P1 + P2)/2.

*Quick historical note on FBA: this model was created as a solution to the huge arbitrage opportunities of the Continuous Double Auctions model (CDA). CEXs usually use a CDA where orders are processed as soon as they reach the order book (or get filled by other bids or asks), requiring High-throughput during high volatility. For DEXs this often results in severe latency due to network congestion.

Is Sei engine truly unique? Let’s compare it with Injective, dYdX, and Serum.

DEXs like Uniswap on Ethereum or Serum on Solana are executing each order one by one, resulting in slower performance and higher MEV-related costs.

New AMM models have the benefit of having “potentially” infinite liquidity but they constrain users to be price-takers only. While users of Central Order Book Exchanges (CLOB) can be both makers or takers.

OME Comparison by 3V labs
OME Comparison by 3V labs


Injective with a TVL of over $9.2 mil and a market cap of $293 mil (As of 22/02/23), is the first mover based on the Cosmos SDK, to target an audience of the best and most liquid MMs, DEXs, and traders.

To reduce front-running, Injective also uses the FBA model, introducing three main features.

  1. Discrete-time feature, states that crossing orders are filled over a discrete time period with a First-in First-out prioritization.

  2. Uniform clearing price.

  3. Sealed bids, result in orders not being published in the order books until the auction interval ends and the batch is executed.


In the case of Serum with a TVL of $566k and a market cap of $124 mil (As of 22/02/23), the OME is pretty simple. The model converges the highest bid and the lowest ask, setting the current market price, at which traders can immediately execute the order and close this bid-ask spread.

This model can be effective with high liquidity from the order book and the fast Tx speed of Solana but remains suboptimal.

On Sei all CLOB Txs are executed atomically in the scope of a block (see image), as opposed to Serum, which requires 2 separate transactions to handle order placement and execution.

Lifecycle of a Transaction - Fig.5
Lifecycle of a Transaction - Fig.5

Sei Competitive hedge

Sei radical optimization is set to upscale these OMEs even further with:

  • Block parallelization

    Rather than processing transactions sequentially, Sei processes transactions in parallel. Multiple transactions, related to different markets can be processed simultaneously, which leads to improved performance. From recent load test, they were able to see 75-90% reductions in block times vs. sequential and 40-120ms latency for parallel vs. 200-1370ms latency for sequential.

    Market-based parallelization: by default Sei considers all order book transactions touching different markets as independent (if they do not affect the same market in the same block).

  • Native Price Oracle

    Sei price oracles, responsible for streaming the off-chain price data onto the blockchain, are built into the chain, meaning that all validators are required to propose their prices (exchange rates) when committing to a block. Blocks are created only if all validators agree on a common price. If validators miss some voting windows or provide prices diverging too much from the median, they get slashed (punished).

  • Transaction Order Bundling: MMs can cancel and create orders on multiple markets in one transaction (i.e. all orders for a BTC perpetual will be combined into one smart contract call for that particular market).


Coming to dYdX, the current version has two issues: both Ethereum and StarkEX apps are not performant enough to power dYdX demand and also v3 currently operates through central sequencers which have the ability to censor transactions.

In dYdX team words:

“the fundamental problem with every L1 or L2 we could develop on is that none can handle even close to the throughput needed to run a first-class order book and matching engine”.

In terms of performance, version 3 currently handles 10 trades per second and ≈1,000 order places/cancellations per second.

DYdX team is rebuilding as a Cosmos app-chain featuring a fully decentralized, off-chain, order book, and matching engine. DYdX v4 is set to launch in H2 2023 (end of September), with a Public Testnet coming by end of July.

Sounds familiar?

Deep diving into order matching priority

  • Sei’s OME will prioritize the processing of all order cancellations, removing the associated limit orders from the order book store. Then all limit orders will be added to the order book. This ensures that orders are getting filled with maximal liquidity. Then, the matching engine will process market orders.

  • Injective protocol runs with the FIFO (first in, first out) principle, market orders get executed first, then unfilled limits orders, and finally most recent limit orders.

  • Serum Dex also runs with FIFO policy matched with a “price-time-priority”, orders are ranked according to their price and the orders belonging to the same price are ranked depending on when they were posted into the book.

In conclusion, the Sei is a custom-built L1 blockchain for DeFi applications that features several innovative technologies, including Native Order Matching, Twin-Turbo Consensus, and Market-based parallelization. Its native Order Matching Engine (OME) is designed to achieve front-running protection by using frequent batch auctioning (FBA) and single block order execution. This allows for faster trade execution and eliminates the risk of market manipulation and exploitation by high-frequency traders.

Overall, the Sei aims to provide a secure and efficient platform for institutional order flows and market makers in the DeFi space.

Article by, author Macr0Mark.


  1. “Maximal Extractable Value (MEV)”, Ethereum . org developers docs.

  2. White-paper “Sei: The Sector Specific Layer 1
    Specialized for trading, giving exchanges the unfair advantage”
    , Sei Labs.

  3. “Latency and throughput” Twitter thread by Sei CEO jayendra_jog.

  4. “Why dYdX is leaving Ethereum and StarkWare for a native chain on Cosmos”, Cryptoslate, Liam Wright.

  5. Serum - Central Limit Order Book vs Automated Marker Maker”, DoDao. io.

Subscribe to 3V Labs
Receive the latest updates directly to your inbox.
Mint this entry as an NFT to add it to your collection.
This entry has been permanently stored onchain and signed by its creator.