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

Overview

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/.

Issues
  • 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?

    opened by xlk3099 1
  • 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:]
    	}
    
    opened by github1youlc 1
  • 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
    
    
    opened by harsh-98 0
Releases(v0.5.0)
Owner
Chris Hager
Hacker, Maker, Engineer
Chris Hager
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

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

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

CloudWeGo 4.8k Aug 11, 2022
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,

ZYallers 1 Jan 5, 2022
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

AstraNet Toolkit 68 Apr 19, 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.

Monadic 19 Jul 22, 2022
stack-rpc 快速开发包

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

Stack Labs 383 Jul 26, 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

Google 42 Jun 28, 2022
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

Ahmad Saugi 14 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.

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.

Eolink 247 Aug 11, 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

Arturo Elias 4 Jan 26, 2022
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

Experience One 143 Aug 9, 2022
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.

gRPC Ecosystem 13.8k Aug 8, 2022
A library to generate go models from given json files

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

null 2 May 18, 2022
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

Discord Gophers 45 Jul 28, 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:/

Fulgentius Jasper 0 Dec 12, 2021
Appsearch - AppSearch Client for ElasticAppsearch

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

Rohmat mret 0 Feb 17, 2022
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

Mike 7 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

Jesse Pham 5 Jul 24, 2022
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

null 303 May 30, 2021