On Ethereum, miners have an unfair advantage called MEV . Since 2020, miners made more than 700M dollars, using techniques like front-running and sandwich attack. Flashbots is a new project that allow to get protected against MEV What is a MEV? And how can can flashbot protect against it? That’s what we will see in this article.
MEV (Miner Extracted Value)
MEV is a flaw of Ethereum that allows miners to make money off users . When a transaction is sent to the Ethereum network, it goes in the mempool of each miner. The mempool is an ordered list of all pending transactions. If a miner sees a transaction that is profitable, like a liquidation or an arbitrage, he can steals the opportunity for himself, by sending the same transaction with a higher gas price. That’s what we call front-running. Another kind of MEV is a sandwich attack, where a miner anticipate a price increase by wrapping a buy order with his own buy and sell order. This allows the miner to benefit from the slippage created by the initial transaction, at the expense of the trader.
Flashbot explained
Flashbot comes to our rescue. In Flashbots, we have: * searchers * relayers * miners.
Searchers are the users of the Flashbot service. They create an ordered list of transactions with their own transaction first, and other transactions coming from the public Ethereum mempool. Searchers make sure to select the most profitable transactions for miners.
This transaction list is called a flashbot bundle. Then, they send this bundle to relayers. Relayers act as a layer of defense in case of Denial of service attack. Relayers forwards the bundles to flashbot miners.
Flashbot miners are miners who run a modified Ethereum client called geth They select the most profitable bundle and mine it in the next block. Miners get paid by searchers with direct Ether transfer in a smart contract, instead of transaction fees. This guarantees searchers they they only pay miners if they transaction didn’t fail.
Sending a transaction with Flashbots
To send a transaction with Flashbots, you can combine the Ethers library with the [Flashbot plugin for Ethers[(https://github.com/flashbots/ethers-provider-flashbots-bundle). And if you want something even more simple, you can use the Flashbot Protects API. The Flashbot protects API handles all the low level details and offers a simplified interface. It will also re-send transactions that didn’t get mined.
So now, you know what are flashbots, and how to use them.
Leave a Reply