Code Monkey home page Code Monkey logo

flashbots-demo's Introduction

flashbots-demo

This is a demo bot written in go that uses flashbots v0.2 on the Goerli testnet, and works out of the box. Feel free to take this and use it as the starting point for your own MEV bot.

Demo flow

This bot creates a simple bundle that does the following:

  1. Deposit 1 eth into the WETH token. It's using the same WETH contract used by uniswap on goerli.
  2. Withdraw 0.5 WETH back into eth, leaving 0.5 as WETH.
  3. Call FlashbotsCheckAndSend to check that the remaining WETH balance is the previous balance + 0.5.
  4. If the check passes, transfer 0.1 eth to the miner.

I've deployed FlashbotsCheckAndSend to goerli and included the address in this demo. Feel free to deploy your own version, or modify the code to use your own.

Since this demo is leaving half of each deposit in WETH, you will eventually run out. I'm leaving it as an exercise to the reader to figure out how to withdraw the rest of your eth.

Setup

First, you'll need a wallet. You can generate a new wallet using the following:

go run init/init.go > .env

Update the created .env file with the correct URL for your provider.

Next, you need some eth. You can request some from the Goerli social faucet. You'll need to tweet your new address and provide the link to the faucet.

Running the demo

Once you have a wallet with some eth and you've setup your .env file, you're ready to run the bot

go get

make run

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.