This command-line tool provides an interactive REPL-style interface for testing and demonstrating various Flashbots
MEV-Share workflows.
It is intended as a reference implementation and experimentation tool for developers exploring MEV flows such as hint
decoding, backrunning, and private transaction submission
Sends a test private transaction using
the Flashbots Protect RPC endpoint.
Demonstrates how to submit transactions privately to avoid frontrunning and failed tx.
Connects to the MEV-Share Server-Sent Events (SSE) stream and listens for real-time hint messages.
Useful for observing and debugging MEV-Share hint flows.
Illustrates a basic MEV backrun flow:
- Sends a private transaction
- Listens to the hint stream
- Sends a backrun transaction when a matching
hintHash
is detected
--eth-amount set value for tx. By default sets to 1 wei.
--tx-type available types: weth-wrap, builder-tip. By default weth-wrap
-
mev/client.go
: Implements a Flashbots client with methods for:SendBundle
SimulateBundle
SendPrivateTx
GetTxStatus
-
mev/stream.go
: Implements theHintsStream
-
cmd/mevrepl/main.go
includes reference implementations forbackrun
,hints-stream
andsend-private-tx
flows
export FLASHBOTS_ETH_PRIVATE_KEY=$1; export FLASHBOTS_ETH_PRIVATE_KEY_2=$2
NETWORK={mainnet/sepolia} go run main.go <command>
NETWORK=sepolia go run main.go backrun --eth-amount 200000000000000000
NETWORK=mainnet go run main.go hints-stream
The example shows init subscription on MEV-Share hints stream. SubscriptionOpts
is available to customize ping and retry timeouts, and max retries to establish connection.
ch := make(chan mev.Hint)
stream, err := mev.SubscribeHints(context.Background(), "https://mev-share.flashbots.net", ch, nil)
if err != nil {
panic(err)
}
go func() {
<-time.After(time.Second * 5)
close(ch)
}()
for hint := range ch {
fmt.Println("Parsed hint", hint)
}
if err := stream.Error(); err!=nil {
panic("error returned from stream connection: "+err.Error())
}