Western Gate

Flashbots and related projects are optimizing the measurement and capture of arbitrage on Ethereum. Scaling solutions like Polygon create new cross-chain arbitrage opportunities. The purpose of Western Gate is to measure and report Ethereum-Polygon arbitrage in real-time.


Arbitrage on Ethereum and the related topic of Miner Extractable Value (MEV) is well-understood, with a mature community and tools to efficiently measure and capture it. However, cross-chain arbitrage/MEV has not yet been explored in the public setting. Western Gate tracks some of the cross-chain arbitrage available between Ethereum, Polygon, and Binance Smart Chain. Most arbitrage opportunities are small. However, MEV is not just arbitrage. To capture MEV, various "optimizations" are used, like front and back-running, and sandwich attacks. If we continue with this project, we will incorporate estimates of potential profits when MEV optimizations are included. Most of our data is obtained from The Graph. However, on BSC, PancakeSwap has the most liquid pools. PancakeSwap is notoriously difficult to Index. We owe special thanks to the StreamingFast team for giving us access to their high-speed PancakeSwap end-point for this project!

Western Gate showcase

How it's made

This project tracks the amount of cross-chain arbitrage between Ethereum, Polygon, and Binance Smart Chain. We only analyze exchanges based on Uniswap v2. On Ethereum, we track Uniswap v2 and SushiSwap. On Polygon we track SushiSwap and QuickSwap. An analysis of Uniswap markets explains how optimal trading on Uniswap v1 and v2 may be framed as a convex optimization problem. This implies that optimal swaps through a chain of Uniswap-type DEXs is also a convex problem. We call a sequence of swaps a "path". Given a hypothesis path through various DEXs, we solve for the amount of "input token" that will result in the most profit of that same token being output. We search over 30,000 paths and rank the best opportunities.

Technologies used

PolygonThe GraphUniswap