Skip to content

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

License

Notifications You must be signed in to change notification settings

saman-pasha/flashxroute

 
 

Repository files navigation

Flashbots bloXroute MEV-Services RPC client

Test status

Fork of flashbotsrpc which is forked of ethrpc with additional bloXroute methods:

  • BloxrouteSimulateBundle
  • BloxrouteSubmitBundle
  • BloxrouteBrmSimulateBundle (BackRunMe)
  • BloxrouteBrmSubmitBundle (BackRunMe)
  • BloxrouteSendTransaction
  • BloxrouteSimulateBlock: (simulate a full block)

Usage

Add library to your project:

go get github.com/saman-pasha/flashxroute

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)

More examples

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

About

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

Resources

License

Stars

Watchers

Forks

Languages

  • Go 99.5%
  • Makefile 0.5%