Categories: CryptoTrading

MEV And The Evolution Of Frontrunning On Ethereum

The financial game Half-Rekt (NME) is a very interesting study for anyone interested in arbitrage or front running in the dark forest of Ethereum. It was structured in a way that we can watch the entire evolution in just one day.

Every hour there was a simple function that gave the first person to call it some money.

  1. To begin with there is no competition, you don’t need perfect timing and can win the arb manually even if on the wrong block
  2. Next you can win by having the highest bid on the correct block
  3. Next you can win by front running anyone bidding on the correct block
  4. Next you can win by racing other front runners
  5. And eventually, the race gets so competitive that everyone loses money

WARNING: DO NOT INVEST IN HALF-REKT. IT IS A FROZEN TOKEN AND YOU WILL LOSE ANYTHING YOU SPEND TO BUY IT.

Half-rekt was a financial game built on Ethereum. Anyone who lost money from the Eminence attack was given the newly created token which they could sell if they wanted. But every time they transferred it an ‘attacker‘ would steal 48%.

Then once an hour anyone could call a function that would take 1% of the ‘attacker’s‘ money and distribute it. Giving a portion to the caller of the function.

https://twitter.com/half_rekt/status/1312116240173789184?ref_src=twsrc%5Etfw

This is a pretty simple arbitrage situation. The first person to call the method exploitTheExploiter() every hour wins some money. And so every hour for that first day we saw this opportunity go through the complete evolution of front running.

Stage One – You can win manually

To begin with no-one knew about the opportunity and so there was no competition. The first few winners were just the first person to call the method. They weren’t smart contract experts and didn’t know how to choose the correct block. They just guessed and one person won.

Gas price didn’t matter, being on the correct block didn’t matter.

Here is the first winning transaction. A lot of profit and no competition.

Stage Two- Win the gas price auction

A gas auction is simple. Whoever offers to pay the highest gas wins (priced in gwei). You then pay this amount to the miner who mines the block.

At this point a lot of people have worked out how to get on the correct block but are not yet smart enough to track each other’s bids. We get a closed bid auction. The higher you bid the more likely you are to win, but the smaller your potential profits.

Notice that there is no correlation between bids. This is a blind auction where the competitors just chose a number and hope to win.

Stage Three- Only One Font Runner

A few hours later the game moves to the next stage. Now the winner is listening for everyone’s bid and then fractionally beating it.

The front runner saw the 500 gwei bid and beat it by the smallest possible margin, 1 wei.

Notice that there are only four arbers competing now. Most of the crowd from stage two have quit because they know they can’t beat the front runner.

Stage Four – Front Runners Race

A few hours later and now the front runners are racing each other. The way that nodes work is that each time you change your bid you must increase it by at least 10%. In the below screenshots the race started at 101 gwei and each front runner kept increasing their bid by about 10% each time until the block was mined.

Whoever was in front at that point won.

Stage Five – Everyone Loses Money

Eventually, the race gets so competitive that they race to suicide and even the winner loses money. The only winner at this point is the miners who collect the transaction fee.

Racing gets more competitive while coinciding with a crash in value of NME.

In stage 1 our unsophisticated arber made a cool $1k. By the final stage our very sophisticated arbers are all losing money.

Sam Priestley

Disqus Comments Loading...
Share
Published by
Sam Priestley

Recent Posts

  • About Me
  • Income Reports

My Monthly Report – October 2020

Another two months since my last report and a lot has changed once again. September was the most profitable month…

4 years ago
  • Crypto
  • Trading

The $15m Eminence Defi Attack Explained

Early morning on Tuesday 29 September an arber/hacker found an exploit with the brand new Eminence (EMN) system that allowed…

4 years ago
  • About Me
  • Income Reports

My Monthly Report – August 2020

Another two months since my last report and perhaps the two busiest and most profitable months in my life. Which…

4 years ago
  • Crypto
  • How-To
  • Trading

How Crypto Flashloans & Flashswaps Work

The coolest innovation in the past year in crypto and defi are flash loans. Flash loans allow you to borrow…

4 years ago
  • About Me
  • Income Reports

My Monthly Report – June 2020

It has been another two months since my last report and a lot of time has happened since then. The…

4 years ago
  • Crypto
  • How-To
  • Trading

The Birth Of Yield Farming – COMP & BAL Farming Explained

In March I launched a proprietary fund to trade on cryptocurrency believing that the opportunities I found as a professional…

4 years ago