How did a sandwich bot earn $1.5 million in just three days?

Param_eth
Coinmonks
Published in
3 min readApr 30, 2023

--

The entire story of the sandwich attack

MEV bot Transactions

MEV Bot

MEV Bot is an automated program encoded in a smart contract that uses arbitrage and sandwich attacks to execute trades on behalf of its users. By constantly analyzing various exchanges for price disparities, MEV Bot can detect prospects for arbitrage and automatically carry out trades.

In this blog, we will learn about sandwich bots.

Sandwich attack

Memepool

A sandwich MEV attack is a type of attack in which the attacker “sandwiches” the victim’s transaction between two other transactions during three consecutive transactions on the same token or block. The first two transactions are buy transactions, and the last one is a sell transaction. The attacker sends the first and last transactions. The attack begins with the attacker buying the token and pumping the price in the first transaction. The victim then buys the token, causing the price to pump even more in the second transaction. Finally, the attacker sells the token in the third transaction, earning a profit. This attack can be visualized as a three-step process where the attacker initiates the first and third transactions while the victim’s transaction is sandwiched in between.

For example, if Bob wants to buy 100 $MUSK tokens, he exchanges ETH for $MUSK tokens, and his transaction is pending on a mempool. However, Jared is aware that Bob conducted a transaction to purchase MUSK tokens. Jared purchased $MUSK tokens prior to the Bob transaction by paying a slightly higher gas fee than the Bob transaction.Bob received only 98 tokens after that transaction was completed. because the token’s value rises with Jared’s transaction. Following the bob transaction, the token’s price has risen. Jared then sold all of his tokens at a higher price and profited.

Profit: he sold all of his tokens—he bought tokens in the first transaction.

Jaredfromsubway.eth (MEV bot millionaire)

Jaredfromsubway.eth portfolio

It is an anonymous ENS account that is running a MEV bot.It gained popularity following the April 15 memecoin boom.At the time of writing, this bot was earning between $100 and $200 per day on average.

It sandwiched transactions from popular tokens such as PEPE, WOJAK, STONKS, BOB, MUSK, and so on.

How to Protect Yourself from Sandwich Attacks

You can avoid this attack by using Flashbot RPC. Metamask uses Infura RPC by default, which sends our transaction to the public mempool. However, we can avoid this by using custom RPCs for flashbots.

Setup

go to this link.

Click on "Connect wallet to protect.”

or you can do it manually by adding a new network to your metamask wallet.

Thank you, Web3 learners; I hope you found this blog useful.

Follow me on Twitter: Param_eth

--

--

Param_eth
Coinmonks

I help peoples learn web3 development through my blogs.