# MEV

MEV can be good and bad. Blink's aim is simple: maximise the good - eliminate the bad.

### Bad MEV

Bad MEV is when an actor is able to get their transaction included earlier in a block then the a user's transaction. This allows them to manipulate the state of the blockchain (e.g. liquidity pools) to give a user worse execution.

Sandwich attacks are a classic example of this. Below is a screenshot of the notorious jaredfromsubway "sandwiching" a transaction on Etherem:

<figure><img src="https://3251730900-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fi8QIu6FzXcM9EserJPs2%2Fuploads%2F4z2szH6oRrLBm0nCzVgZ%2Fimage.png?alt=media&#x26;token=87a4623b-7de7-4d9b-9a14-4ff0fdcb545d" alt=""><figcaption></figcaption></figure>

In the above transactions, jaredfromsubway made the owner of the transaction pay a 9% higher price and made (stole) a whopping $31,633.58.

Spoiler Alert: if the user had been using Blink, this wouldn't have happened!

### Good MEV

For good reasons, MEV gets a bad name. However, it's not all bad. In fact, in the right circumstances it  can provide several benefits:

1. Price Improvement

* Arbitrage helps align prices across different trading venues
* Reduces price discrepancies between DEXs
* Creates more efficient markets

2. Token Holder Benefits

* Generates protocol fees from increased trading volume
* Can provide additional yield for liquidity providers
* Often results in better token prices for users

3. Technical Benefits

* Helps maintain price equilibrium between pools
* Can prevent extreme price impacts from large trades
* Provides additional market liquidity

4. User Value Return

* When implemented properly (like with Blink), users can receive a portion of the MEV value
* Transforms what could be lost value into user benefits
* Makes trading more cost-effective for users

In fact, there is no downside (except for Jared). User's execution is unchanged. Markets are more efficient.

## How it works

#### What's a "Bundle"

A blink bundle are typically 2 transactions that are sent to block builders as a pair. There is a convention in the block building world that bundles cannot be frontrun or "un-bundled" (i.e. separated with transactions in between.

Furthermore, bundles must be included together or not at all. This prevents searchers from sending their backrun transaction separately (and avoiding the recovery fee).

<img src="https://3251730900-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fi8QIu6FzXcM9EserJPs2%2Fuploads%2FurcJXBVWrWB8bHt9dF5V%2Ffile.excalidraw.svg?alt=media&#x26;token=202908c6-1389-488e-b0b9-16f2abf8d0ad" alt="" class="gitbook-drawing">

MEV is recovered with the following steps:

1. User sends raw transaction to Blink
2. Blink shares (without the signature) with its trusted searcher network
3. Searchers send back bundles.
4. Blink's MEV Engine pick best bundles to recover value for the User
5. Blink sends the bundles to block builders.
6. Block builders include the transaction onchain with a refund back to Blink / Originator / User... Depending on setup
