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

article-image

Alena Demidyuk/Shutterstock modified by Blockworks

share

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.”


Start your day with top crypto insights from David Canellis and Katherine Ross. Subscribe to the Empire newsletter.

Explore the growing intersection between crypto, macroeconomics, policy and finance with Ben Strack, Casey Wagner and Felix Jauvin. Subscribe to the Forward Guidance newsletter.

Get alpha directly in your inbox with the 0xResearch newsletter — market highlights, charts, degen trade ideas, governance updates, and more.

The Lightspeed newsletter is all things Solana, in your inbox, every day. Subscribe to daily Solana news from Jack Kubinec and Jeff Albus.

Tags

Upcoming Events

Javits Center North | 445 11th Ave

Tues - Thurs, March 18 - 20, 2025

Blockworks’ Digital Asset Summit (DAS) will feature conversations between the builders, allocators, and legislators who will shape the trajectory of the digital asset ecosystem in the US and abroad.

recent research

Unlocked by Template.jpg

Research

The BitcoinOS team is the first to have developed and posted a ZK-compressed proof on the Bitcoin network. Other proof verification efforts have been limited to the Signet or testnet deployments. Their work has resulted in the development of BitSNARK, a software library for ZK-compressed fraud proofs on the Bitcoin network. The project aims to provide a horizontal scaling solution, offering a one-stop shop for teams interested in developing a rollup on Bitcoin. This approach shares similarities with the horizontal tech stack scaling in other ecosystems like Cosmos and Optimism, particularly in its focus on simplified verification, bridging standards, and lightweight interoperability.

/

article-image

A16z’s State of Crypto report shows that DeFi has the largest number of daily active addresses, with stablecoins following closely behind

article-image

G2 is delivering real-world performance breakthroughs at 50-100 Mgas/s, Conduit says

article-image

World Liberty Financial’s token sale debuted just as an absurd AI-fueled memecoin captured crypto’s attention

article-image

Coinbase hired History Associates in 2023 to assist in retrieving records from the SEC and FDIC

article-image

Hours after pledging to support Black men’s rights to safely invest in crypto, VP Harris’s Monday night speech mentioned blockchain zero times