CoW Swap seeks to solve the MEV problem in decentralized trading

Using batch auctions in CoW Swap, users sign “trade intent” in an off-chain message that sets a limit price


Alena Demidyuk/Shutterstock modified by Blockworks


A coincidence of wants, Felix Leupold explains, is “an economic phenomenon where one party would like to purchase an asset that another party wants to sell, and the other party wants to buy another asset that the first party wants to sell.”

Enter the creation of the CoW protocol, built on the notion of two parties with opposite interests. 

The advantage is that the trading parties can forgo the complications of trading into another medium of exchange, like money, and instead trade directly.

Leupold, the technical lead at CoW Swap, explains the trading mechanism’s advantages on the 0xResearch podcast (Spotify/Apple), allowing for more efficient trading and, according to Leupold, mitigating the problem of MEV.

Due to the “Cambrian explosion” of a vast variety of tokens in the DeFi space, market liquidity is highly fragmented, Leupold says. To create liquidity between the wide variety of token pairs, market makers need to “step in and provide liquidity,” he says. 

If instead, a “holistic approach” can look at the “entire preference expression of the world” once per block, Leupold says, “you can re-aggregate that fragmented liquidity space and find those coincidences of wants.”

Importantly, such an arrangement cuts down on MEV — or maximum extractable value — attacks, where traders incur losses by being “sandwiched” or front-run by opportunistic bots. “Traditionally, if you want to trade token A for token B on Ethereum, you go directly to an [automated market maker] interface or a DEX aggregator,” he says. 

“The algorithm will find you the best on-chain route for your trade,” he says, and “give you back a transaction that you, with your MetaMask account, will submit to the blockchain to execute that trade.”

The problem takes place because of an “asynchronous aspect,” Leupold says, as time passes between receiving the “optimal route from whatever API you’re using” and the transaction being sent to the public mempool to be mined.

“During that time,” he explains, “prices can change,” and MEV actors can extract profit at the expense of traders. 

Batch auctions

Using batch auctions in CoW Swap, the user instead signs “trade intent” in an off-chain message that sets a limit, Leupold explains. “I want to sell token A for token B, and here’s my limit price. But I don’t care exactly how it is executed.”

The user then hands off the intent to “solvers,” Leupold says, a “decentralized network of matching engines.” They compete to find the best execution path at the time that the order is being made valid, he says.

As opposed to individual trades, orders are aggregated into batches, Leupold says. “All the trades that are placed into the API, within a 30-second window roughly, are placed into the same batch.” The solvers that find the optimal trade solution then receive the right to execute the batch.

“All these risks, these complexities of managing your own transaction,” Leupold says, “are now taken care of by a professional entity.” 

Podcast host Dan Smith observes that the solution sounds a lot like MEV-Boost, where builders work to solve transactions for proposers, but Leupold says the process is exactly the opposite in effect.

“If there are two people trading the same asset in the same batch,” he explains, “then the protocol enforces that there is only one price per token per batch.”

The two trades would be cleared “at exactly the same price,” Leupold says. “There’s no concept of first come, first serve or some kind of ordering, fair ordering. There’s just uniform price clearing, one price per token per batch.” This method removes “all kinds of MEV,” according to Leupold.

On CoW Swap, he says, “if there’s two people trading the same asset, you actually need to have a uniform price clearing, so [there’s] no difference between buy and ask.”

Unsophisticated users who don’t know how to “boost” their way to priority over others in the public mempool can be protected by the CoW Swap mechanism, Leupold says, and “not have to worry about all these games that are being played in the Dark Forest.”

Don’t miss the next big story – join our free daily newsletter.


Upcoming Events

MON - WED, MARCH 18 - 20, 2024

Digital Asset Summit (DAS) is returning March 2024. What you can expect: And more! Don’t miss out on the opportunity to be in the room when the future of crypto is decided. Join us and help shape the future of our […]

recent research

Research report - cover graphics-2.jpg


Base has doubled-down on its commitment to the Superchain vision, has shown early signs of success with nearly $400M in TVL, and has become home to novel dapps such as which has seen significant traction.


Blockchain is a “natural fit” in games based on open economies and user-generated content, says Wyatt


Their current stance is a half-baked attempt that could stifle innovation and burden an emerging industry


Maker’s DeFi-focused “subDAO” passed a proposal activating a lending market for DAI on the Gnosis Chain


Certain creditors could be repaid sooner, with one hedge fund exec telling Blockworks it expects a payout by the end of the year


Busan is South Korea’s second largest city with a population around 3.4 million


Cyprus granted eToro crypto registration, setting the groundwork for the company to operate crypto services post-MiCa rollout