Guest post from HodlX Submit your message
In the early days of Bitcoin, miners could receive rewards either for mining a block or as fees for a transaction with the highest gas price.
The logic behind forming a bloc was relatively simple
fetch all valid unmined transactions from the mempool, sort them by their gas price, form them into a block, then start mining.Over time, as blockchain became more advanced, we saw the development of Turing-complete smart contracts on Ethereum, and then the whirlwind of DeFi growth.
With all this, block producers have received additional methods to generate profits.
It turned out that by including, excluding, and reordering transactions, block producers could now earn additional rewards.
This mechanism was called MEV (maximum extractable value)
the largest amount that block producers could earn.The story of MEV
Even before the Ethereum mainnet was released, discussions about earning additional profits began to appear online.
Users have discovered that the decentralized, public nature of the blockchain makes it possible to “hide” a small transaction in front of a large one, so that anyone can easily buy assets at a lower price.
Since a larger purchase increases the value of the asset on decentralized exchanges, an earlier transaction may prove profitable, since the assets were obtained before the growth.
The term “MEV” was coined in 2019 after the publication of the Flash Boys 2.0 study. This was the first comprehensive study on the topic, which examined the issue in detail.
How it works
Usually, miners, validators or block producers have the power to include, exclude and reorder certain transactions.
Imagine a scenario
you see an opportunity to make money on a protocol. You realize that this opportunity has been available to everyone for some time, but it has not been exploited.So, you prepare a transaction, send it and eagerly wait for it to be mined to receive the desired reward.
However, it turns out that someone beats you to a similar transaction and steals the reward from under your nose.
It is quite reasonable to ask what are the chances of two people finding the same opportunity simultaneously.
It was pretty low, and to make matters worse, no one had looked.
There are programs and tools that automatically analyze submitted transactions and then modify those that may prove profitable for the benefit of their owner.If this works, the copy transaction is sent forward using frontrunning.
Types of VME
Arbitration
Arbitrage is a way to profit from price discrepancies on different platforms. Miners who notice these discrepancies can be the first to send their transactions to take advantage of them.
These actions are considered to have a positive influence on the market because they help to keep asset prices relatively similar across different platforms and exchanges, as larger spreads can prove problematic.
In the lead
An MEV trade is placed before the original trade. We already talked about this earlier, noting that when such a trade is submitted before the original trade, it is a larger purchase on a DEX.
Another mechanism is to copy the original transaction with small adjustments so that the attacker gets the profit instead of the original sender.
Back in time
This is similar to frontrunning, except that the transaction is placed right after the original transaction. An example of this use is buying a token right after the project launches
as soon as it is available on the DEX.Sandwich attack
This is a combination of two previously described types of attacks. The attacker sends two transactions
one before and one after the original.This way, unlike an advance preceding a large purchase, the attacker can easily examine and document his profit.
Liquidation
Lending protocols are often organized in a way that allows any user to liquidate a position, earning additional funds.
Users must compete to send the liquidation transaction in order to receive the profit.
MEV prevention
It is obvious that the possibility of using MEVs imposes additional fees on users and carries additional risks.
The Flashbots system was created specifically to combat MEVs. This system attempts to control MEVs by creating an open transaction auction.
Conclusion
The ability to create MEVs is a result of the open and decentralized structure of the blockchain. This has both positive and negative effects.
It is essential for blockchain users and developers to understand how the technology works in order to minimize the risks of falling victim to an unexpected attack.
Gleb Zykov is the co-founder and CTO of HashEx Blockchain Security. He has over 14 years of experience in the IT industry and over eight years in Internet security, as well as a strong technical background in blockchain technology (Bitcoin, Ethereum, and EVM-based blockchains).
Follow us on Twitter Facebook Telegram
![](https://dailyhodl.com/wp-content/uploads/2018/06/Get-Alerts-728x90.png)
Disclaimer: Opinions expressed on The Daily Hodl are not investment advice. Investors should do their own due diligence before making any high-risk investments in Bitcoin, cryptocurrencies or digital assets. Please be advised that your transfers and trades are at your own risk, and any losses you may incur are your responsibility. The Daily Hodl does not recommend the buying or selling of any cryptocurrencies or digital assets, nor is The Daily Hodl an investment advisor. Please note that The Daily Hodl participates in affiliate marketing.
Image generated: Midjourney