HomeKnowledge BaseWhat are CoWs on CoW Swap?

What are CoWs on CoW Swap?

9 min read

A cow is a large, domesticated animal that’s been used as livestock for centuries…

But a CoW — now that’s a totally different thing!

The acronym “CoW” stands for “Coincidence of Wants” and it’s the founding mechanism behind the creation of CoW Swap, as well as the inspiration for our cow theme! A Coincidence of Wants is an economic phenomenon where two parties swap assets with one another peer-to-peer. On CoW Swap, a Coincidence of Wants occurs when two (or more) traders swap cryptocurrencies with each other without having to use on-chain liquidity.

To illustrate the concept better, let’s look at an example.

How to Have a CoW

Let’s say Meredith wants to buy 0.5 ETH in exchange for $1,000 DAI. At the same time, another trader, Eli, wants to swap 0.75 ETh for $1,500 DAI.

On a traditional exchange such as Uniswap, Meredith and Eli would both tap an ETH / DAI liquidity pool in order to make their trades.

1-how-to-have-a-cow.webp

On CoW Swap, however, there’s another possibility. CoW Swap orders start out as signed “intent to trade” messages that get batched together before getting sent to on-chain liquidity sources like Uniswap. As a result, CoW Swap can match orders peer-to-peer when the opportunity arises.

If you notice, Meredith and Eli each have what the other wants. This means that Meredith can give her ETH to Eli directly, and he can give his DAI to her in return as a peer-to-peer trade that does not need to go through a liquidity pool. In this way, Meredith can have her trade fully filled without having to ever use on-chain liquidity! This saves on liquidity provider fees and gas costs, avoids slippage, and prevents MEV attacks.

2-how-to-have-a-cow.webp

So Meredith walks away with $1,000 of Eli’s DAI, and she gives him her 0.5 ETH.

You’ll notice here that Eli is seeking $1,500 DAI — which is $500 more than what Meredith gave him. In this case, assuming there is no one else in Eli’s batch who can do a second CoW trade with him, Eli’s trade will have to be routed to an on-chain liquidity pool through a service like Uniswap or Balancer in order to fill the remainder of his trade.

CoW Swap automatically matches Coincidences of Wants and routes unfilled orders through the most optimal on-chain liquidity. CoWs are possible due to CoW Swap’s delegated trading model that uses solvers to execute your trades through the most optimal trading path.

The Benefits of CoWs

CoWs do a lot: they protect you from MEV, and you save on all kinds of fees including liquidity provider fees, gas fees, and slippage …all with no methane released into the atmosphere ;)

Lower Fees

The main advantage of CoWs is that they bypass liquidity provider fees and save on gas fees, meaning you get a better price for your trades. When you’re swapping an asset directly with another trader, you are not tapping into on-chain liquidity from a protocol like Uniswap, so you do not have to pay their LP fees and your peer-to-peer trade costs less in gas than interacting with smart contracts. Additionally, certain types of CoWs bundle orders together in order to send them to an on-chain liquidity source, meaning that your gas is also cheaper.

On CoW Swap, these savings get passed on to you in the form of lower prices for your trades!

MEV Protection

MEV, or “maximally extractable value” is a hidden tax on Ethereum trades that can result in failed transactions and unfavorable prices. Any time you submit a transaction to the blockchain, it may get re-ordered and hijacked by opportunistic traders looking to make a buck off your alpha (learn more about how CoW Swap solves MEV here).

CoWs protect you from MEV because they are peer-to-peer swaps that don’t rely on on-chain liquidity. This means that there are no opportunities for your trade to get hijacked, since you’re interacting with another trader, rather than going through a liquidity pool. In other words, CoWs make transaction ordering irrelevant when interacting with AMMs as they are simple, peer-to-peer trades among traders themselves.

Less Price Impact

Price impact is a major concern for large trades or for assets with relatively low liquidity. Whenever a trade impacts a liquidity pool enough to change the prices of the assets in the pool, it causes a “price impact”.

If you attempt to purchase $5,000 worth of BNB tokens, for example, but there isn’t enough liquidity to fill your entire order at a fixed market price, you may experience a price impact that causes you to get $4,950 worth of BNB tokens for the $5,000 that you pay.

