-
Notifications
You must be signed in to change notification settings - Fork 0
/
35061643.mev-and-coordination.html
1 lines (1 loc) · 11 KB
/
35061643.mev-and-coordination.html
1
<p><code>Coordination, the ability for large groups of actors to work together for their common interest, is one of the most powerful forces in the universe. - Vitalik Buterin (in his article on </code><a href="https://vitalik.ca/general/2020/09/11/coordination.html"><code>Coordination</code></a><code>)</code></p><p></p><p>Coordinated participants always win in any game - be it one that involves political power or economic (markets). Groups of participants who can trust each other and bind each other to mutually aligned strategies always have an upper hand over participants who don’t. High coordination changes market structure - to the point you can end up with monopolies (such as in industry) or universal coordination (such as nation states or blockchains).</p><h3></h3><h3>What is MEV?</h3><p>This is especially true of MEV. But what is MEV? MEV is value that can be extracted by deciding the <em>order </em>in which transactions take place - rather than just <em>which </em>transactions. Naively, miners would add the transactions that paid the most fees. But as transactions grew more complicated, it (unsurprisingly) turned out that you could make more revenue by changing the order in which transactions occured - or inserting your own transactions.</p><p></p><p>Fundamentally this has to do with the fact that trading is time-sensitive. Whoever can react first to newly available information can make a profit. Be it outside news such as a plane crash, or something as simple as an order that happened on a different exchange (and hence needs to be arbitraged across all exchanges).</p><p></p><h3>Who are the actors involved?</h3><p>Users receive data about the current state via nodes. Users act on this data by creating transactions. They spread these transactions again via nodes, who maintain mempools (lists of unconfirmed transactions). Other users may look at the mempool and create more transactions to extract revenue.</p><p>Miners also run nodes and hence receive this data. Miners mine blocks where they get to decide transaction order. Once a block is mined, other miners must mine on top of this block - after sufficiently many blocks mined - these transactions are <em>finalised</em>.</p><p></p><p>So the actors are:</p><ul><li><p>Transactors</p></li><li><p>Dapps</p></li><li><p>Nodes</p></li><li><p>Smart transactors (Strategists)</p></li><li><p>Miners</p></li></ul><p></p><h1>The MEV foodchain</h1><h3>Strategists</h3><p>At the weakest link we have strategists. Transactors can look at each others data while it is sitting in mempools and create frontrunning transactions. This becomes a game where strategists may find ways to exploit each other. They can also be defeated or weakened by higher levels of the foodchain.</p><p>Transactors can become smart by using <a href="https://github.com/flashbots/ethers-provider-flashbots-bundle">bundles</a> - this basically creates groups of transactions that need to be added all at once for fees to be paid. This helps limit exploitation from higher levels of the foodchain.</p><h3>Strategists (coordinated)</h3><p>Strategists can also <strong>coordinate</strong> and split profits instead of competing with each other to the death (i.e. where everyone earns near zero profits submitting worse and worse bids). This is the approach <a href="https://app.keeperdao.com/">KeeperDAO</a> is attempting. This however only works if <em>all </em>strategists who are competing for an opportunity are able to team up - this is a hard problem. If even one person is not coordinated when accessing a specific opportunity - a bidding war ensues which leads to abysmal profits.</p><p>Also, even coordinated strategists can be defeated by higher levels of the foodchain.</p><h3>Miners</h3><p>At the next level we have the miners, who get to decide what actually goes in each block. If strategists are not coordinated and keep bidding opportunities to zero, miners can afford to be lazy. They get all the profit for doing essentially nothing. Miners however have access to more <em>deterministic </em>opportunities - and can guarantee the contents of the entire block they mine, unlike strategists who typically can only hope they’re not exploited somehow. (Strategists submit individual transactions or trusted bundles).</p><h3>Miners (coordinated)</h3><p>Miners can <strong>coordinate</strong> and go one step further - they can orphan blocks created by other miners. Orphaning blocks is a complicated game - the rule of thumb is that the more hashpower you have, the more likely it is you’ll be able to orphan someone else’s block. More hashpower means more miners coordinated - and having a way to trust each other and split profits.</p><p>Orphaning can be modelled as a repeated game with two options - continue chain and orphan. Orphaning just means the game repeats - the game only terminates (sort of) when someone continues the chain. The game however is not symmetric - there could exist multiple groups of different sizes (hashpower) who are voting to orphan. But since they are not coordinated together, only one group can successfully orphan - while everyone else’s effort is wasted. More analysis will be required to show how this game plays out in varied circumstances - and what are the bribes required to maximise coordination.</p><p>The largest coordinated group of hashpower (not necessarily 51%) roughly gets to decide the fate of the chain - since they can orphan others but others can’t orphan them. There is a clear <strong>coordination premium </strong>- where more coordinated groups can afford to pay smaller bribes to get their way.</p><p>The game we described only considered reorgs that are one block deep - however reorgs can go arbitrarily deep. Parties might even choose to reorg their own blocks - because new information (new transactions) make it worthwhile to do so. However deep reorgs will be blocked by social consensus which sits at an even higher level of the foodchain (the highest level, actually).</p><h3>Nodes</h3><p>Nodes transmit transactions from miners to miners, from non-miners to non-miners and from non-miners to miners. They also transmit state from miners to miners, from miners to non-miners and from non-miners to non-miners.</p><p>Mining nodes have a clear incentive to communicate with each other since their blocks get finalised only when other miners mine on top of them. There is a much weaker incentive to communicate with non-mining nodes, and indeed a lot of nodes are running largely altruistically.</p><p>The existence of MEV however could make running nodes a paid job with all sorts of incentives floating through. Nodes can introduce artificial latencies, they can select which sets of nodes they will communicate with (coordination among nodes), and they can choose what all transactions they will communicate and what they will keep silent about. Most user transactions run through <a href="https://infura.io/">Infura</a> because transactors don’t feel the need to run their own nodes. Infura can effectively charge for mempool access or for fast mempool access. Special MEV opportunities can be auctioned by private nodes such as Infura for much higher rates.</p><p>These auctions require some level of off-chain trust as there is, as of yet, no trustless way to ensure payments occur only when data is made available.</p><p>Such private mempools already exist and are charging heavily - some examples include <a href="https://taichi.network/">Taichi network</a> and <a href="https://help.1inch.io/en/articles/4695716-what-are-stealth-transactions-and-how-they-work">1inch stealth transactions</a></p><p>Miners can cut out the middlemen nodes by directly communicating with each other. Similarly transactors too can cut out the middlemen nodes by directly communicating with miners. The existence of latencies on the internet, however, means that there can still be eavesdroppers and faster channels - who can charge for faster access in the order of milliseconds.</p><p>Again coordination matters - miners who are able to strike better deals with transactors may be able to get privileged access to mine transactions.</p><h3>Dapps</h3><p>At a <em>(sort of?)</em> next level we have dapps who can try to design themselves such that MEV is minimised. <a href="https://www.euler.xyz/">Euler</a> is working on variable liquidation incentives to minimise liquidation MEV. Oracles such as <a href="https://chain.link/">Chainlink</a> and <a href="https://uniswap.org/docs/v2/core-concepts/oracles/">uniswap TWAPs</a> are looking to design such that they maintain freshness of data and hence reduce the MEV they create.</p><h3>Dapps (coordinated)</h3><p>Multiple dapps can coordinate and ensure that their integrations (or mere coexistence) too minimises MEV and maximises benefit for the users of those dapps. A very naive example would be if Uniswap and Sushiswap integrated arbitrage natively into their contracts - this would prevent third parties from extracting arb revenue - all of it would go to the protocols instead.</p><h3>Users</h3><p>At the highest level of the food chain, the apex predators are … users themselves? Yes, users are the ones who are ultimately paying MEV. Users are indirectly paying two forms of fees - MEV and gas fees. If users can coordinate they can choose to withhold transactions unless miners pay some (or all) of the MEV back to them. As always, coordination matters. The challenge is doing this trustlessly - how do you demand that a miner pays you back the MEV - and instead transparently charges higher gas fees.</p><p>One novel of user making such demands is that they only send their transactions to miners who run <a href="https://software.intel.com/content/www/us/en/develop/topics/software-guard-extensions.html">SGX</a>. These are chips created by Intel or AMD which keep the contents of the chip safe even from their owners. This way miners themselves will not know the transactions they are mining until they are already mined.</p><h3>Users (coordinated)</h3><p>The ultimate level in user coordination in simply the social consensus that governs the blockchain.</p><p>Blockchains are ultimately governed by social consensus - not miners or fork choice rules. The main reason MEV exists in the first place is because we don’t have transaction ordering rules baked into consensus.</p><p>This social coordination is also the reason deep reorgs don’t occur even when it is profitable to do so. Billion dollar transactions are almost always worth double-spending via a deep reorg - however this does not happen in practice. This security guarantee will continue to hold true in an MEV-infested world.</p><p>A naive way to reduce MEV would be to dictate that transactions in a block must follow lexicographic order - this restricts the freedom miners have over ordering. A more thorough solution would likely require a novel consensus mechanism that deals with the mempool and verifiably random numbers.</p><p>Chainlink is attempting a <a href="https://blog.chain.link/chainlink-fair-sequencing-services-enabling-a-provably-fair-defi-ecosystem/">pseudo-consensus for transaction ordering</a> in the case of rollups (arbitrum).</p>