What Are Front-Running Bots Doing?

To understand front-running blockchain bots, it helps to understand traditional front-running in equity markets. It’s similar to insider trading.

1. You know a big order for Apple stock is about to occur
2. This will drive the price higher (temporarily at least)
3. You buy some Apple stock for £100 before the big order (AKA front-running)
4. The big order occurs, sending Apple stock to £105
5. You sell yours. Pocketing a gain of £5

Insider trading is illegal and unethical. Front-running operates in a grey area. The two are similar concepts but not the same.


…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.

Side note: Although HFT machines can decide faster than humans on matters, they’re still competing with other HFT machines. This kicked off a race to have the fastest connections, to shave milliseconds. There were HFT firms buying offices as close as they could to stock exchanges. They were investing in having the straightest and shortest fibre-optic connection possible, so they could gather information about trades sooner than anyone else.


…If the above makes sense to you, you’ll be glad to know front-running bots on blockchain are exactly the same premise. N.B. The bots take the form of smart contracts.

To keep it simple:

• The bots are like HFT machines, programmed to front-run your trade
• A mempool is a public register of pending blockchain trades, like a stock exchange

ELI5 – You can already see how the recipe unfolds like non-blockchain front-running. You have a smart contract bot that can see what’s being bought, buy it first, sell it higher, then pocket the difference. The question is, why does this happen on blockchains?

1. Thin liquidity
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).
2. Miners like it
Since the bot front-runs your trade by submitting the same trade but offering a higher gas price to get it fulfilled first…miners will happily allow this activity because it means they get to collect those gas fees created by front-running bots.
3. Breaking news! Public blockchains are public!


Thinking out loud:

• ETH’s EIP 1559 doesn’t really stop front-runners, high-tipping bots are given priority.
• Proof of stake emulates conventional wealth inequality traps, it compounds with those who already have wealth – is PoS a good structural change when excluding the matter of carbon emissions?
• Proof of humanity works to filter bots if trading, for example, via Metamask on a DEX. However can’t one directly plug into liquidity pools via a private node and a bespoke WalletConnect config? Captcha probably won’t stop the more intelligent front-running attempts
• Is there an opportunity to integrate zk-SNARK tech somewhere in the flow?