If you liked Salmonella you're gonna love this

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:

etherscan.io/token/0xe253a1…

One of their victims was one the most successful Flashbots bot operators, and they immediately sprung into action
In a short period of time the victim turned into an apex predator

They launching a similar but slightly different ERC20 ("YoloChain" 😂), and ended up successfully baiting many more sandwichers

They made 300 ETH doing so!

etherscan.io/token/0xc02aaa…
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

I loved this.

etherscan.io/verifySig/2503
In total I counted ~400 ETH as the bounty for our two enterprising bot baiters, but there might have been more poisonous tokens I didn't catch.

For now the carnage is over.

🥪 bot operators have noticed and updated their bots accordingly. A few were totally drained.
In the aftermath one bot operator ominously pointed out that 🥪-ing is never safe & said they'd leak the alpha once it was used.

The dark forest is a dangerous place.

As last night shows even those who think they are predators might turn out to be prey.
@hasufl @fifikobayashi @Fiskantes @twobitidiot @defiprime @bneiluj check out the insane sandwich bot baiting that took place last night above 👆🏻
If you found this interesting and want to learn more checkout Flashbots' Github

github.com/flashbots/pm

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Robert Miller

Robert Miller Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @bertcmiller

10 Apr
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.
Read 13 tweets
11 Jan
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.
Read 4 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!

Follow Us on Twitter!