CoWs alleviate price impact for large trades. If part of your trade is matched peer-to-peer with another trade, you will need to use less on-chain liquidity, thus reducing the impact that your trade will have on asset prices.

Types of CoWs

CoWs are possible thanks to CoW Swap’s delegated trading model. On CoW Swap, users sign an “intent to trade” message, rather than submitting a transaction, when initiating a trade. This signed message allows for all sorts of order optimizations including CoWs, price improvements, gas optimizations, and much more that’s not possible when directly submitting transactions.

There are several different types of CoWs, each with varying complexity and levels of price savings.

Simple CoW

3-benefits-of-cow.webp

The example of Meredith and Eli at the beginning of this article is an instance of a simple CoW. In a simple CoW, two traders that each have an asset the other wants come together to execute a peer-to-peer swap.

In contrast, on Uniswap this trade would require using a liquidity pool:

4-benefits-of-cow.webp

Batching CoW

5-benefits-of-cow.webp

Another type of CoW is the “batching” CoW trade that occurs whenever two traders are trading the same asset. For example, if two traders are looking to buy ETH in exchange for USDC, CoW Swap batches their trade together and executes a single on-chain transaction from a liquidity pool like Uniswap for the combined amount of ETH for both trades.

This saves on fees since, instead of having to execute the transactions individually and spend gas twice, the protocol batches the trades together into a single transaction, reducing the overall gas cost.

Here is what this trade would look like on a traditional liquidity pool through Uniswap. As you can see, there is a redundancy that’s saved when trading on CoW Swap.

6-benefits-of-cow.webp

Intermediate CoW

7-benefits-of-cow.webp

CoW Swap’s delegated trading model allows for gas optimizations through “intermediate CoWs.”

An intermediate CoW is similar to a simple CoW, but with the caveat that it is not a perfect A-B and B-A settlement. This type of CoW uses intermediate “hops” that both trades have to do in order to complete.

For example, in order to exchange COW for USDT, your trade might first have to go COW to ETH and then ETH to USDT. If, at the same time, another trader is trading USDT for CRV, they will go through the opposite trading route: USDT to ETH and then ETH to CRV. In both cases, there is an opportunity for a Coincidence of Wants in the intermediate leg (ETH to USDT and USDT to ETH).

Here is what this trade would look like on a traditional liquidity pool through Uniswap.

8-benefits-of-cow.webp

Multidimensional CoW, AKA a “Ring Trade”

In some batches, there are multiple orders which can all combine together in multiple Coincidences of Wants. In fact, one of the most interesting use cases of CoWs is what’s known as a “ring trade”. Ring trades enable a true barter-economy style of swapping. Traders can swap unrelated assets without relying on external liquidity.

Let’s take a look at an example of a Ring Trade:

9-benefits-of-cow.webp

In the above scenario, we have four parties:

  • Eli
  • Edith
  • Lily
  • Chow

Trading four assets

  • ETH
  • USDT
  • COW
  • DAI

As you can see, each party wants to swap one of their assets for one of the others in the batch. In this case, however, there is no “perfect” Coincidence of Wants — where one party has exactly what the other party needs — instead, we can get everyone what they want by trading around the “ring”.

Eli wants to trade his ETH for DAI. He sends his ETH to Edith, who gives her USDT to Lily who gives her COW to Chow, and finally, Chow gives his DAI to Eli. In this way, Eli’s trade is filled by going through a three-party Coincidence of Wants ring trade. This logic holds for the other three participants as well:

  1. Edith gets her ETH from Eli, even though she has no DAI (the asset he really wants) to give him in return
  2. Lily trades COW for USDT using Chow, Eli, and Edit as proxies
  3. Chow does the same thing for his DAI to COW trade

Ring trades are a powerful use-case of CoWs that can occur whenever a batch of orders gets large enough.

On Uniswap, this trade would be much more complicated (and expensive!)

10-benefits-of-cow.webp

CoWs: Your Ticket to Better Prices

CoW Swap turns economic theory into reality by utilizing CoWs (Coincidences of Wants) to optimize prices and enable safer trades.

The protocol relies on Order Flow Auctions which allow users to sign composable intents to trade rather than committing to a specific transaction. Through intents, solvers can use multiple sources of liquidity, compose trades together, and perform all sorts of optimizations. This is what makes CoWs possible!

Give CoWs a shot by using CoW Swap for your next trade. Happy trading!