All articles
MEV·May 4, 2026·7 min read

Designing MEV-Resistant AMMs: FBA, MEV Taxes & Threshold Encryption

A smart-contract deep-dive on MEV resistant AMM design: frequent batch auctions, application-level MEV taxes, and encrypted mempools, with real tradeoffs.

Every constant-product AMM leaks value on every swap, and the leak has a name: sandwich attacks paid for out of your users' slippage tolerance. A trader sets 1% slippage on a $50k swap, a bot front-runs it, the price moves to the edge of that tolerance, the bot back-runs, and roughly $500 walks out the door to a searcher and a builder. Multiply that across a DEX doing nine figures a month and you're bleeding your most active users to keep them. If you're designing a new DEX, the interesting question isn't "how do we add MEV protection later" — it's which ordering guarantee you bake into the contract before you ship, because that decision touches your router, your oracle, and your fee model all at once.

There are three families of defenses worth taking seriously in 2026: frequent batch auctions, application-level MEV taxes, and encrypted mempools with threshold decryption. They attack the problem at different layers, they compose in some combinations and fight in others, and each one costs you something real.

Frequent batch auctions: kill the ordering game

The root cause of sandwiching is that transactions inside a block have an order, and whoever controls that order can insert themselves around yours. A frequent batch auction (FBA) removes the lever. Instead of executing swaps one at a time along the bonding curve, you collect all orders that arrive in a short window — a block, or a fixed 200ms–1s interval — and clear them together at a single uniform price.

The mechanics that matter:

  • Every order in the batch gets the same clearing price. There is no "first" and "last" in the batch, so there is no position to front-run.
  • The clearing price is found by aggregating buy and sell demand and solving for the price where they cross. On-chain you can approximate this with a solver-submitted price that anyone can challenge, or compute it directly for simple two-token batches.
  • Because ordering inside the batch is irrelevant, the miner/builder loses the sandwich vector entirely. What's left is benign MEV — arbitrage that closes the price gap between your batch and the rest of the market, which you can auction off deliberately.

CoW Protocol is the production reference here: solvers compete to settle a batch, and the winning solution must respect a uniform clearing price with surplus going back to users. The cost is latency and complexity. A batch that clears every second is a terrible venue for a market maker who needs continuous quotes, and your solver market is now a piece of infrastructure you have to bootstrap and keep honest. Batch auctions also don't eliminate cross-domain MEV — a searcher watching your batch and a CEX can still arb the difference, they just can't do it inside your ordering. If your team's edge is latency-sensitive execution, understand that FBAs deliberately throw latency away; that's a very different world from the microsecond races we tune for in our Solana MEV and arbitrage bot work.

Application-level MEV taxes: price the priority

The MEV tax, introduced by the folks behind Uniswap and Paradigm, is a smaller and more surgical idea. It works on chains with competitive priority ordering — where the transaction with the highest priority fee (per gas) goes first. On an OP Stack chain like Base, the sequencer orders by priority fee, and that's the hook.

The trick: your application charges the transaction a fee that is a steep function of its own priority fee. Concretely, a swap contract reads tx.gasprice, computes the priority fee above base fee, and demands, say, 99× that amount as an application fee routed back to the LP or the swapper.

function _applyMevTax() internal {
    // priority fee this tx is paying, per the current base fee
    uint256 priorityFee = tx.gasprice - block.basefee;
    // charge a multiple of it as an in-app fee
    uint256 tax = priorityFee * MEV_TAX_MULTIPLIER; // e.g. 99
    require(msg.value >= tax, "mev tax unpaid");
    // route tax to the pool / user, not the sequencer
    _creditPool(tax);
}

Why this neutralizes the toxic part: a searcher who wants to be first in the block has to outbid rivals on priority fee. Normally that surplus goes to the sequencer/validator. With a 99× tax, 99% of whatever the searcher was willing to pay to win the ordering race gets redirected into the pool or back to the user being protected. The searcher still gets to do the arbitrage — you're not banning them — but the profit from winning the race is captured by your application instead of leaking to the chain operator. It's an auction where the DEX is the auctioneer.

The gotchas are sharp:

  • It only works under priority ordering. On a first-come-first-served sequencer, or on Ethereum L1 where builders reorder freely and can pay via direct transfer instead of priority fee, the mechanism breaks. A builder can bribe out-of-band and your tx.gasprice read sees nothing.
  • You need the tax to be paid in a way the contract can verify and that a builder can't route around. That constrains you to environments where priority fee genuinely determines order.
  • Getting the multiplier wrong either under-captures (too low) or prices out legitimate urgent swaps (too high).

For teams building on EVM L2s, a MEV tax is often the highest-leverage single change because it needs no new infra — just contract logic and a chain whose ordering rule you can lean on. It pairs naturally with the kind of latency-edge work we describe in Jito ShredStream and the searcher latency edge, where understanding how ordering is decided is the whole game, and it's a core piece of how we approach EVM MEV strategy on L2s.

Encrypted mempools and threshold decryption

The third approach hides the order until it's too late to exploit. Transactions enter the mempool encrypted; a committee of nodes holds shares of a decryption key; once ordering is committed, a threshold of the committee (say 13 of 19) collectively decrypts the batch and it executes in the pre-committed order. Shutter Network is the live example on Gnosis Chain. Because a searcher can't read the swap's size or direction before the order is locked, they can't sandwich it.

What this actually buys and costs:

  • It defends against front-running and sandwiching, because the payload is opaque during the ordering phase.
  • It does not stop back-running or statistical MEV. Once decrypted and executed, the price impact is public, and a fast bot can still arb the aftermath.
  • You inherit a liveness dependency on the committee. If the threshold can't be reached, transactions either stall or fall back to plaintext — and the fallback is exactly the moment an attacker waits for.
  • Latency goes up by the decryption round-trip, and you've added a trusted-ish committee to a system whose whole pitch was trustlessness.

Encrypted mempools are heavy machinery. I'd reach for them when the swaps being protected are large and infrequent enough that a second of added latency is a rounding error, and when you can actually stand up or rely on a credible key-holder set. For most new DEXes, that's a later-stage upgrade, not a launch feature.

What I'd actually build

If I were architecting a new DEX today on an EVM L2 with priority ordering, I'd start with a MEV tax — cheapest to implement, captures the sandwich surplus, no new infrastructure. If the venue needs to protect large orders and can tolerate discrete-time clearing, I'd layer a batch auction on top for those flows and auction the benign arbitrage as a revenue line rather than pretending it doesn't exist. Encrypted mempools I'd treat as a v2 for a specific high-value order type, not a default.

The meta-point: these mechanisms decide who captures the value that your bonding curve is going to leak no matter what. Toxic MEV isn't magic — it's just an ordering privilege you either sell deliberately or give away by accident. The same instrumentation we build for reading mempools on Solana, like the Yellowstone gRPC Geyser streaming setup and the JIT liquidity mechanics inside Meteora DLMM, is exactly what tells you how much value is on the table before you pick a defense.

If you're weighing these tradeoffs for a live DEX, our team can help you model the capture and ship the contracts through our EVM MEV and protection engineering.

Need a bot like this built?

We design, build and run trading bots on Solana, Hyperliquid and Polymarket.

Start a project
#MEV#AMM design#batch auctions#threshold encryption#DEX architecture