How To Protect Yourself From MEV And Get Paid For It

How To Protect Yourself From MEV And Get Paid For It

On-chain trading is risky.

Not if you use our trading product - the Hiding Game - because in that case, your trades will be MEV resistant, you'll pay no network fees (gas), and we'll capture and reshare any available arbitrage profits with you, resulting in price improvement on your order (you'll get paid a bonus in ROOK on every trade).

But for the non-enlightened DeFi traders, it is risky out there.

This year, on Ethereum alone, DeFi traders have been exploited out of more than $600 million of their own money due to not being protected from nefarious bots on their exchanges of choice.

Sometimes, it only costs them a little bit. Sometimes, it costs them a lot more:

Welcome to the dark forest of the public mempool.

Maximum extractable value, or MEV, is the measure of the profit that a miner is able to capture through including, excluding, or reordering transactions within a block. In plain English, bots can influence miners to change the order in which unprocessed transactions will be processed in a block, and make obscene amount of profits from doing so, at the expense of the user and the protocol.

That's not what we want and that's what we're here to fix. And not just fix, but to actively leverage these blockchain inefficiencies to our benefit, resulting in price improvement (or: profit resharing) for our users and profit for our Keepers. That is what our trading product -- the Hiding Game -- is here to help you with.

The MEV Problem

MEV is commonly created via DEX arbitrage, liquidations, and sandwich trading. It is so prevalent that you may not even be aware that it has affected you.

The most common culprits of MEV victimization are market orders on DEXs, as even the best aggregators can not overcome all of the MEV opportunities created by transaction routing and DeFi's fragmented liquidity problem.

DeFi traders must be aware of potential risks they face and how to best protect their trades to ensure they are not creating MEV opportunities that negatively affect their bottom line.

Let’s look at some examples of exploitable transactions that DeFi traders will encounter:

Sandwich Attack

This trade on 1inch saw a searcher first identify a trader's order to swap 6.44 ETH for 135.075 ROOK in the mempool. The searcher was then able to spend 4.93 ETH on 105.53 ROOK, a price over $3 per ROOK cheaper than the order, before immediately selling the 105.53 ROOK for 5.02 ETH, netting them .09 ETH.

Sandwiching is a common situation that occurs when a searcher identifies a large trade in the mempool that will cause an impact on the price of an asset. The searcher buys or sells a calculated amount directly prior to the large trade being executed and then immediately exits their position after the large order has taken place, banking a nice profit.

The main theme of sandwich attacks is slippage caused by available liquidity in the pool. As users, ensuring the slippage setting is set within appropriate risk limits is tedious, but by ignoring it, market orders have an increased risk of creating juicy MEV.

Too much slippage

On Paraswap, for example, the default slippage is set to 3% for any buy or sell. If this isn't adjusted by the user before executing an order, it becomes easy to either overpay for an asset or sell them too cheaply. As a result of high slippage, this sell of 192 ROOK at $146.73 fell significantly below the market value, costing the seller around 0.17 ETH.

Many traders would simply assume that these risks are just a part of DeFi. However, we believe that not only should all trades be resistant to slippage issues, but if there are any on-chain arbitrage profits available to be captured, we do so and return a fair share of these profits back to the user.

Enter the Hiding Game

The Hiding Game, KeeperDAO’s proprietary trading application, operates as a decentralized liquidity aggregator. Our application allows users to place limit orders on a large range of whitelisted tokens, free of gas and protected from predatory MEV bots.

The Hiding Game is built around the premise that executing orders through a network of Keepers, who are able to source liquidity from market makers, DEXs, CEXs, and OTC will be able to outperform user-settled AMM calls, whether executed through an aggregator or not.

When submitting limit orders on the Hiding Game, Keepers do not retain any of the user's value, as the order is filled at the exact price and quantity the user sets with no slippage, gas, or fees. Additionally, in return for providing the Keepers with order flow, the user is then rewarded with ROOK tokens based on the amount of MEV captured by the Keeper. That's right, the Keepers not only play defense protecting your order, they then use the order to go on offense and share the profits with the user.

Here's how it works:

source: KeeperDAO

MEV Protection

When an order is executed on the Hiding Game, the MEV earned by the Keeper is distributed pro rata back to the user in the form of ROOK tokens, serving as a form of MEV mitigation. This allows for a sustainable process where Keepers are continuing to generate profit for themselves through MEV, while not affecting the trader’s bottom line.

Unlike other MEV protection protocols, the Hiding Game does not rely on bribing miners. By taking profit away from miners and not holding priority gas auctions, Keepers are able to capture a greater amount of MEV resulting in efficient trades where both the users and the Keepers earn more profit.

source: KeeperDAO

MEV Cash Back

To date, our users have been paid back over $40 million USD in rewards.

source: https://dune.xyz/queries/133385/267910

Additionally, it has resulted in over $1.5 million USD in gas savings.

source: https://dune.xyz/queries/134450/264872

Sources of Liquidity

While KeeperDAO has amassed a large pool of ETH, WETH, USDC, renBTC, and DAI (see below), our internal liquidity is not the only source the Hiding Game uses to fill transactions.

source: https://app.keeperdao.com/pool

In fact, KeeperDAO sources liquidity from all major CeFi and DeFi liquidity sources.

source: KeeperDAO

Keepers are able to fulfill certain types of orders more efficiently than other entities, such as automated market makers (AMMs). These orders include any reasonably sized trade (over $2,000) between:

Ethereum, Bitcoin derivatives, and stablecoins
Trades between Ethereum, Bitcoin derivatives, and ERC-20 tokens
Trades between any combination of ERC-20 tokens

AMMs trade digital assets in a permissionless and automatic way by using liquidity pools rather than a traditional market of buyers and sellers, but are limited to on-chain transactions. Keepers are not limited to any single type of trade and therefore work as a type of meta-aggregator, utilizing whatever liquidity source best fits the transaction. This includes routing arbitrages through the Hiding Book, which bots outside of KeeperDAO do not have access to.

And the cool thing about the Hiding Game is, once we've added a token, you can trade it against any other token we have whitelisted.

From what we have seen through experience, Keepers are going to be more efficient for the user than user-settled AMM calls, aggregator or no.

Limit Orders

What the examples above have in common is that they are all market orders. While having the benefit of immediate execution, market orders have inherent flaws that get exploited by searchers due to the depth of liquidity for a given token varying by the exchange. Limit orders, however, ensure a user is getting the price they want when buying or selling an asset, there is no need to worry about slippage.

When a limit order is placed, the price at which the order is placed is known as the limit price. The limit price is the worst price the trader is willing to execute the trade at, the order will only be filled at this price or better.

When a limit order is placed, Keepers search through liquidity sources to see if it can be matched to an existing order. If the order cannot be immediately matched, it is added to the order books as a resting order, where it remains until it is either filled and executed or expires. The length of time an order remains active is determined by the user prior to submission.

The limit orders offered by the Hiding Game can be a powerful tool in the hands of an experienced user and several strategies can be employed.

Strategy 1: Capturing Volatility

Limit orders can serve as an effective method of capturing the volatility of an asset. Orders can be set at prices significantly higher or lower than the current price while being monitored and adjusted. In the case of price wicks in either direction, orders will be executed, resulting in potentially strong entry positions.

Strategy 2: Martingale Strategy

A Martingale strategy can be employed to effectively acquire positions in an asset at different prices during a trending market. Orders are broken up into several smaller orders and laddered, either above or below, the market price, with the volume of the order increasing further from the current price.

If the price trend continues, the user is able to dollar-cost average (DCA) into a position without having to worry about sniping the bottom of the market, or ladder sell orders to exit their position.

Using the Hiding Game

The Hiding Game is the most effective way to place limit orders and offers a number of benefits not offered by other protocols. Not only are all trades gasless, but users also receive a portion of the MEV captured through their trades back as rewards in the form of ROOK tokens.

The Hiding Game is currently managed by a Keeper run by the KeeperDAO team which fills limit orders and sources liquidity from all major DEX protocols. Executing trades through Keepers brings the advantage of fulfilling certain types of orders for efficiently than (A)MMs as they act as a sort of meta-aggregator and we fundamentally believe that Keepers are going to be more efficient for the user than user-settled AMM calls, aggregators or not.

Let’s take a look at how to place an order, and have it executed, on the Hiding Game.

Connecting your Wallet

Upon entering the KeeperDAO app, the first step is to connect your wallet to the application. Click “Connect Wallet” in the top right corner of the screen and select your preferred wallet. You will then be prompted to allow the site to connect to your account. Click “Connect” to accept.

Selecting the Assets

Once your wallet is connected, you are ready to select the assets you wish to trade. The application will automatically search your wallet for approved tokens and list them via the dropdown box. Select the asset you wish to send.

Next, set the asset that you wish to receive. The searchable dropdown box will list all supported tokens. Note that when sending ETH, the only available option will be to receive WETH, as only WETH can be traded for other ERC-20 tokens.

If the asset you wish to receive is not currently listed, please join the KeeperDAO Discord server and let us know you would like it to be added!

Setting the Expiration Period

As limit orders require price conditions to be hit in order to fill, you must decide how long you would like to keep an order active. The default setting is for 1 hour, however, you may adjust the period to anywhere from mere minutes to several days or weeks.

Users should be aware that there is a gas fee associated with canceling active orders and should be careful when placing orders with excessive lengths.

Placing the Order

Enter the amount of the asset you wish to send in the top section. You will see a corresponding amount populated in the bottom section based on the price shown in the middle section. You can adjust the price to your preferred threshold, which will impact the speed at which your order gets filled. Once you are satisfied with the price and the amounts of assets you are sending and receiving, click on "Review Order". If the summary of your order in the pop-up modal is satisfactory, click on "Submit Order" and sign the transaction in MetaMask.

How to get your order filled

The Hiding Game prioritizes trades that generate MEV, and as a result, profit. Therefore, there are a couple of things to keep in mind when placing limit orders to have them effectively executed.

Typically, smaller orders will have a difficult time being processed, as Keepers are unable to profit enough from these trades to make it worthwhile for them to execute. It is generally suggested to use amounts greater than $2,000 when placing orders on the Hiding Game.

As orders are executed when the Keeper finds a profitable trade, users can also place their order so that it is an easy arbitrage opportunity. By offering to swap an asset at below market value, the trade suddenly looks very attractive to Keepers and is likely to be processed. The discount on the trade is then offset by ROOK rewarded back to the user.

Earn ROOK by Trading on the App

When an order is filled on the Hiding Game, users are rewarded with ROOK tokens, which offset any losses incurred by trading at below-market prices and act as a form of MEV protection.

Each time a user’s order is filled, it generates profit for the Keeper, generally in the form of arbitrages. At the end of roughly every 24 hours, known as an epoch, these profits are tallied up and ROOK is distributed proportionally to the amount of profit contributed. This means it can take some time for you to see the ROOK rewards your trade has generated.

Claiming ROOK Rewards

At the end of each epoch, ROOK rewards can be claimed directly from the app. Click your address in the top right corner of the app to view your wallet. The amount of ROOK available to be claimed will be displayed, simply click “Claim ROOK” and execute the transaction to receive your rewards.

The claiming of ROOK rewards does require gas, so it is recommended that a user either wait until gas prices are sufficiently low or the amount of ROOK to be claimed is high enough that the fee is acceptable.

Using the Hiding Game to Earn More ROOK

As described above, ROOK is earned when your Hiding Game order is filled. But how can you maximize your ROOK return? Let's look at a few commonly used strategies:

Strategy 1: Market Makers/Two-sided bidding - Traders that actively quote two-sided markets in a particular token, providing bids and offers. Traders will analyze the spread (difference between the bid price and the offer price) and conduct profitable orders arbitrage opportunities created by the spread.

The Hiding Game is uniquely beneficial for market makers because 1) it's a single integration that gives them access to all the liquidity in CeFi and DeFi, and 2) it also allows them to capture the spread plus the MEV, resulting in more profits and a backstop to any losing trades.

Strategy 2: Intentional Arbitrage - Traders can intentionally under-bid or over-bid the price of an asset to create larger amounts of arbitrage. For example, this trader on the Hiding Game intentionally overpaid for VSP by roughly 100% with their wETH:

source: Zerion

This created about $6,000 of arbitrage profit for KeeperDAO's Hiding Game bot and allowed the trader to earn ROOK on that large sum of arbitrage.

Why are these strategies used?

Smart traders have identified that their trade-offs - taking intentional losses on assets, overpaying for others, having to factor our Keeper Bot's profit margin into their bids- do not surpass the benefit of acquiring more ROOK.

Hypothetical rationalizations for deploying the strategies above:

The trader believes they are acquiring ROOK below current market costs
The trader believes acquiring ROOK via Hiding Game rewards more than offsets the cost of conducting their business elsewhere
The trader believes the ROOK will appreciate in value and is acquiring ROOK for a long-term hold

So if you're tired of paying for expensive network fees, want to protect yourself from MEV bots, and want your fair share of on-chain profits, start trading on the Hiding Game today!