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.
- 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
- Next you can win by having the highest bid on the correct block
- Next you can win by front running anyone bidding on the correct block
- Next you can win by racing other front runners
- 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.
– You’ll get your chance at revenge though. Every hour a random address will be chosen to steal back from the hacker at a maximum of 1% of the total $NME in his wallet.— HalfRekt (@half_rekt) October 2, 2020
– Anyone can call the attack function and be rewarded with 10% of the amount stolen back from the hacker.
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.