A trader decided to try out an experiment in exploitation as a cautionary tale to all decentralized finance (DeFi) entrants, gaining more than ETH 100 (USD 168,560) in profits from sandwich trading contracts.
“Sandwich trading is a lot of fun, but it’s not risk free,” said Nathan Worsley, founder and Chief Technology Officer of non-custodial marketplace LocalCoinSwap, pointing to a writeup of his “recent alpha discovery: “Salmonella”.”
Sandwich trading is a strategy by which somebody places a trade before – as well as after – a victim trade, so to exploit the resulting slippage, or the difference between the expected price of a trade and the price at which the trade is executed. “In layman’s terms, you see that someone will buy an asset, so you buy it first to artificially inflate the price, before selling afterwards at a profit,” said Worsley.
And there has been a shift recently, combined of two innovations that have made this strategy safer:
- a rise in miner-extractable value (MEV) services such as FlashBots which allow traders to create “sandwich bundles”, where either all 3 transactions execute, or none of them does, so traders wouldn’t be left with bags of worthless tokens,
- and a rise in miner trading teams, who mine the sandwich bundles directly into their blocks.
However, per Worsley, “nothing is risk-free on the blockchain, and exploitative trading strategies such as sandwich trading and front-running actually increase in risk the more the engineer attempts to generalize their ability to capture opportunities.”
just setting up my twttr
— jack (@jack)
Worsley decided to demonstrate “the risks of playing in the mempool,” via a new trading alpha he dubbed “Salmonella” – whereby the generalized nature of front-running setups is intentionally exploited. He added,
“The goal of sandwich trading is to exploit the slippage of unintended victims, so this strategy turns the tables on the exploiters.”
Ethereum mining pool Ethermine was chosen as the “initial target” as it was responsible for the bulk of sandwich trading, and Worsley then created his Salmonella contract – a regular ERC-20 token behaving normally in usual use cases, but having the ability to detect when traders other than the specified user is transacting it. At that point, it returns just 10% of the specified account, while showing event logs that match a trade of the full amount.
The creator then deployed his Salmonella contract, created a Uniswap pool with salmonella and ethereum, created a series of bait transactions looking like “juicy opportunities” to sandwich traders, and then enabled himself to swiftly cancel trades, change gas prices, and reset the trap Uniswap pool state.
Few hours later, says Worsley, he “scooped” more than ETH 68 from sandwich traders’ “bots attempts to wreck my bait,” followed by another ETH 35. But that wasn’t all, as Worsley said that,
“I casually had a browse of my Salmonella smart contract, only to find I had emptied about 17 other Sandwich trading contracts in the course of my experiment, for much smaller values than Ethermine of course.”
Worsley concluded that, while he continued the experiment for a couple of days, the traders eventually adjusted to detect the “poisonous tokens.”
Meanwhile, some commenters argued if mining pools announcing that they are going to extract MEV from users is “miners revenge on the community for 1559.”
Bitfly, the operator of Ethermine, announced last week ago that “in order to compensate the upcoming mining reward reduction caused by the adoption of EIP-1559 we have launched our MEV beta program.”
Ethereum Improvement Proposal (EIP) 1559 is a much-awaited one, expected to bring the automatic setting of fees and token burn mechanism for each transaction. It is set to be included in the London network upgrade, estimated in July this year. But a group of miners has been strongly opposed to it, with some announcing “a show of force” for April 1.