• Stars
    star
    136
  • Rank 267,670 (Top 6 %)
  • Language
    Go
  • License
    MIT License
  • Created over 3 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Golang client for Flashbots Relay, mev-geth and standard Ethereum JSON-RPC API endpoints

Flashbots RPC client

Test status

Fork of ethrpc with additional Flashbots RPC methods:

  • FlashbotsCallBundle (eth_callBundle)
  • FlashbotsSendBundle (eth_sendBundle)
  • FlashbotsGetUserStats (flashbots_getUserStats)
  • FlashbotsSendPrivateTransaction (eth_sendPrivateTransaction)
  • FlashbotsCancelPrivateTransaction (eth_cancelPrivateTransaction)
  • FlashbotsSimulateBlock: simulate a full block

Usage

Add library to your project:

go get github.com/metachris/flashbotsrpc

Create a new private key here for testing (you probably want to use an existing one):

privateKey, _ := crypto.GenerateKey()

Simulate transactions with eth_callBundle:

callBundleArgs := flashbotsrpc.FlashbotsCallBundleParam{
    Txs:              []string{"YOUR_RAW_TX"},
    BlockNumber:      fmt.Sprintf("0x%x", 13281018),
    StateBlockNumber: "latest",
}

result, err := rpc.FlashbotsCallBundle(privateKey, callBundleArgs)
if err != nil {
    log.Fatal(err)
}
fmt.Printf("%+v\n", result)

Get Flashbots user stats:

rpc := flashbotsrpc.New("https://relay.flashbots.net")
result, err := rpc.FlashbotsGetUserStats(privateKey, 13281018)
if err != nil {
    log.Fatal(err)
}
fmt.Printf("%+v\n", result)

Send a transaction bundle to Flashbots with eth_sendBundle:

sendBundleArgs := flashbotsrpc.FlashbotsSendBundleRequest{
    Txs:         []string{"YOUR_RAW_TX"},
    BlockNumber: fmt.Sprintf("0x%x", 13281018),
}

result, err := rpc.FlashbotsSendBundle(privateKey, sendBundleArgs)
if err != nil {
    log.Fatal(err)
}
fmt.Printf("%+v\n", result)

Send a transaction bundle to a list of Builder endpoints with eth_sendBundle (full example [/examples/broadcastbundle]):

urls := []string{
	"https://relay.flashbots.net",
    // Refer to https://www.mev.to/builders for builder endpoints 
}
rpc := flashbotsrpc.NewBuilderBroadcastRPC(urls)

sendBundleArgs := flashbotsrpc.FlashbotsSendBundleRequest{
    Txs:         []string{"YOUR_RAW_TX"},
    BlockNumber: fmt.Sprintf("0x%x", 13281018),
}

results := rpc.BroadcastBundle(privateKey, sendBundleArgs)
for _, result := range results {
    if result.Err != nil {
        log.Fatal(result.Err)
    }
    fmt.Printf("%+v\n", result.BundleResponse)
}

More examples

You can find example code in the /examples/ directory.

More Repositories

1

logzero

Robust and effective logging for Python 2 and 3.
Python
1,028
star
2

pdfx

Extract text, metadata and references (pdf, url, doi, arxiv) from PDF. Optionally download all referenced PDFs.
Python
1,002
star
3

typescript-boilerplate

A modern TypeScript project setup, for Node.js and browsers
TypeScript
586
star
4

vue-highlightjs

Syntax highlighting with highlight.js for Vue.js 2.x
JavaScript
336
star
5

RPIO

RPIO is a GPIO toolbox for the Raspberry Pi.
C
325
star
6

appengine-boilerplate

Boilerplate setup for App Engine with html5-boilerplate 2.0, OpenID, memcache, user preferences, and more
JavaScript
185
star
7

eth-go-bindings

Go bindings for Ethereum smart contracts: ERC20, ERC165 and ERC721, ERC777, ERC1155
Go
87
star
8

