{"id":272,"date":"2021-10-01T21:51:10","date_gmt":"2021-10-01T20:51:10","guid":{"rendered":"https:\/\/imruls.blog\/?p=272"},"modified":"2021-10-01T21:51:10","modified_gmt":"2021-10-01T20:51:10","slug":"what-are-front-running-bots-doing","status":"publish","type":"post","link":"https:\/\/imruls.blog\/?p=272","title":{"rendered":"What Are Front-Running Bots Doing?"},"content":{"rendered":"\n<p>To understand front-running blockchain bots, it helps to understand traditional front-running in equity markets. It\u2019s similar to insider trading.<\/p>\n\n\n\n<p>1. You know a big order for Apple stock is about to occur<br>2. This will drive the price higher (temporarily at least)<br>3. You buy some Apple stock for \u00a3100 before the big order (AKA front-running)<br>4. The big order occurs, sending Apple stock to \u00a3105<br>5. You sell yours. Pocketing a gain of \u00a35<\/p>\n\n\n\n<p>Insider trading is illegal and unethical. Front-running operates in a grey area. The two are similar concepts but not the same.<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>&#8230;This then takes us to front-running run by machines, otherwise known as High Frequency Trading (HFT). A very good book on this is Flash Boys by Michael Lewis. I recommend it.<\/p>\n\n\n\n<p><strong>Side note<\/strong>: Although HFT machines can decide faster than humans on matters, they\u2019re still competing with other HFT machines. This kicked off a race to have the fastest connections, to shave milliseconds. There were HFT firms <a href=\"https:\/\/www.bloomberg.com\/news\/features\/2019-03-08\/the-gazillion-dollar-standoff-over-two-high-frequency-trading-towers\">buying offices<\/a> as close as they could to stock exchanges. They were investing in having the <a href=\"https:\/\/www.wsj.com\/articles\/high-frequency-traders-push-closer-to-light-speed-with-cutting-edge-cables-11608028200\">straightest and shortest<\/a> fibre-optic connection possible, so they could gather information about trades sooner than anyone else.<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>&#8230;If the above makes sense to you, you\u2019ll be glad to know front-running bots on blockchain are exactly the same premise. N.B. The bots take the form of smart contracts.<\/p>\n\n\n\n<p>To keep it simple:<\/p>\n\n\n\n<p>\u2022 The bots are like HFT machines, programmed to front-run your trade <br>\u2022 A <a href=\"https:\/\/mempool.space\/\">mempool<\/a> is a <em>public<\/em> register of pending blockchain trades, like a stock exchange<\/p>\n\n\n\n<p><strong>ELI5<\/strong> &#8211; You can already see how the recipe unfolds like non-blockchain front-running. You have a smart contract bot that can see what\u2019s being bought, buy it first, sell it higher, then pocket the difference. The question is, why does this happen on blockchains?<\/p>\n\n\n\n<p>1. Thin liquidity<br>If a bot is scanning a niche DEX liquidity pool such as SNX\/BAT for orders, 1 front-running trade can create significant price fluctuations in that pool. This works if the purchaser allows for wide slippage (an acceptable price range, rather than a fixed price).<br>2. Miners like it<br>Since the bot front-runs your trade by submitting the same trade but offering a higher gas price to get it fulfilled first\u2026miners will happily allow this activity because it means they get to collect those gas fees created by front-running bots.<br>3. Breaking news! Public blockchains are public!<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>Thinking out loud:<\/p>\n\n\n\n<p>\u2022 ETH\u2019s EIP 1559 doesn\u2019t really stop front-runners, high-tipping bots are given priority. <br>\u2022 Proof of stake emulates conventional wealth inequality traps, it compounds with those who already have wealth &#8211; is PoS a good structural change when excluding the matter of carbon emissions? <br>\u2022 Proof of humanity works to filter bots if trading, for example, via Metamask on a DEX. However can&#8217;t one directly plug into liquidity pools via a private node and a bespoke WalletConnect config? Captcha probably won\u2019t stop the more intelligent front-running attempts <br>\u2022 Is there an opportunity to integrate zk-SNARK tech somewhere in the flow? <\/p>\n","protected":false},"excerpt":{"rendered":"<p>To understand front-running blockchain bots, it helps to understand traditional front-running in equity markets. It\u2019s similar to insider trading. 1. You know a big order for Apple stock is about to occur2. This will drive the price higher (temporarily at least)3. You buy some Apple stock for \u00a3100 before the big order (AKA front-running)4. The [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[5],"tags":[],"class_list":["post-272","post","type-post","status-publish","format-standard","hentry","category-thoughts"],"blocksy_meta":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/imruls.blog\/index.php?rest_route=\/wp\/v2\/posts\/272","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/imruls.blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/imruls.blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/imruls.blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/imruls.blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=272"}],"version-history":[{"count":0,"href":"https:\/\/imruls.blog\/index.php?rest_route=\/wp\/v2\/posts\/272\/revisions"}],"wp:attachment":[{"href":"https:\/\/imruls.blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=272"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/imruls.blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=272"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/imruls.blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=272"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}