Frontrunner Router Breakdown

Eli Barbieri
2 min readSep 25, 2021

Frontrunning bots have become a common occurrence on the Ethereum network, and most of these bots are utilizing the Flashbots bundled transactions.

Flashbots is a community project to decentralize frontrunning by allowing average miners to participate, instead of only a select few technically skilled individuals. The Flashbots Etheruem Node is a modified version of the popular client, geth, with interfaces that can be used to send a bundle of transactions straight to the miner and bypass the Pending Transaction Pool.

Flashbots Frontrunners typically work by using a searching algorithm that takes in information from an Ethereum node, and finds a potentially profitable transaction. A packet of transactions is then sent to a Flashbots miner.

The Frontrunner I decompiled was searching for transactions from several different Token Routers, which all used the base UniswapV2 Protocol, and selecting frontrunnable transactions, then submitting to Flashbots Miners. Over 1 week, 62% of the exploited transactions were sent to the UniswapV2 Router2, 13% to MetaMask Swap, 14% to 1InchV3, and the remaining to SushiSwap and the 0xExchange.

Each of these contracts utilizes the UniswapV2 Token Pairs to swap ERC20 Tokens, and can benefit from the massive liquidity off Uniswap. However, each of these contracts have different inputs, addresses, and protocols, and the frontrunner is able to adapt for all of these, and single out the profitable transactions. There were even several blocks where the frontrunner exploited 2 different transactions within the same block, showing that these are well designed to maximize profitability.

The data collection script used to generate the datasets in this article has been running for over a week now, and is tracking log information, contract inputs, and frontrunner activities. In coming posts I will dive further into the methods frontrunners likely use to calculate the profitability threshold and propose ways to create a gas formula that makes it impractical to frontrun, and further shrink the margins frontrunners operate within.

--

--

Eli Barbieri

Ethereum Researcher and Developer. Data Product Tech Lead @Nethermind. Cicero Labs