Last night someone used an *extremely* clever mechanism to take a hundred ETH from sandwich bots
Then a 2nd person jumped in and made 300 MORE ETH by exploiting other sandwich bots
Long thread on how 👇🏻
To understand how this happened you need to know a bit about Flashbots
You can think of Flashbots as a way for users to directly communicate their transaction ordering preferences to to miners via "bundles" of transactions
Instead of users paying transaction fees via gas prices, using Flashbots users pay fees via a smart contract call (block.coinbase.transfer) which transfers ETH to a miner
Here's a screenshot of a random arb that does this, note the 0 gas price & 0.075 ETH transfer to Spark Pool
Miners will receive bundles of transaction from users and include the bundle that pays them the most
Users love this because they only pay for transactions that are included and they can determine the fee that they are going to pay
🥪bots watch the mempool for users buying on DEXes and 🥪 them: running the price up before the victim buys and dumping after for a profit. Those 3 txs (buy, victim tx, sell) make up a bundle
Note the 🥪 sell tx contains the smart contract payment to the miner
It's important that payment goes to the miner on the sell transaction!
That should only happen after the bot has secured profit from selling the tokens bought in their frontrun
If that sell fails then there is no payment to the miner, and thus their bundle shouldn't be included
Last thing and we'll get to the fun part, I promise.
To be even more secure, bots will simulate their transactions on local infrastructure. Bots won't send transactions unless the simulation goes well.
(Flashbots also offers a tool to make that easy to do as well)
.@NathanWorsley_ inspired an army to try to bait 🥪bots w/ bad ERC20s after publishing his article on Salmonella
In short Salmonella is a token that transfers less if you're not the owner, so 🥪bots way overpaid and got REKT for 100 ETH github.com/Defi-Cartel/sa…
Paying transaction fees only on the sell transaction of a 🥪 should defend against this. If you don't make an ETH profit, then you won't pay!
AND 🥪 bots simulate to see if they get rekt before it happens
But two clever people found weaknesses among all of these defenses
The 1st defense to break was the simulation
That was done w/ an ERC20 transfer function that checked to see if the block was a mined by Flashbots' miners, & if so it transfers way less out. The code is my pseudo code btw
Local simulations will look fine but in prod 🥪s get rekt
The 2nd line of defense was the payment only on a sell transaction
Again: 🥪 bots make miner payment conditional on profit
That was broke by making the *ERC20 token* pay the miner (again my pseudo-code here)
So even with the 🥪 bot sell failing, the miner would still get paid!
Here's what actually happened in the wild
🥪 bot gets baited and buys 100 ETH of the poisonous token
Poisonous token owner's bait triggers custom transfer function, which pays 0.1 ETH to the miner
🥪 bot's sell doesn't work because of the poisonous token
Because the 🥪 bot submitted these three transactions in a bundle all three were included: the successful buy, the bait, and the failed sell.
The poisonous ERC20's payment via the custom transfer was what incentivized a miner to include it!
The first person to do this made about 100 ETH, I think. You can see the poisoned ERC20 Uniswap transactions here:
The owner of the first poisonous token noticed their victim was the latest predator on the block and they dropped a cryptographically signed note of respect in the Flashbots discord
So this one is interesting! A bot has been backrunning new token listings, effectively paying premium to miners to buy newly listed tokens before anyone else can
And a new token fought back yesterday, trapping the bot for $200k while benefiting from their buy. Here's how 👇🏻
For weeks this bot has been monitoring the Ethereum mempool for new pairs being created on Uniswap. If it finds one it the bot places a buy transaction immediately behind the initial liquidity. That way they can buy a new token before anyone else.
They've been paying miners huge amounts for the right to do this! You can see here a few of the top Flashbots bundles of all time are from this bot. In total they've paid 340 ETH to miners.
Side note: this is from a dashboard Flashbots is making public soon.
I think we're seeing the sunsetting of a golden age for global tech platforms. Countries won't accept SV exerting control, and will seek to regulate or replace the incumbents.
With the benefit of hindsight TikTok was just the opening shot for what is to come.
It will take a few years but there will be another golden age for global tech platforms as decentralized alternatives necessarily arise.
Although payments and the SWIFT network might be an instructive analogy. Other countries, including America's allies, have long bristled against the way the American state uses the financial system to exert power. But no one has broken away yet.