<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Sam Green on Medium]]></title>
        <description><![CDATA[Stories by Sam Green on Medium]]></description>
        <link>https://medium.com/@0xsamgreen?source=rss-8ed5a0b2eaea------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*o_Nm5jFcuqNLfotNvd-QPw.png</url>
            <title>Stories by Sam Green on Medium</title>
            <link>https://medium.com/@0xsamgreen?source=rss-8ed5a0b2eaea------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 19:53:35 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@0xsamgreen/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Notes about arbitrage in Ethereum]]></title>
            <link>https://medium.com/semioticai/notes-about-arbitrage-in-ethereum-202b9fef0c8e?source=rss-8ed5a0b2eaea------2</link>
            <guid isPermaLink="false">https://medium.com/p/202b9fef0c8e</guid>
            <dc:creator><![CDATA[Sam Green]]></dc:creator>
            <pubDate>Tue, 15 Jun 2021 23:23:49 GMT</pubDate>
            <atom:updated>2023-08-02T15:45:49.347Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zRSMYl5tFMOji_tTAEJDzg.jpeg" /></figure><p><strong>Update, April 2022: </strong>This article was originally written in July 2021. Since then, the Semiotic Labs team became increasingly interested in optimal order routing using decentralized exchanges (DEXs). We launched a related product this year: <a href="https://odos.xyz/">odos.xyz</a>. Odos uses a smart order routing algorithm to virtually pool DEX liquidity to provide the lowest price impact on trades. This is especially useful for high-volume high-value traders.</p><p>Ethereum uses a memory pool (mempool) where pending transactions are sent before inclusion in a mined block. Ethereum users pay fees (gas) in exchange for transaction ordering priority. These fees prevent spam from clogging the mined blocks — each block has only so much capacity for transactions. Arbitragers take advantage of the ability to pay fees to miners for processing priority.</p><p>By default, miner software automatically includes pending transactions offering the highest gas fees. However, miners don’t have to use gas fees to determine transaction ordering; they can order transactions however they see fit. Miners can also insert their own orders if they want, e.g. to capture arbitrage.</p><p>The mempool is public and can be watched. Arbitrage bots and miners doing arbitrage react to the content of the mempool between mined blocks. This was originally called Miner Extractable Value (MEV), but we now call it Maximal Extractable Value. MEV affects all users of Ethereum — especially those making large trades.</p><p>These notes are focused on recent trends in MEV, with a focus on:</p><ul><li>Examples</li><li>Competitive tools for arbitragers</li><li>Tools traders can use to avoid or leverage MEV</li><li>Game theory and MEV</li><li>Next-generation MEV</li><li>Ethics</li></ul><h3><strong>Examples</strong></h3><p>Typically, people are initiated into crypto by interacting with a centralized exchange (CEX) like Coinbase or Binance. When you use a CEX, you link your bank account and then pay a transaction fee to the CEX. Your transactions with them are private and off-chain, but you’re often paying higher fees for their services. On the other hand, decentralized exchanges (DEXs) like Uniswap or SushiSwap take place on-chain and in public. Transaction fees for DEXs are lower, but you pay a privacy cost for most DEX services.</p><p>A DEX allows users to swap pairs of currencies. Uniswap and SushiSwap are two popular DEXs. The key for DEXs is that the more you take of one token, the more expensive it gets — this is called slippage. When a trader uses a DEX, they need to understand how much they can trade before the slippage makes the trade too expensive relative to just going to a CEX and paying a higher fee or making part of the trade through another DEX. Slippage is the source of MEV in a DEX.</p><p>How interesting is MEV? Below is a simple and extreme real-world example of arbitrage worth $2,362 in profit to the arbitrager. In this example, a trader submits a transaction to the mempool to swap $211k worth of USDT for AMP. However, by monitoring the mempool, a bot observed this transaction was about to take place. So the bot created a “sandwich” that first guaranteed unfavorable conditions for the trader, then placed the trader’s swap with slippage, then removed the slippage with a reverse swap.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/1*QH3JiM77jmIXqaD-_-by5g.png" /><figcaption>The block where this arbitrage occurred: <a href="https://etherscan.io/txs?block=12569796">https://etherscan.io/txs?block=12569796</a></figcaption></figure><p>Today, more than half of all mined Ethereum blocks have MEV being extracted. Most miners are participating. Flashbots (discussed below) allows arbitragers to pay fees to miners. Since January, miners have made $88M from arbitrage fees through Flashbots. Arbitrager profit is more difficult to track. $88M is a lower bound because Flashbots is just one of several tools enabling MEV.</p><h3><strong>Competitive Tools for Arbitragers</strong></h3><h4>Flashbots</h4><p>Before 2021, arbitragers would monitor the mempool and then compete in <a href="https://arxiv.org/abs/1904.05234">Priority Gas Auctions</a> by bidding against each other in an English auction. This filled the mempool with bot spam. Then Flashbots came along and offered sealed-bid auctions. Flashbots runs a trusted, centralized, private router to accept arbitrager bids without affecting the mempool.</p><p>In July 2021, about 64% of all mined Ethereum blocks contained MEV from Flashbots:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/1*8yon32b-4PaB9mnxhTJDZQ.png" /><figcaption>Source: <a href="https://dashboard.flashbots.net/network">https://dashboard.flashbots.net/network</a></figcaption></figure><h4>Private Relays</h4><p>Flashbots is a public transaction “relay”, but there are private relays too. Ethermine has 22% of the hash power for Ethereum, and they run a private relay: <a href="https://mev-relay.ethermine.org/">https://mev-relay.ethermine.org/</a>. Additionally, bloxRoute runs private relays and most miners use bloxRoute: <a href="https://docs.bloxroute.com/introduction/private-relays">https://docs.bloxroute.com/introduction/private-relays</a></p><h4>bloxRoute</h4><p>bloxRoute runs private relays, but they are more well known for providing rapid access to data. If you are a miner, you want to receive the latest mined block as soon as possible. Likewise, if you are searching for MEV, you want to see the contents of the most recent mined block and the transactions pending in the mempool as soon as possible. You want to be the first to understand how those pending transactions should affect your strategy. bloxRoute offers the fastest service to get the most recent mined block and the current state of the mempool. bloxRoute competes with Blocknative and Alchemy, and their relative latencies are plotted below. The x-axis of this plot is the transaction hash of the block and the y-axis is the millisecond latency between when the block was mined and when the benchmark code received the block.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fJ2--Kz2pOWmZR_V-k50VA.png" /><figcaption>Source: <a href="https://medium.com/keeperdao/a-performance-benchmark-on-mempool-services-9e68bf070952">https://medium.com/keeperdao/a-performance-benchmark-on-mempool-services-9e68bf070952</a></figcaption></figure><h4>The Graph?</h4><p>Disclaimer: My company operates an Indexer in The Graph protocol.</p><p>The Graph protocol uses cryptoeconomics to incentivize independent agents to scan for blocks that contain transactions of interest, parse those blocks, record the data to a database, and then provide the data to developers through an API. This process is called “indexing”. Most DeFi and Web3 applications use The Graph. The Graph could be a convenient way for arbitragers to discover and track statistics related to their DEXs of interest.</p><h3><strong>Tools for Traders to Prevent MEV</strong></h3><h4>Flashbots</h4><p>In the example above, a trader was sandwiched by a bot that maximized the trader’s slippage/loss. However, the trader could have routed their order through Flashbots. They would have had to pay more to get their transaction processed by Flashbots, but at least an arb bot would not have sandwich attacked them. Flashbots doesn’t offer an easy-to-use app for this service, but others, like 1inch, have integrated Flashbots into their platform. Note that Flashbots currently only works on Ethereum.</p><h4>Configure Flashbots Protect RPC in MetaMask</h4><p>In MetaMask, when making swaps on Ethereum, you can use the Flashbots Protect RPC. The Flashbots Protect RPC allows regular users to easily submit their transactions to the Flashbots Auction by using a custom RPC endpoint in their wallet. Everything will work the same, except transactions are sent to the Flashbots builder instead of the public mempool. Now you can use <a href="https://www.odos.xyz/">odos.xyz</a> or your favorite DEX and make trades without being sandwiched. It’s very easy to setup. See <a href="https://docs.flashbots.net/flashbots-protect/rpc/quick-start#how-to-use-flashbots-protect-rpc-in-metamask">https://docs.flashbots.net/flashbots-protect/rpc/quick-start#how-to-use-flashbots-protect-rpc-in-metamask</a></p><h4>Backrunme from bloxRoute</h4><p>Backrunning is the act of placing an arb order after a normal order. Why do this? When a trader makes a large order on a DEX, they will naturally cause slippage. For example, trading many (“many” is relative in this context) token-a for multiple token-b will cause the price of token-a to drop in the DEX. This can cause the price of token-a to be cheaper on this particular DEX than other DEXs. An arb bot would identify this, and try to be the one that buys the cheap token-a (and then sell them on another DEX) before any other bot. <a href="https://backrunme.com/#/swap">Backrunme</a> is a service that allows large trades to profit from the slippage they create and the subsequent backrunning that follows. When a trader uses Backrunme, they get a portion of the arb that is caused by and subsequently captured from their trade.</p><h3><strong>Game Theory and MEV</strong></h3><p>Will the amount of arbitrage profit shrink to 0 as more bots come online and compete? To be clear, the arbitrage profit could shrink because bots would presumably need to give more and more to miners for priority fees — until there is nothing left. That appears to not be the case because arbitragers are taking turns collecting MEV. Here is a thread explaining the use of game theory to maximize arb returns: <a href="https://twitter.com/0x9116/status/1401989222849036288">https://twitter.com/0x9116/status/1401989222849036288</a></p><h3><strong>Next-Generation MEV</strong></h3><h4>Cross-Chain Arbitrage</h4><p>Flashbots and bloxRoute only work in Ethereum. Each new blockchain that comes online creates new opportunities for MEV. For example, Polygon is gaining popularity and Flashbots does not operate there yet. This means Priority Gas Auctions (English auctions) are available, but sealed-bid auctions are not yet available as far as I know.</p><h4>MEV-SGX</h4><p>Flashbots is still developing. Their current protocol requires trust that miners won’t take the arb exposed in the proposed blocks for themselves. To mitigate this, Flashbots is working on MEV-SGX. MEV-SGX uses Intel’s secure enclave solution to guarantee that miners are unable to see the arbitrager’s scheme until after the miner has successfully mined the block containing the arb. <a href="https://ethresear.ch/t/mev-sgx-a-sealed-bid-mev-auction-design/9677/12">https://ethresear.ch/t/mev-sgx-a-sealed-bid-mev-auction-design/9677/12</a></p><h4>Vitalik’s Thoughts on Improving or Reducing MEV</h4><p>Vitalik recently posted some ideas for mechanisms to manage MEV: <a href="https://ethresear.ch/t/proposer-block-builder-separation-friendly-fee-market-designs/9725">https://ethresear.ch/t/proposer-block-builder-separation-friendly-fee-market-designs/9725</a>.</p><h3><strong>Ethics</strong></h3><p>MEV is ethically ambiguous. Some MEV techniques seem benign, like backrunning, and other techniques look malicious, like sandwich attacks. However, the existence and capture of arb is part of the fundamental design of DEXs. Currently, slippage is the price users pay for on-chain trading. Other traders follow and remove the slippage and re-adjust the price to the market by capturing arb. Uniswap, the largest DEX, even shows how to capture arb with no capital: <a href="https://uniswap.org/docs/v2/core-concepts/flash-swaps/">https://uniswap.org/docs/v2/core-concepts/flash-swaps/</a></p><h3>Eva Beylin on Twitter: &quot;wars will be fought over the methodology of transaction sequencing / Twitter&quot;</h3><p>wars will be fought over the methodology of transaction sequencing</p><h3>The MEV Rabbit Hole</h3><p>I got most of my information on this topic by reading tweets and the <a href="https://discord.gg/7hvTycdNcK">Flashbots discord</a>. Here are the accounts that have helped me learn the most:</p><p><a href="https://twitter.com/bertcmiller">https://twitter.com/bertcmiller</a> <a href="https://twitter.com/thegostep">https://twitter.com/thegostep</a> <a href="https://twitter.com/obaidkav">https://twitter.com/obaidkav</a></p><p><em>Sam Green is a co-founder and the Head of Research at </em><a href="https://www.semiotic.ai/"><em>Semioti</em>c Labs</a><em>. His Twitter handle is </em><a href="https://twitter.com/0xsamgreen"><em>0xsamgreen</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=202b9fef0c8e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/semioticai/notes-about-arbitrage-in-ethereum-202b9fef0c8e">Notes about arbitrage in Ethereum</a> was originally published in <a href="https://medium.com/semioticai">Semiotic Labs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>