Skip to content

An extensible and practical demonstration of constructing evm-based sandwich attacks built with ethers-rs and Huff contracts.

License

Notifications You must be signed in to change notification settings

Optimiswise/subway-rs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

subway-rs • ci license twitter

Construct evm-based sandwich attacks using Rust and Huff.

What is this?

subway-rs is a port of libevm's original subway, implemented with ethers-rs and huff.

Having highly optimized contracts is just one part of the equation, a tech stack is just as important as the contracts to execute on the opportunities. Source: libevm/subway

If having a tech stack is just as important as optimized, secure contracts, then why not use the best language available for speed, dependability, and scalability? This is the sandwich-rs bot: A pure-rust bot used to execute sandwich attacks on UniswapV2. The bot's goal is to act as a low barrier of entry for rust-based MEV development - Reference source code for aspiring new searchers.

It's fast. But don't take our word for it, just check out the benchmarks.

Current abilities:

  • Watch pending transactions in the mempool.
  • Decode Transaction data for Uniswap V2 Calls. (and more soon!)
  • Verbose telemetry reporting using tracing.
  • Search for profitable strategies efficiently using a variety of algorithms.
  • Calculate gas bribes.
  • Simulate and Execute Flashbot Bundles.

Future Improvements

Although the bot functions, it is simplistic and certainly not competitive. Accept that advanced searchers to already be executing far beyond the current capabilities. That being said, below is a non-exhaustive list of low hanging fruit to further subway-rs along.

  • Deployment logic for contracts
  • Circuit Breakers
  • Alerting (see: https://github.com/DeGatchi/mev-template-rs)
  • Poision Token Filtering
  • Caching + Memoization
  • Enhanced Logging Filters
  • Zero-cost Gas Savings 👀
  • Real-time Benchmarking
  • Improved Parallelization
  • Persistent Execution Storage and Tracking (eg: psql, a rekt threshold, P&L)
  • Refactored Wallet Management

Again, please be aware, this bot is intended as a piece of educational content, and not for production use. It has not been run in production, and should not be used in such an environment.

Blueprint

.
├─ bot — A Highly Optimized Sandwich Bot Built with Pure Rust and Huff.
|  └─ ...
└─ contracts — UniswapV2 sandwich attack contracts.
   └─ ...

Acknowledgements

Contributing

All contributions are welcome!

Please reach out to asnared on twitter for any questions or open an issue.

About

An extensible and practical demonstration of constructing evm-based sandwich attacks built with ethers-rs and Huff contracts.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 73.4%
  • Solidity 24.9%
  • Dockerfile 1.7%