# How to Build an Arbitrage Bot

[Canonical page](<https://marcofasanella.com/projects/mev-arbitrage-bot-research/>)

Academic year 2021–22

A co-authored research and benchmark study of the architecture behind a decentralized-exchange arbitrage searcher on Ethereum.

## Context

Research project at the Polytechnic University of Milan, co-authored with Elia Maggioni and Lucas Manini.

## Role

Co-author

## Contribution

Co-authored a model for cyclic arbitrage across decentralized exchanges and a two-stage architecture: startup-time market-graph construction followed by block-driven state synchronization and arbitrage-path evaluation.

## Outcome

Built a benchmark implementation to examine graph-construction space and runtime costs, including synchronization and arbitrage checks. The report documents the architecture, complexity analysis, and benchmark results.

## Stack

- Go
- Ethereum
- Balancer
- The Graph
- go-ethereum abigen

This report studies automated arbitrage across Ethereum-based decentralized exchanges. It models trade cycles across liquidity pools and describes how to search for opportunities as new blocks arrive.

The proposed system separates startup-time work, which builds the market graph and candidate paths, from a runtime module that syncs pool state and evaluates those paths. A Go benchmark implementation is used to analyze graph-construction space requirements and runtime costs. The report focuses on system architecture and performance evaluation.

## Downloads

- [Research report](<https://marcofasanella.com/downloads/MEV-Arbitrage-Bot-Research-Politecnico-di-Milano.pdf>) (PDF · 882814 bytes)
