7 months ago ·
5 min read
Over the past few years DeFi users have been victims of MEV attacks such as front/back running or sandwich attacks. The Cowswap team has developed an MEV protection protocol that has experienced huge growth over the past few months. It has already achieved over $5bn cumulative volume across their V2 contracts and it’s showing no signs of slowing down.
As transactions are broadcasted to the Blockchain by users they go into a public mempool. Miners have a holistic view over the transactions that are in the mempool and have the ability to arbitrarily include, exclude, or re-order transactions within the blocks they produce.This exposes any potential trades to attacks from miner extractable value (MEV) bots which aim to take advantage of this information by submitting their transaction prior or after a traders transaction in order to profit from it.
A front running bot works in a simple although very profitable way. An example of a front running bot can be seen below.
A trader places an order into the mempool.
The front running bot purchases the token for a given rate raising the value of the token.
The original transaction that was placed by the trader occurs further increasing the price of the token.
The MEV bot sells the token at a higher price, making a profit. This all happens in the same block.
In summary, MEV acts like an invisible tax that miners collect from users. There are lots of other reasons why MEV is harmful and considered one of the biggest challenges the Ethereum community needs to address.
CoW Protocol is a fully permission-less trading protocol that leverages so-called “Batch Auctions” as its price finding mechanism. CoW protocol enables batch auctions to maximize liquidity via Coincidence of Wants, CoW for short. The coincidence of wants is an economic phenomenon where two parties each hold an item the other wants, so they exchange these items directly without any monetary medium. Cowswap aims to find COW’s across its users to find the best price and protect them from MEV attacks.
CowSwap is the first trading interface built on top of CoW protocol. It guarantees users the best price by either:
Matching the user with a fitting sell order (CoW)
Routing the order to the best liquidity venue on-chain (Uniswap, Sushi etc.)
Effectively, Cowswap acts as Meta DEX aggregator.
Unlike traditional DEXs, CowSwap users don't execute their trades themselves. Instead of creating an executable transaction swapping token A for B, users sign a message which gives so-called solvers the permission to withdraw the specified funds within a specified timeframe in order to execute the most optimal trade for the user.
The term solver relates to anyone that submits an order settlement solution for a batch. Solvers aim to maximize traders' surplus by spotting the most optimal CoW, finding the best liquidity sources or combining both in a single settlement.
Since CoW protocol replaces a central operator by an open solvers competition for order matching, solvers play a vital role in finding the best settlement for each trade.Signatures are used so that you signal your intent to trade to the solvers. This means that once the user submits the trade there is a deadline by which the solver must find a path that gets the promised price for the trade in the allocated time. If no trade is found then no funds are taken out of the traders account and no fee is charged for the failed transaction! In addition to that, fees used for the transaction are paid in the token that you are trading, so no $ETH required to pay for the transaction.
Batch auctions work by placing orders off-chain and executing them in batches rather than settled immediately. Batch auctions help reduce MEV by matching orders together and settling a maximum amount of order internally thereby bypassing external markets. A trader using an AMM traditionally is vulnerable to MEV attacks, as miners can choose the order of the transactions that arrive to the liquidity pool. Additionally, batch auctions allow to enforce rules such as, all same token pairs in the same batch, must have the same uniform clearing price across trades.
One of the advantages of using batch auctions is that you can not only find Coincidence of Wants, but you can also create ring trades. Ring trades share liquidity across all orders, rather than a single token pair. This allows the protocol to dissect trades into pieces improving price for traders. For example, let's take 4 traders trying to exchange different token pairs. Alice is trying to sell DAI into OWL, Daniel is trying to sell OWL to USDC, and Bob & Carry are trying to sell USDC to DAI. Instead of routing all the trades through an AMM, Cowswap Protocol forms a ring matching the three different pairs directly amongst each other thereby getting better trades for all involved parties.
Overall, by leveraging Batch Auctions which are tailored for Coincidence of Wants, CoW Protocol is able to give better prices for trades because batching transactions results in a lower spread, as well as a much more optimized transaction management for the user.
To summarise the benefits of CoW Protocol are:
Fully permission-less Meta DEX Aggregator on which anyone can trade any tokens and build integrations;
Implementation of batch auctions promoting fair uniform clearing prices;
Trades are protected from different sorts of MEV such as front/back running or sandwich attacks;
Maximized liquidity and access to all on chain liquidity in one single place;
Best prices when COWs are found, or at least as good as the best DEX aggregator price if they aren't;
Many token pairs available for trading, off-chain order submission enables gas-less trading;
Fair, decentralized settlement in which an open competition for order matching replaces a central operator or a constant function market maker;
Tokenomics ensure that solvers are competing against each other to deliver the best order settlement solution for traders in exchange for the reward of each batch auction.
Cowswap team has set up phenomenal incentives for users to experience CoW Protocol. Users can participate in 80% gas fee reductions every Friday at barn.cowswap.exchange during their happy hour (check discord for exact time). The Cowmunity is amongst the most friendly and supportive communities in DeFi so if you have any doubts after reading this article, don’t hesitate to jump into their Discord and ask questions.
7 months ago ·
5 min read
We are a multi-faceted team of crypto enthusiasts based in Berlin.
© 2021 cryptotesters UG
Crypto wallet guide
Crypto savings accounts
Defi lending rates
Exclusive crypto deals