py2app

Fork of the original py2app from https://bitbucket.org/ronaldoussoren/py2app
Python
72
star
9

flashbots

Flashbots utilities in Go: Blocks & Transactions API, and tools to spot bundle and block irregularities
Go
42
star
10

flashbots-ethers-example

Flashbots Ethers TypeScript example for Node.js and browser
TypeScript
37
star
11

most-simple-ajax-chat-ever

Fun project from back in 2006 ^^
HTML
30
star
12

micropython-ctl

TypeScript library for talking to MicroPython devices from websites/webapps, Node.js and Electron apps
TypeScript
27
star
13

raspberrypi-utils

Collection of utilities for the Raspberry Pi
Python
21
star
14

go-ethutils

Go helpers for working with Ethereum.
Go
20
star
15

feedmailer

RSS to Email Webapp (Python, AppEngine)
Python
17
star
16

retrofit2-samples

Samples for Retrofit 2.0
Java
15
star
17

wpscanner

Wordpress security scanner written in Python
Python
13
star
18

micropython-captiveportal

Minimal async captive portal for MicroPython (compatible with uasyncio v3/MicroPython 1.13+ as well as earlier versions)
Python
11
star
19

eth-was-tx-uncled

Go
11
star
20

django-boilerplate

Django Boilerplate
Python
10
star
21

binary-serializer

Minimalistic binary serialization protocol (a la protocol buffers) with Python and Java implementations.
Python
9
star
22

rfid-music-player

A simple RFID music player for kids (runs on a Raspberry Pi)
Python
9
star
23

coz-python-smart-contract-workshop

8
star
24

raspberrypi-django

Raspberry Pi Django Setup
Python
8
star
25

python-posix-daemon

Simple and efficient Python daemon framework based on Sander Marechal's code.
Python
7
star
26

android-bluetooth-spp

Bluetooth Serial Communication with Android + PC/Arduino
Python
7
star
27

jekyll-boilerplate

CSS
7
star
28

metalab-git-workshop

Repository for the GIT Workshop at Metalab
6
star
29

android-apprater

Prompt engaged users to rate your app in the Android market
Java
5
star
30

flashbots-tx-telegram-bot

Telegram bot to notify about failed 0-gas and flashbots tx
Go
3
star
31

GridGrouper

Group similar members close to each other in a grid
Python
2
star
32

tornado-boilerplate

Boilerplate for the tornado web framework
JavaScript
2
star
33

pdfx-gui

PyQt/QML Gui for PDFx
Python
2
star
34

androidsnippets.com

Rewrite of androidsnippets.com for relaunch
Python
2
star
35

photoblog

Python
2
star
36

micropython-minimal-webserver-asyncio3

Minimal MicroPython webserver / TCP connection handler using uasyncio v3 (MicroPython 1.13+), with fallback for earlier versions of uasyncio / MicroPython
Python
2
star
37

infomatic

Software for Picture in Picture Mode with a Raspberry Pi
Python
1
star
38

photoblog-styles

1
star
39

pifm

C
1
star
40

HN-Reduce

Chrome extension to remove stories on HN
JavaScript
1
star
41

Climbing-Log

Java
1
star
42

clicklooper

Raspberry Pi audio player which jumps to next album on mouse click
Python
1
star
43

metachris.github.com

JavaScript
1
star
44

raspberrypi-tools

Shell
1
star
45

python-tornado-tcp-boilerplate

Python
1
star
46

python-raspberrypi-boilerplate

Boilerplate Python Project for the Raspberry Pi
Python
1
star
47

Snapshotter

web.py app that takes snapshots from a website and stores them in S3
Python
1
star
48

pypi-downloads-tracker

Python
1
star
49

csspivot

JavaScript
1
star
50

boilerplates

various boilerplates
Vim Script
1
star
51

neo-cli-ci

Continuous integration setup for neo-cli
Shell
1
star