---
# System prepended metadata

title: Simple Backrunner

---

# Simple Backrunner

## Blueprint [Github Link](https://github.com/bhakiyakalimuthu/backrunner)
- [x] Subscribe to mempool txs on websocket client
- [x] Filter for Uniswap (SwapRouter02) trades
- [x] Filter for multicall
- [x] Decode calldata 
    - [x] Data using geth abi package
    - [x] Filter for exactInputSingle & exactOutputSingle
        - [x] swapExactTokensForTokens & swapTokensForExactTokens will not be implemented in this prototype
    - [x] Extract trade data from multicall calldata
        - [x] Reminder: inner deadline param has to be removed
    - [x] Filter for (TOKEN -> WETH) swaps ONLY
    - [x] Assume executor will only hold WETH
- [x] Implement executor contract [Contract](https://github.com/bhakiyakalimuthu/backrunner/blob/ceca740e7083f916e6718059c0ddf103766b7ad3/contracts/BackrunExecutor.sol)
    - [x] Accept trade data as param to execute function
    - [x] Buy tokens (which mempool user will have sold) on Uniswap
    - [x] (my_buy_amount == mempool_user_sell_amount == mempoolTx.amountIn)
    - [x] Sell all purchased tokens on Sushiswap
    - [x] Return updated WETH balance
- [x] Simulation-based profit analysis (not ideal, but quick & easy to implement)
- [x] Blindly/optimistically build backrun bundle
- [x] Simulate on local MEV-Geth or use Flashbots callBundle
- [x] Determine whether bundle is worth sending to onchain
- [x] Create and send Flashbots bundle via sendBundle

## Todo
- [ ] Profit calculation
- [ ] Test contract against local mainnet fork
- [ ] Deploy contract on mainnet & update
- [ ] Extend the trade to different DEX
- [ ] Add more trade pairs