/honeypot

Primary LanguageTypeScript

Honeypotting frontrunners (and failing 😅)

I decided to conduct this experiment after reading about the Salmonella attack on sandwich traders and wondering if it was possible to do something similar with the generalized frontrunning bots talked about in the famous Ethereum is a Dark Forest article.

Because frontrunners tend to execute new transactions in the mempool locally to determine if it is profitable, the idea was to create a smart contract where a transaction would be profitable locally but not on mainnet. We can accomplish this by using a smart contract method that takes in 1ETH and with equal probability locks the funds and returns 1.03ETH (selected to be barely profitable for traders after deducting gas fees). There is a 25% chance that a bot runs this locally, determines this is profitable, and executes the trade only to find that its funds have been stolen. There is also a 25% chance that .03ETH is taken from the contract and a 50% chance that the bot decides the trade is unprofitable locally, but the EV here is high since there is an equal chance we obtain 1ETH and lost .03ETH.

Unfortunately, the existence of Flashbots dashed these plans as it allows MEV traders to ensure multiple transactions are mined in the same block or revert all of them. Therefore, a trader could (and did) couple the transactions that deposited and withdrew funds from the contract, making off with 0.06ETH because I called the method twice before realizing that bots were indeed frontrunning me :(