destiner / mev-inspect-js Goto Github PK
View Code? Open in Web Editor NEWA JS port of "mev-inspect-py" optimised for ease of use.
License: MIT License
A JS port of "mev-inspect-py" optimised for ease of use.
License: MIT License
Currently, it doesn't distinguish between e.g. Uniswap V2 and Sushiswap. It would need to have an "address -> fork name" mapping across supported chains. Forks outside this mapping may be mapped as "Unknown fork" or excluded completely.
Since we rely on event logs instead of call traces, and we know what logs to look for in advance, it would likely be more efficient to fetch them via eth_getFilterLogs
. This is especially useful when looking for MEV across hundreds of blocks.
While #11 is helpful, its information is limited: as I realised, Flashbots misses quite a handful of easy-to-detect MEV. Another strategy might be first to identify a few active MEV bots, and then analyse their transactions. Since we know they are bots, any transaction involving them in which we can't find MEV would be suspicious, and might hint at missing some arbitrage.
Example tx: 0x01cba79049f6506d01210608351d414ad11a800451b1d34b828531f454f041c3
.
Example tx: 0x336151dd41fe447f05d6ef0bde9b0fdf6d4455b39e08c93c4a7c94ba89ef4a3c
.
Now that I'm relatively confident that the package works well for a simple swaps and arbs, it would be cool to test it against transactions with large number of swaps and token transfers coming from several protocols.
Example txs:
0xc785c5713ef1d2e527559746004276f15aaedf62503b670bdf16e156b82aa39b
0xa87d22940d3b93b491683de99d48cab79c171fe1535586862e0c0ace381928f0
Tx: 0x08b606f3c528907688cdcab26a70cea2b9dd409850838662eb4b98a30ac33900
.
Found in #11.
Example tx TBD.
When executing:
const inspector = new Inspector(1, provider);
I got error:
Error [ERR_REQUIRE_ESM]: require() of ES Module /home/myhome/Documents/ethereum/solidity/searcher/node_modules/mev-inspect/lib/index.js from /home/myhome/Documents/ethereum/solidity/searcher/index.ts not supported.
Instead change the require of index.js in /home/myhome/Documents/ethereum/solidity/searcher/index.ts to a dynamic import() which is available in all CommonJS modules.
However if I add
"type": "module",
in my package.json, I got error:
ReferenceError: exports is not defined in ES module scope
I am using nvm version 0.38.0
Tx: 0xd53808dc31c908b7acad610d5efa726afe67e7c9739083be9c1b4cb6d2cdaeac
.
In the swap with the log index 10, sender
set to 0x58418d6c83efab01ed78b0ac42e55af01ee77dba
, while the actual erc20 token sender 0x5aa3393e361c2eb342408559309b3e873cd876d6
(as seen in transfer with the log index 7). This breaks arbitrage detection heuristics.
Uni V3 might also be subject to this.
In most cases, both from
and to
addresses are the same. Sometimes though, they are different, which breaks the algorithm.
Example txs:
0x49fb0fb07827b3e6fa425fbb7ef1f1fbe3dfedbf656519bfe6d4bf9391aea1d2
.0xcce82565d597057f6d0391fecb139e773cd9cac9a5f9d9ee5a21f7aa2b912bd3
First pass at testing/validation on real data.
Run mev-inspect-js against a number of consecutive blocks, and compare the found MEV with the data in the same period from Flashbots explorer.
Before extracting swaps, we need to fetch pool assets from the blockchain. It's faster to fetch the assets in batches via Multicall.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.