In this post, Frontrunners and MEV Discussed, we look at the following headings: The Salmonella Agreement, Sniping, front-running, and MEV “Searchers”, Is the MEV Issue Serious?, Defeating Bots, fair sequencing and lots more.
A peek at just how “sandwich assaults” profit maximal extractable value (MEV) searchers. Also including how you can prevent them in future deals.
Block rewards & transactions costs are the 2 key sources of financing for miners (on Proof-of-Work chains) and nodes (on Proof-of-Stake chains) on most blockchain systems. However, with the recent introduction of decentralized finance (DeFi), a new revenue source has opened up. One that stems from the manner in which transactions are placed inside a newly mined/validated block.
Because miners/nodes have so much influence over transaction sequencing. They can take advantage of a variety of possibilities to increase revenues by strategically forming and arranging transactions.
This is how it goes.
What is the maximum amount of value that can be extracted?
Previously known as Miner Extractable Value, and sometimes abbreviated as MEV. For most circumstances, transactions are simply sorted by transaction fee, with the highest fee/byte transactions appearing first. And the cheapest fee transactions beyond the inclusion threshold appearing last to guarantee the block is filled. However, due to DeFi and, more particularly, decentralized exchanges (DEXs). It is possible to acquire transactions in such a way that a “sandwich assault” guarantees an added reward.
A single miner/node or a pool of miner/nodes scans the mempool for pending big DEX transactions. The ones that can be made to slide through with a sandwich attack.
What Is a MEV Attack and How It Works?
Assume that a trader (the target) needs to purchase X number of tokens A.
The miner/node will then initiate a transaction to purchase a significant quantity of token A from the liquidity pool (pushing up the price).
This would initiate a 2nd transaction, selling all of the tokens they had just purchased.
The victim’s transaction is trapped between these two. Allowing the miner to take value from the victim by adjusting the pool weight immediately just before payment.
Sniping, front-running, and MEV “Searchers”
Miners/nodes can also front-run in order to boost their returns. Whenever a miner finds a hugely viable transaction in the mempool, such as a flash loan or a large transaction from a well-known wallet (such as a hedge fund), it processes an identical transaction first, albeit at a higher fee. This would then be mined first, effectively stealing the victim’s alpha and gains. Snipping is another term for this technique.
Sandwich attacks and front-running can both be carried out by anyone with the means to survey the mempool and automatically create a value-extracting transaction — these clients are referred to as “searchers” in this situation.
Working as (or in collaboration with) a miner/node, on the other hand, can enable the completion of more complex operations, improve success rates, and even eliminate the need to outbid the victim on gas.
The introduction of Flashbot auctions, which are channels of communication that let miners and searchers to work with each other to execute MEV chances without disclosing chances to the mempool, has exacerbated this edge.
To enhance the likelihood of the transaction being picked up by the lucky miner/node, searchers frequently have to succumb to spamming the transaction to the network if they don’t cooperate with a miner.
Is the MEV Issue Serious?
According to Flashbots data, MEV on the Ethereum blockchain has secured a total of $7.4 million in the last 30 days. Ethereum presents by far the greatest potential for MEV due to its relatively long block times, hefty fees, and regular congestion. But it still has a very complete and famous DeFi ecosystem.
The overwhelming bulk of MEV events are linked with Uniswap V2 and Uniswap V3. In which miners generally use sandwich attacks to divert earnings from high volume traders. But platforms such as Compound and Aave also suffer from liquidation front-runners. By which liquidators can use front-running to discover and implement liquidation transactions. Safeguarding the liquidator fee (or a reduction on the collateral).
To put this in context, Ethereum miners presently make about $1.29 billion in simple block reward income per 30 days. Based on an average of 6,395 blocks mined per day and a reward of 2 ETH each block. As a result, MEV still accounts for a small percentage of total miner income (1%). But because only a small percentage of miners participate in the process. The actual percentage increase is likely much higher than 1%.
The benefits to engage are considerable. Given that a single MEV attack can payout in the tens of thousands, if not millions, of money. As evidenced by the following examples of the highest-grossing MEV transactions:
Defeating Bots
Regrettably, as an individual trader or DeFi user, you only have a few options for defending yourself against bots. The majority of which include learning how bots work and constructing transactions that are less likely to be targeted.
The Salmonella Agreement
With the use of a decoy ERC-20 token and a misleading transfer function — which only transmits a fraction of the acquired sum to the frontrunner if the transaction matches specific requirements. The Salmonella contract may be used to lure and dupe frontrunners (e.g., not being part of the or contract owner itself). There are also smart contracts that impose a transaction charge on just known frontrunners.
However, there are a number of possible alternatives worth examining. From the standpoint of a developer or project to assist limit the effect of MEV on your users. We’ll go over some of the techniques that have been used to deceive bots or fully eliminate them.
Sniper Trap for Liquidity.
When a backrunner snipes the first liquidity from a fresh DEX pair containing its related token. The token contract includes code that instantaneously recognizes it. This backrunner is then placed on a blacklist, preventing it from selling its tokens. This limitation could well be lifted in the future.
Fair Sequencing
Miners/nodes have the final word in transaction sequencing in MEV..
This enables them to choose transactions based on their value instead of their natural order. Chainlink’s Fair Sequencing Service, Arbitrum’s distributed sequencer proposal, and Automata’s Conveyor service are among the platforms that have presented approaches to increase order fairness. These strategies differ in how they are implemented, but they all aim to prevent MEV.
Keep in mind that some of them could be considered illegal, especially if they involve blacklisting certain token holders. Before adopting any of them, we recommend speaking with your legal team or a reputable legal power on the subject.
Here’s a list of related topics you might want to learn: