A JS port of
mev-inspect-py optimised for ease of use.
While mev-inspect-py is a great resource, I think that there are a few changes can be made to make historical MEV data more accessible. Here are some defining decisions:
- Written in Typescript: easier to run in browser/node, while keeping the code type-safe
- Decoupled from the infra layer: message query, caching, and persistence layers can be added independenty when/if they needed
- Decoupled from pricing: to calculate profit and cost in USD, a pricing provider of your choice can be used
- Added single transaction inspection: while missing some types of MEV, this is helpful for quick transaction review
- Using logs instead of call traces: any historical node would work
This package uses BigInt. If you use a bundler, you may want to set target to
This package is a pure ESM package. Follow this guide for more info.
npm i mev-inspect
TODO. For usage examlples, see
You can run examples using
ts-node, for example:
npx ts-node --esm examples/arbitrage.ts
How it works
It starts by fetching all event logs for a given transaction or block. Then, it "sorts" logs based on their source and type. From those logs, it extracts swap data. It then analyzes the swaps to find arbitrage.
The project is at the "proof of concept" stage. Currently, only arbitrage is detected on Balancer, Uniswap, and their forks.
- distinguish forks