Measuring MEV

In order to highlight malicious practices, we designed the “orderbook discrepancy metric” to estimate the amount of extracted MEV. This metric captures the idea that dishonest validators manipulate the matches to profit certain accounts at the expense of others. Consequently, this behavior creates differences in the profit-and-loss (”PNL”) figures across accounts, which are not observed by honest validators. Let's explore this concept with an example.

Imagine there are two resting orders:

A: Sell 100 at $101

B: Buy 100 at $99

During the block,

C submits buy 100 at $102.

An honest validator would match A's sell order with C's buy order, with the final price being $101. Only A and C's accounts would be affected. However, a dishonest validator might insert their own orders to sell to C at $102 and buy from A at $101. This would unfairly give them a profit of $100, while C ends up paying a higher price than they should have.

For every block, nodes and other validators can track how different the block proposer's matched trades are from what the rest of the network observed. Skip Protocol nodes gather data for the dashboard and our open-source software includes tools enabling anyone to calculate the metric and check the figures themselves. More information on the formal definition of the orderbook discrepancy metric and technical details of the approach will be covered in an upcoming whitepaper.

Calculation of the metric

The MEV metric for a given block for a market is defined as the following:

$$ MEV=\frac{1}{2}\sum^N_{i} \left|PNL^{\text{BP}}_i-PNL^{\text{V}}_i\right| $$

Where:

We calculate the $PNL_i$ of a subaccount of a list of matched trades as:

$$ PNL_i=\sum_j^{S}n_j(p_j-p_{mid}) + \sum_j^{B}n_j(p_{mid}-p_j)-f $$

Where:

To see how this metric is calculated, consider the example from above.

Suppose there are two resting orders.