How to search for MEV opportunities

Ledger Nano X - The secure hardware wallet

In this tutorial we will discuss how to search for Miner/Maximum Extractable Value (MEV) opportunities on the blockchain. Then we will review the process of how to execute on these MEV opportunities to generate potential revenue.

Miner/Maximum Extractable Value (MEV) is a technique used by miners, users, bot operators, etc., to extract profits from the blockchain by arbitrarily reordering, including, or excluding transactions within a block.

MEV is difficult to measure because there are many different ways to extract value from different protocols on the blockchain. Miner/Maximum Extractable Value (MEV) exists on all layer 1 and layer 2 blockchains. For instance visit the Flash Bot explorer to view the amount of extracted MEV that Flash Bots has been measuring over time. The small amount of measured MEV is sky rocketing as awareness increases in the developer and miner cryptocurrency ecosystem.

What is an MEV Searcher?

Users that search for Miner/Maximum Extractable Value (MEV) opportunities on the blockchain are called Searchers. Searchers can be anyone that uses the blockchain looking to gain a profit by reordering, inserting or censoring transactions in a block. Some examples are:

To execute on MEV opportunities there are a few key skills and concepts a Searcher needs to possess. Searchers need to understand Ethereum transaction processing and smart contracts. In addition it is important for Searchers to have knowledge of Defi and a programming language (Python, Java Script, etc.). These skills are important because Searchers need the ability to extract information from and send transactions to the blockchain. It would also be helpful to know how Flash Bots works as it will allow one to send private transactions to the blockchain and reduce the risk of front running.

MEV Searcher Process

Searchers looking to capitalize on Miner/Maximum Extractable Value (MEV) opportunities follow a process similar to the one below. The information below will provide one with insight into how a process could work as every Searcher operates differently.

search for MEV opportunities process

Discover an MEV opportunity

Discovery is the process of searching for MEV opportunities on the blockchain. It is important to understand how different Defi protocols work. One needs to keep track of changes and enhancements that different development teams are making. These changes can provide clues into a service you can provide and a way to make money. With out a doubt discovery is the most difficult part of the process because most Searchers are not going to share ideas about how to extract value from the blockchain. A few areas to help with discovery are:

Understand the MEV opportunity

After you discover a potential opportunity you need to understand the process at a lower level. You need to read the systems documentation to understand how the protocol works. Then read the functions in the smart contract to understand how the application behaves. Focus on the features and function that are important to execute on your discovery. Identify the important inputs and outputs about your idea and how it can be monitored.

Determine how protocols are trying to prevent MEV

Furthermore most protocols do not want to enable Miner Extractable Value opportunities and are looking for ways to prevent theses exploits. To prevent MEV, blockchain developers working on application protocols are implementing better code and follow industry best practices. For example seasoned professionals know that block time stamp should not be used for randomness because a block time stamp can be manipulated. In addition contracts are audited to prevent exploits to their systems. For more information browse the section of this site that explains how smart contracts can get attacked. Some of these exploits are examples of MEV opportunities.

MEV competition

Also when searching for MEV on the blockchain consider your competition. Each protocol has seasoned participants helping provide a service to their customers. If there is a way to make easy money consider that they are participating in this process. No one is going to walk away from a money making opportunity. Unquestionably examine your strategy and determine how your program is better, faster and more advanced from the competitions.

Build monitoring and logging tools to prove your discovery

After you discover the opportunity and have a deep understanding of the functions required to execute your idea build some monitoring and logging tools to prove your idea works. Use your Web3 development skills to query the blockchain to determine if your theory is correct. Focus on data collection and log as much information as you can. Log relevant data points so you can reference past events to prove your idea. Keep this part of the process simple because you will probably go through multiple iterations of this to get your process right. Remember this process is trial and error to see what works and what does not work.

Design an execution strategy and smart contract

Subsequently, start to design and implement your execution strategy and smart contract. Determine what type of transactions you need to send to the blockchain. Determine how to design your smart contract so multiple transactions will execute atomically. Do you need a flash loan? If you implement a flash loan can you increase your potential profit? Without a doubt make sure your transaction processing is comprehensive.

Combine your monitoring process and execution strategy

Finally take your monitoring features and combine them with your execution strategy to determine if your MEV opportunity is profitable. Continue to tweak your process and reread the protocol contract to ensure all information is accurate. In particular try to remove all assumptions from the equation. Test your theory and continue to gather as much data as possible. The most efficient searchers will do as much processing off chain to reduce gas costs and increase profitability.

Run the process on Mainnet but do not send any transactions until your discovery is proven. Log your potential profit of loss and continue to tweak your process.

Once your process is Mainnet ready remove the unnecessary logging but keep what is important. To conclude Keep your code simple and extensible. Make your system fast, multi threaded and multi process if it improves performance.

Remember that MEV opportunities do not last long so it is important to iterate through this process in a timely manner.

Nodes

Furthermore learn how to run a Geth node. Read getting started with Geth to run an Ethereum node.

Next – Different MEV Opportunities

Ledger Nano X - The secure hardware wallet