Cowswap - Coincidence of Wants

Cowswap (“CoW” stands for Coincidence of Wants) is a relatively new DEX that operates using a different method than most of its competitors like Uniswap or Sushiswap.

cowswap explained

How it works

Cowswap combines on-chain and off-chain (user to user) transactions to execute orders using a method it calls batch auctions.

  • When a user sends a trade to Cowswap, they must first approve their tokens to be traded by the exchange.
  • Then they send a signed message requesting the trade (instead of an on-chain transaction like the other DEXs, saving on gas).
  • Once their message is signed, the protocol creates a batch auction, and the trade can be completed by “solvers” who search for trades to complete the orders and receive tokens as a reward.

If the batch auction cannot complete the order, the protocol will utilize AMMs for the trade like traditional DEX. Splitting up the orders into smaller pieces addresses the issue of liquidity fragmentation in DeFi (the need to frequently check which pool offers the best liquidity currently when executing a trade, or else risk incurring a higher cost). It also reduces the exposure of the user to front-running or Miner Extracted Value (MEV) attacks because the trade is broken up into smaller parts and cannot be-front run easily.

cowswap explained

Miner Extracted Value (MEV)

A large issue facing Ethereum right now that perhaps is not as well-known as it should be is MEV. It involves a miner or a purpose-built bot, which may front-run or sandwich a transaction to steal profits from a user.

For example, a user sends a buy order for a given token. Since the miners on the Ethereum network have discretion over block ordering, a miner or bot can check the requested transaction and front-run it by buying at the requested price or lower, then force the user to pay a higher price than they would have otherwise. They can then sell the token after the user has executed their order, completing a “sandwich attack” and profit from the arbitrage. These kind of attacks push the cost of using the Ethereum network up. MEV is a problem that affects all of DeFi, it is not just confined to Ethereum. Cowswap has found a way to address this problem by utilizing Coincidences of Wants and batch auctions.

Coincidence of Wants (CoW)

A situation where two or more people can trade for an asset that the others want in a mutually beneficial way is known as a Coincidence of Wants. It’s a simple but powerful concept. The goal of Cowswap is to turn the protocol into a giant space for bartering (or horse trading?). An example taken from their gitbook is as follows:

cowswap explained

In this example, all three parties have something that the others want, so instead of executing their trades individually on AMMs and incurring costs from MEV bots and slippage, they can resolve the trade amongst themselves. Cowswap allows traders to do this on a large scale through Batch Auctions.

Signed Messages

Cowswap can execute trades using signed messages due to the batch auction system. Once a user has signed a message for their trade, the solvers check it and then seek out trades to fill the order off-chain. Solvers are incentivized to do this in much the same way as miners are on PoS chains. They are rewarded if they complete orders successfully, and they can be slashed if they fail to do so.

Cowswap has achieved impressive functionality so far, especially concerning reducing transaction fees for token swaps. It will be interesting to see how the protocol performs in the future.