How MEV Bots Work (everything you’ve ever wanted to know)

Merunas Grincalaitis
8 min readFeb 2, 2024

You’ve heard about MEV on social media, people making millions of dollars per month with automated programs that do all the work for them while they sit and collect profits in crypto.

Sounds too good to be true? It’s not. There are MEV bots right now making millions of dollars per month in profits.

However on the other hand there are many scammers that take advantage of this information and pretend to have such bots just to steal your money.

This is not one of those scammer posts. I have years of experience working with MEV bots and today I’ll explain to you the 3 major types of MEV bots and how they work, so hopefully you have a better understanding of this exciting industry and maybe even build your own bots.

3 major types of MEV bots

There are 3 major types of MEV bots, those are:

  • Arbitrage bots
  • Sandwich bots
  • Liquidation bots

There are other specialized categories but those won’t be covered here. So how do those MEV bots work?

To understand that, you have to understand how Ethereum works. In the Ethereum blockchain there is something called the mempool.

When you send a transaction, say transfer 10 ether to your friend John, that transaction is not processed immediately. It is sent to the mempool, a place where all the transactions are sent.

There, your transaction will be sorted and included in the next available block based on demand. The more demand, meaning the more people making transactions the more time it will take to include your transaction.

The problem with the mempool is that everybody can see your transaction before it is confirmed and added to a block.

Why is that important? It’s important because with MEV you’re able to send private transactions that protect you from the public mempool.

They have a separate pool that is hidden where your transaction goes.

Not only that, with tools like Flashbots you’re able to take someone else's transaction from the public mempool and put your own transaction before or right after theirs. This is key for MEV bots.

I know it sounds confusing but it will make sense later on.

So let’s start with understanding how Arbitrage MEV bots work:

Arbitrage Bots

These are the most popular type of MEV bots. The way arbitrage bots make money is by buying a token in an exchange like Uniswap and selling at another like Sushiswap where there’s a price difference while you keep some.

Let me repeat that, you buy a token at one place cheap and you sell it for a profit at another exchange where that same token is worth more.

  • Say you can buy 100 tokens $ABC for 1.01 ether at Uniswap.
  • At the same time, you can sell 100 $ABC tokens for 1.05 ether at Sushiswap.
  • You would go to uniswap, buy those tokens and then go to sushiswap to sell those tokens and keep the profit, considering all gas costs.

That’s pretty much how arbitrage bots work. You can repeat the process with more complex strategies where you buy other tokens, where you buy at once place, sell it at another for an intermediary token and then sell the intermediary token for ether.

The complexities of arbitrage bots are unlimited. I’ve seen arbitrage bots buying tokens with ether, then buy an intermediary token for tether and selling those tether for the initial token that is then sold for ether.

In other words, you can create complex strategies to take advantage of opportunities that aren’t taken by other bots.

Arbitrage bots are essential in trading. They make sure the price of tokens are the same at every exchange and are rewarded for doing so.

Let’s now see how sandwich bots work (my favorite type of MEV bots):

Sandwich Bots

Sandwich bots are the ones that buy before someone else and sell right after that person.

To understand sandwich bot you need to understand 2 concepts:

  • Slippage
  • MEV bundles

Slippage is a hard concept to understand, so make sure to re-read this section. If you go to uniswap right now and select a token to buy, you’ll be able to setup the maximum slippage.

It usually is 0.1% or 1%. What does that mean?

Slippage is another way of saying “I’m willing to accept 1% less than the initial price I set”

Say you want to buy 100 $MEVDAO tokens. During the time you send the transaction and until it is confirmed, many other people may buy the token.

Ethereum is interacted by millions of people everyday. Whenever someone buys the token $MEVDAO, the price is moved so instead of getting 100 tokens for 1 ether, you now get 90 tokens for 1 ether.

The token got more expensive because the demand increased, the supply was reduced the moment someone bought it.

So when you send a transaction and until it is confirmed other people will buy that same token you want. Why is this a problem?

Because now instead of receiving 100 tokens for 1 ether you get 90 tokens for 1 ether before your transaction is confirmed. That is a slippage of 10%.

