# searching from scratch
> *Note: we will have to drastically over-simplify and cut many corners. Writing a decent backrunner from scratch in 2 hours is highly ambitious.*
This talk is:
* interactive
* collaborative
* rushed 😅
**Ask questions!!**
## backrunner blueprint
- [x] **subscribe to mempool** txs on websocket provider
- [x] **filter for Uniswap** (SwapRouter02) trades
- [x] filter for `multicall`
- [x] **decode calldata** data using `abiDecoder`
- [x] filter for `exactInputSingle` & `exactOutputSingle`
- [x] extract trade data from multicall calldata
- *reminder: inner `deadline` param has to be removed*
- [x] filter for (`TOKEN -> WETH`) swaps ONLY
- assume executor will only hold WETH
- [x] **write executor** contract
- [x] accept trade data as param to `execute` function
- [x] buy tokens (which mempool user will have sold) on Uniswap
- (`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(-ish) mev-geth
- [x] use return value to determine whether bundle is worth sending
## TODO
- [ ] test contract against local mainnet fork
- [ ] deploy contract on mainnet & update `contracts.ts`