/AntiMEV

Tracking MEVs through Graph Neural Networks

Primary LanguageJavaScript

AntiMEV

The AI way of tracking MEV Transactions!

This project uses Graph Neural Networks to track transactions happening on-chain. Here's a live demo for you !

Overview

Architecture

The project is a comprehensive one & involves 3 separately working parts linked to each other privately & securely using Lit Actions.

The first part of the project is the dataset generation. The transactions are fetched and labelled as MEV & Non-MEV according to the algo mentioned below : image

The architecture for the GNN we are using is as shown :

image

The second part of AntiMEV involves training the GNN using the dataset generated from Part 1.

The final part is the user side. The trained model is hosted as an API . The user calls the main contract that interacts with the Oracle Contract through Lit Actions again(securely) & the oracle then calls the off-chain GNN with an input which is the tx_hash & the blockNumber that user gave as input and wants to scan it. The output is sent back by oracle using the callback function used in the contract.

This is how AntiMEV makes MEV tracking & analysis faster & efficient than ever!

Check out below on how to use it.

How to Use

Case-1 : You just wish to scan your transaction ( For 98% of the users).

Well, for this you can directly use this link.

Case-2 : You wish to train the Model.

  1. Clone the repository

    git clone git@github.com:star-gazer111/MEVSpy.git && cd MEVSpy
  2. Open a terminal & start the model API

    cd GNN && python main.py
  3. Start another terminal & test your requests onto the API using CLI.

    python predict.py
  4. Open another terminal & start LitNode

    cd backend && node run_scripts.js
  5. Start the training!

    cd TrainArbinet && ./run.sh

    In case, you get permission denied , make the script executable using :

    chmod +x run.sh
  6. Start the frontend

    cd App && cd client && cd src && npm i
  7. Run!

    npm run dev

Be sure to replace the url here with your own endpoint after running the api above.

Citation

@article{park2023unraveling,
  title={Unraveling the MEV Enigma: ABI-Free Detection Model using Graph Neural Networks},
  author={Park, Seongwan and Jeong, Woojin and Lee, Yunyoung and Son, Bumho and Jang, Huisu and Lee, Jaewook},
  journal={arXiv preprint arXiv:2305.05952},
  year={2023}
}