Golang client for Ethereum and Flashbots JSON-RPC API calls.

Flashbots RPC client

Fork of ethrpc with additional Flashbots RPC methods:

  • FlashbotsGetUserStats
  • FlashbotsCallBundle
  • FlashbotsSendBundle
  • FlashbotsSimulateBlock: simulate a full block

Usage

rpc := flashbotsrpc.New("https://relay.flashbots.net")

// Creating a new private key here for testing; you probably would want to use an existing one
privateKey, _ := crypto.GenerateKey() 

// Query relay for user stats
result, err := rpc.FlashbotsGetUserStats(privateKey, 13281018)
if err != nil {
    log.Fatal(err)
}

// Print result
fmt.Printf("%+v\n", result)

You can find more examples in /examples/.

Owner
Chris Hager
Hacker, Maker, Engineer
Chris Hager
Similar Resources

Generates Golang client and server based on OpenAPI2 (swagger) definitions

Generates Golang client and server based on OpenAPI2 (swagger) definitions

ExperienceOne Golang APIKit ExperienceOne Golang APIKit Overview Requirements Installation Usage Generate standard project structure Define the API wi

Aug 9, 2022

gRPC to JSON proxy generator following the gRPC HTTP spec

gRPC to JSON proxy generator following the gRPC HTTP spec

The gRPC-Gateway is a plugin of the Google protocol buffers compiler protoc. It reads protobuf service definitions and generates a reverse-proxy server which translates a RESTful HTTP API into gRPC. This server is generated according to the google.api.http annotations in your service definitions.

Jan 3, 2023

A library to generate go models from given json files

A library to generate go models from given json files

generate A library to generate go models from given json files Requirements Go 1

May 18, 2022

Make Endpoint API using Golang, Mux Library, MySQL, and Redis

EndPoint API (Create and Read) I'm Using Golang, Mux Library, MySQL, and Redis Golang Documentation : https://go.dev/doc/ Golang Instalation : https:/

Dec 12, 2021

OpenAPI Client and Server Code Generator

This package contains a set of utilities for generating Go boilerplate code for services based on OpenAPI 3.0 API definitions

Dec 2, 2022

A simple HTTP/HTTPS API Gateway in Golang.

A simple HTTP/HTTPS API Gateway in Golang.

mice A simple API Gateway in Golang. Installation: Using go install: First install Go, if not already there Set GOPATH and GOBIN if not already set as

May 19, 2022

Gecho-starter - A starter/boilerplate for Golang Echo API

gecho-starter gecho-starter is a boilerplate for writing services in Golang quic

Jul 24, 2022

Appsearch - AppSearch Client for ElasticAppsearch

