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.
weth-wrap - sends deposit on WETH contract
fake-tx - sends fake tx which does not pass simulation using CheckAndSend contract with the fake calldata.
eip7702-tx - illustrates Pectra update test workflow. The command does in 3 steps:
- construct and send
SetCodetransaction - get tx_receipt and verify that auth was set correctly
- use EOA account to execute tx batchcall using
BatchCallAndSponsorcontract.
eth-amount - sets value for tx. By default sets to 1 wei.
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
hintHashis detected
This command calls Flashbots Protect Transaction Status API and logs info txStatus.
For details, see: https://docs.flashbots.net/flashbots-protect/additional-documentation/status-api
-
mev/client.go: Implements a Flashbots client with methods for:SendBundleSimulateBundleSendPrivateTxGetTxStatus
-
mev/stream.go: Implements theHintsStream -
cmd/mevrepl/main.goincludes reference implementations forbackrun,hints-streamandsend-private-txflows
| Contract | Mainnet | Sepolia |
|---|---|---|
| WETH | 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 |
0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14 |
| CheckAndSend | 0xC4595E3966e0Ce6E3c46854647611940A09448d3 |
0xB0D90094d296DA87485C623a7f42d245A74036a0 |
| BatchCallAndSponsor | 0x775c8D470CC8d4530b8F233322480649f4FAb758 |
0x33ACD5b112a17c863beb2f37f785bAEf8a8f8369 |
Note: The following contracts, except WETH, are for testing purposes only. These contracts are not intended for production use.
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-streamThe 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())
}