How to munch on pickles from a whale dinner

TL;DR: Front-running bots are actively monitoring the Ethereum mempool and are fighting for arbitrage opportunities at a scale that we never imagined. This is an analysis of how two bots earned 13,140.04 USD and 7,074.23 USD in a single block, piggybacking a Whale’s huge PICKLE / USDC swap, and how two more bots abandoned their attempts along the way.

Remora fish feeding on a whale

After reading the eye-opening “Ethereum is a Dark Forest” article we started to think about other potential front-running scenarios.

We considered the following case:

  • any huge AMM swap inevitably moves the price according to the AMM’s curve equation; and as a result
  • this creates a “sandwich arbitrage” opportunity, where somebody can buy right before and sell right after such a swap transaction.

We wanted to check whether this actually happens in the real world. This is what we found after a few minutes of data wrangling with EthTx.info and Token Flow Insights (our new product that we are cooking in the Maker kitchen).

This is a story of block 10882755 / 17–09–2020 23:43:19 UTC.

One of the very active yield farmers buys 25,917 PICKLE for 580,286 USDC on Uniswap: transaction trace

The transaction seems to have been placed with the Uniswap UI and with a pretty high gas price (900 Gwei — almost twice the average at this moment). Well, if your trade is worth half a million dollars, you would not want to get stuck :)

But creatures of the Black Forest do not sleep.

Immediately four bots notice this swap transaction in the mempool and start to fight for the profit.

Two of them manage to earn 13,140.04 and 7,074.23 dollars in a single block. Two failed, losing 376.79 and 291.37 USD in gas fees.

Block transactions view on Etherscan.io

The first bot places a 1,606 PICKLEs buy transaction at position 82 in the block (the first position available after 81 internal Ethermine profit distribution transfers). This front-runs everybody, because of the incredibly high gas price set by the bot operator: 31,705 Gwei is still considered a LOT (let’s hope it will not be the new normal) and resulted in a transaction fee of 1.9246 ETH: transaction trace

But wait… at position 83 another bot tries to do the same but steps back after checking pool reserves, probably deciding that it is too risky (and thus losing 0.9673 ETH in gas fees): transaction trace

Another bot tries to catch the train at position 84. But for some reasons it also reverts, losing 0.7480 ETH in gas fees: transaction trace

The fourth bot is more lucky. It manages to buy 3,421.61 PICKLEs just before the huge swap which is waiting for its turn. The gas price for this transaction was set to 17,143 Gwei giving a transaction fee of 1.5618 ETH: transaction trace

Finally at position 89 the swap that caused the whole rush finally happens and instantly increases the PICKLE price.

Now it’s time for the bots to realize their profits.

At position 106 the bot that bought 1,606 PICKLEs for 79.96 ETH sells them with a 20.19 ETH gain (transaction trace). And at position 116 second bot sells its 3,421 PICKLEs enjoying 35,39 ETH gain (transaction trace).

But that is not all. There were at least two other transactions in this block that probably were duplicates of those successful sell swaps, sent to ensure that the arbitrage will be realized (transaction 1 and transaction 2). They cost an additional 0.0242 ETH and 0.0253 ETH respectively to the profit-realizing bots.

So here are the final numbers:

These front-running transactions that can now be seen in the blockchain data were the results of a mempool race. For example the first bot initially set the gas price at 1,687 Gwei then increased it to 24,830 Gwei, then to 31,705 Gwei and finally even to 40,484 Gwei (but this final speed-up was never mined).

What turned out to be a massive profit for bots operators is a huge loss for the rest of the Ethereum community that has to deal with massive gas prices for their regular transactions.

The game is changing and Ethereum is a wild jungle today — can we make it a safer place ?

Thanks to @bkiepuszewski for his inspiration and help.
And “chapeau bas” to the anonymous creators of these crazy predators.

If you want to hear more about EthTx.info or Token Flow Insights we’d love to hear from you — you can reach out to arran@makerdao.com.

--

--

--

Token Flow Insights provides analytics and commentary on the DeFi ecosystem

Recommended from Medium

CryptoMERZ: #NFT, #AI, and #ART

The Next Big Blockchain? How ParallelChain® (XPLL) Achieved What Its Predecessors Could Not

CRYPTOPUNT: REVOLUTIONIZING BLOCKCHAIN GAMING AND GAMBLING

Knit Finance AMA Recap with the Razor Network Community

Bank of Thailand Warns Businesses Over Accepting Digital Assets

A Study Found Bitcoin is Controlled by a Small Group of Whales

Bitcoin, cryptocurrency, DeFi, Blockchain, Conspiracy, Proof, Evidence, Origin Myth, Money, Money Moves, Money Matters, Whales

Florida’s Untapped Voting Bloc: Blockchain/Crypto Enthusiasts

[Ragnarok Sarah Server] YMIR Coin

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Tomasz Mierzwa

Tomasz Mierzwa

Data Lead @ MakerDAO, Token Flow architect, EthTx.info creator, DeFi enthusiast and private pilot.

More from Medium

What is Cake Defi?

Monitoring USDC depegging risk with this software I wrote

Getting Started in DeFi

DYDX: Perpetual Trading With Your Own Keys