AppSearch Client for ElasticAppsearch Require Apikey Host init config func main(

Feb 17, 2022

CRUD API server of Clean Architecture with Go(Echo), Gorm, MySQL, Docker and Swagger

CRUD API server of Clean Architecture with Go(Echo), Gorm, MySQL, Docker and Swagger

CRUD API Server of Clean Architecture Go(echo) gorm mysql docker swagger build docker-compose up -d --build API Postman and Fiddler is recommended to

May 30, 2021
Comments
  • Include pos fields to bundle stats

    Include pos fields to bundle stats

    📝 Summary

    Flashbots updated bundle stats endpoint to include POS fields. (https://docs.flashbots.net/flashbots-auction/searchers/advanced/rpc-endpoint#flashbots_getbundlestats) This PR address this.Update bundle stats response to include pos fields.

    ✅ I have run these commands

    • [x] make lint
    • [x] make test
    • [x] go mod tidy
  • why need to strip beginning bytes

    why need to strip beginning bytes

    I'm confused with the following code. I have tried to figure out why need to strip rlp-encoded beginning bytes, but failed. Wish for your detail !!!

    https://github.com/metachris/flashbotsrpc/blob/master/flashbotsrpc.go#L681

    	// Might need to strip beginning bytes
    	if rlp[:2] == "b9" {
    		rlp = rlp[6:]
    	} else if rlp[:2] == "b8" {
    		rlp = rlp[4:]
    	}
    
  • support for EIP1559?

    support for EIP1559?

    hi, metachris, glad to see you share this package, I am able to wrap up a legacy tx and send mev successfully but when I try to wrap up an EIP1559 tx, the response always shows unable to decode tx I am wondering if this package currently supports EIP1559 txn?

  • Getting relay error: unable to decode bundle.

    Getting relay error: unable to decode bundle.

    I am getting list of ts and then calling rpc method eth_sendbundle. But flashbot server is not able to parse it.

           // generate the transact opts
           	topts, err := bind.NewKeyedTransactorWithChainID(wallet.PrivateKey, big.NewInt(cfg.ChainId))
    	log.CheckFatal(err)
    	topts.NoSend = true
    	topts.GasLimit = 10000000
    //  array of the txs
            txs := []string{}
    	tx, err := erc20.Transfer(topts, to, amount)
    	log.CheckFatal(err)
    	txBytes := &bytes.Buffer{}
    
    	err = tx.EncodeRLP(txBytes)
    	log.CheckFatal(err)
    	txs = append(txs, "0x"+hex.EncodeToString(txBytes.Bytes()))
    // generate the bundle
    	sendBundleArgs := flashbotsrpc.FlashbotsSendBundleRequest{
    		Txs:         txs,
    		BlockNumber: fmt.Sprintf("0x%x", blockNum),
    	}
    	var sigKey, _ = crypto.GenerateKey()
    	result, err := p.RPC.FlashbotsSendBundle(sigKey, sendBundleArgs)
    // check error
    	if err != nil {
    		if errors.Is(err, flashbotsrpc.ErrRelayErrorResponse) {
    			// ErrRelayErrorResponse means it's a standard Flashbots relay error response, so probably a user error, rather than JSON or network error
    			log.Error(err.Error())
    		}
    	}
    

    Can you tell not I am doing wrong, plz?

    Error:

    relay error response: unable to decode bundle
    
    
Solution & Framework for JSON-RPC over HTTP

JROH Solution & Framework for JSON-RPC over HTTP Why not OpenAPI? OpenAPI addresses the definition of RESTful APIs, when it comes to JSON-RPCs, some i

Mar 13, 2022
Kitex byte-dance internal Golang microservice RPC framework with high performance and strong scalability, customized extensions for byte internal.
Kitex byte-dance internal Golang microservice RPC framework with high performance and strong scalability, customized extensions for byte internal.

Kitex 字节跳动内部的 Golang 微服务 RPC 框架,具有高性能、强可扩展的特点,针对字节内部做了定制扩展。

Jan 9, 2023
Rpcx-framework - An RPC microservices framework based on rpcx, simple and easy to use, ultra fast and efficient, powerful, service discovery, service governance, service layering, version control, routing label registration.

RPCX Framework An RPC microservices framework based on rpcx. Features: simple and easy to use, ultra fast and efficient, powerful, service discovery,

Jan 5, 2022
Automatic Service Mesh and RPC generation for Go micro services, it's a humble alternative to gRPC with Istio.
Automatic Service Mesh and RPC generation for Go micro services, it's a humble alternative to gRPC with Istio.

Mesh RPC MeshRPC provides automatic Service Mesh and RPC generation for Go micro services, it's a humble alternative to gRPC with Istio. In a nutshell

Aug 22, 2022
A code generator that turns plain old Go services into RPC-enabled (micro)services with robust HTTP APIs.

Frodo is a code generator and runtime library that helps you write RPC-enabled (micro) services and APIs.

Dec 16, 2022
stack-rpc 快速开发包
stack-rpc 快速开发包

Micro 快速开发工具包 项目进行中 本仓库旨在提供面向 stack-rpc 生产环境的快速开发包。 目录 快速开始示例 控制台示例 以最常见的登录流程为例,实现一个场景简单,但包含微服务各种治理能力的示例 Hipster Shop示例 参考GoogleCloudPlatform/microser

Dec 29, 2022
This project implements p11-kit RPC server protocol, allowing Go programs to act as a PKCS #11 module without the need for cgo

PKCS #11 modules in Go without cgo This project implements p11-kit RPC server protocol, allowing Go programs to act as a PKCS #11 module without the n

Nov 30, 2022
Microservice Boilerplate for Golang with gRPC and RESTful API. Multiple database and client supported
Microservice Boilerplate for Golang with gRPC and RESTful API. Multiple database and client supported

Go Microservice Starter A boilerplate for flexible Go microservice. Table of contents Features Installation Todo List Folder Structures Features: Mult

Jul 28, 2022
A microservice gateway developed based on golang.With a variety of plug-ins which can be expanded by itself, plug and play. what's more,it can quickly help enterprises manage API services and improve the stability and security of API services.
A microservice gateway developed based on golang.With a variety of plug-ins which can be expanded by itself, plug and play. what's more,it can quickly help enterprises manage API services and improve the stability and security of API services.

Goku API gateway is a microservice gateway developed based on golang. It can achieve the purposes of high-performance HTTP API forwarding, multi tenant management, API access control, etc. it has a powerful custom plug-in system, which can be expanded by itself, and can quickly help enterprises manage API services and improve the stability and security of API services.

Dec 29, 2022
Poc-krakend: Allows you to create, modify and delete enpoints in "configuration.json" without restart the application.

poc-krakend Description This POC is for test dynamic (Hot reload) routes in krakend. Allows you to create, modify and delete enpoints in "configuratio

Jan 26, 2022