An “unlucky” Maximum Extractable Value (MEV) bot took out a staggering $12 million flash loan but ended up only making $20 from its exploits, just enough to buy an actual sandwich. 

In a Sept. 5 post to X, blockchain analytics platform Arkham Intelligence shared that the MEV bot took out a $11.97 million loan in Wrapped Ether (WETH) to “sandwich” a user trying to swap around $5,000 worth of Shuffle (SHFL) tokens. 

Source: Arkham Intelligence

According to Arkham data, the MEV bot undertook a total of 14 transactions across the duration of its sandwich attack, lending, borrowing, and returning around $700,000 in USDC (USDC) and WETH loans across DeFi protocols Aave and Uniswap.

However, when the MEV attack was over and gas fees had been paid, the bot netted itself just over $20 in profit. 

The entire attack took place across 14 transactions. Source: Arkham Intelligence

According to data from Etherscan, the entire transaction was confirmed in a single block, meaning that the MEV bot executed all of the transactions within a span of around 12 seconds. 

How a sandwich attack works 

A sandwich attack occurs when an attacker “sandwiches” a victim’s transaction between their own two transactions to manipulate the price and profit from the user.

This is possible because the victim’s transaction is first sent to the mempool where it waits to be added to the next block. In the meantime, the attacker sets one transaction with a high gas fee — to ensure it is accepted first — and another transaction with a lower gas fee to ensure it is accepted after the victim's transaction.

The attacker profits by buying the victim’s token at a price cheaper than market value and then sells it within the same block — taking in the difference between the revenue from the transaction minus the gas fees.

While this particular MEV bot failed to turn a profit, MEV bots have been extremely profitable avenues for their operators in the past.

In April 2023, the infamous MEV bot operator jaredfromsubway cashed in well over $1 million in a single week by executing a spate of sandwich attacks on buyers and sellers of two memecoins PEPE and WOJAK.

The bot’s name is a tongue-in-cheek nod to the popular sandwich chain Subway and its former spokesperson Jared Fogle.

Magazine: How crypto bots are ruining crypto — including auto memecoin rug pulls