So if your settings allow a slippage of 10%, then your transaction will be executed correctly, but if you allow a slippage of 5% your transaction will not be executed, it will be rejected because you don’t want a worse price.

Why is slippage important then?

Because sandwich bots take advantage of this important concept. Sandwich bots are able to see what swaps people want to make by reading the mempool.

Then a sandwich bot calculates how much the bot has to buy to move the price so that John gets exactly the slippage or the minimum amount out.

So if John wants 100 tokens but has a slippage of 5%, then he’s okay with receiving 95 tokens.

Sandwich bots are so smart that they know exactly how much to buy of that token so that John gets exactly 95 tokens.

The process goes like this:

  • Sandwich bot buys (frontruns)
  • John buys
  • Sandwich bot sells (backruns)

As you can see, after the bot buys and after John buys the sandwich bot sells those tokens.

The bot doesn’t want those tokens, the bot wants Ether. So he’s swapping back those tokens for Ether while keeping the difference in profit.

Where does the profit come from?

It comes from the fact that John’s purchase made those tokens more expensive, meaning you get more ether for the same tokens. That’s where the profit comes from.

How is this possible?

All of this is possible because there’s a nice tool called MEV bundles.

MEV bundles are simply ordered, private transactions.

It’s a way of taking a public transaction from the mempool and put your transaction before or after it. You can put as many transaction as you want before or after.

So they allow sandwich bots to buy before John, then allow John to buy and then sell those tokens for a profit.

I know that was a lot. There are many new concepts you may not be familiar with, you probably have a million more questions about.

In any case, join my community at so we can help you join this exciting world of MEV.

With that said, let’s continue with the last type of MEV bot:

Liquidation MEV Bots

With the creation of lending platforms like aave finance and compound finance, a new way of making money became possible.

You see, those platforms are fully decentralized. People can take loans, lend money and repay loans without anybody’s permission.

There are many elements that make this possible. One of those elements that make decentralized lending possible is the use of collateral.

A collateral is just some money put aside that serves as a guarantee for a loan. When you borrow say 1000 USDT, you have to provide about 2000 dollars worth of Ether as collateral.

Those 2000 dollars worth of ETH are locked away and kept safely while you use those 1000 USDT for whatever purpose you want.

When you’re finished and ready to repay your loan, you give those 1000 USDT and get your 2000 ETH back.

This system works very well however there is 1 issue with it, and that is…

What happens if those 2000 dollars worth of ether drop in value?

Imagine you lock away 1 ether worth 2000 dollars at the time you get your loan. Let’s say you spend 30 days to repay your loan. During that time ether drops in value from 2000 to just 800 dollars.

Now your collateral is only worth 800 dollars because you locked away 1 ether. But you got a 1000 USDT loan. See the problem? You are getting more money than what you used as a guarantee.

Before that happens, lending platforms will detect that and see “ether value is dropping, this loan for 1000 tether is at risk, we have to close it to protect our lenders”

At that point liquidators come in. The loan becomes invalid because it’s risky and the platform doesn’t want to lose money.

Liquidators simply execute a function that sells that 1 ether used as collateral and repays those 1000 tether to the loan providers while giving some of the collateral to the liquidator that executed the function.

Liquidation MEV bots profit from closing loans.

They look for expired or risky loans that can be closed for a profit and execute those functions.

Liquidator MEV bots simply make money from closing bad loans.

There are many lending protocols and those bots profit by helping protect their ecosystem from people that don’t repay their loans or from collateral drops.

That’s about it! You now know how the major MEV bots work. Those bots are making almost billions of dollars per year (combined) in profit so the possibilities are endless.

You can take a piece of that huge pie. But getting started is not easy. Why not help yourself and shortcut your journey? Join us at where I’ll personally help you.

You can ask questions and get direction on how to proceed but don’t expect any free meals. You will have to put in the work. Spend many hours coding and researching strategies that make sense.

Anyway, hope this article was helpful and if you liked it subscribe to my email list here:

Let me know any questions you have in the comments. What’s your favorite type of MEV bot? Have you been scammed by fake bots in social media? What concern do you have with this type of technology?

Jesus Christ is the way to your salvation.