Skip to content

Template for building Rust-based MEV / frontrunning / sandwich bots.

Notifications You must be signed in to change notification settings

truemiller/rust-mev-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust MEV template

  • Template for building Rust-based MEV / frontrunning / sandwich bots.
  • Created to learn more about blockchain MEV and Rust.
  • Use it as a starting point.

Dependencies

  • Rust

Requirements

  • WebSocket node (e.g. QuickNode, Alchemy, ...)
  • Hosting near the node (for low latency) (optional)

Foreword

  • Fork it, go crazy.
  • Contributions, or error fixes, welcomed via PR.
  • Far from complete; a starting point.
  • Severe lack of MEV resources, I hope this helps getting started.
  • Not all chains expose mempool data.

Why?

  • Attaining a better understanding of MEV.
  • Rust chosen for its performance and multi-threading.
  • Websockets for fast transaction detection, mempool access.
  • Uniswap V2 routers because they're easy to understand.

What it does

  • Listens to mempool
  • Uses websockets for fastest possible detection
  • Asynchronously checks if transactions are made against a specific router

What it doesn't do

  • Make money
  • Handle errors

What you need to do

  • Add your own logic
  • Add your own error handling
  • Add your own websocket node
  • ... and more

Other notes

  • main.rs is the entry point.
  • /abi contains a few router ABIs I've used
    • they're uniswap v2 variants
    • mev1.json is a custom ABI for a custom MEV contract (will see if I can find the source for this at some point) (not required, but can save gas fees)
  • Will release other experiments in the future, need to sanitize repos.

About

Template for building Rust-based MEV / frontrunning / sandwich bots.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages