Flashbox orderflow APIs
A bot in a Flashbox has two orderflow sources. It connects to them from inside the container. The firewall of the VM allows these endpoints by IP address, and the streams are on only in production mode.
| Source | Subscribe | Send bundles |
|---|---|---|
| MEV-Share transaction stream | https://tx.tee-searcher.flashbots.net | https://backruns.tee-searcher.flashbots.net |
| BuilderNet bottom of block | wss://rpc.buildernet.org/bob | https://rpc.buildernet.org |
There is no DNS in production mode. The VM maps these hostnames to their addresses inside the container, so connect by hostname.
MEV-Share transaction stream
See MEV-Share transaction stream for what the stream carries.
You receive every transaction sent to MEV-Share whose sender allows sharing with TEE searchers. Flashbots Protect transactions with fast mode enabled allow it by default. Transactions are shared with the full hint: every field of the pending transaction except the signature (v, r, s).
Send backruns in the MEV-Share mev_sendBundle format. The MEV-Share docs have client libraries and examples.
The bundle endpoint is reachable in both modes. The transaction stream is on only in production mode.
BuilderNet bottom of block
Subscribe to state diffs
Connect to wss://rpc.buildernet.org/bob and subscribe:
{ "jsonrpc": "2.0", "id": 1, "method": "eth_subscribe", "params": ["flashbots_stateDiffs"] }
The reply carries the subscription id:
{ "jsonrpc": "2.0", "id": 1, "result": 4273862109 }
You then receive one message for each candidate block:
{
"jsonrpc": "2.0",
"method": "flashbots_stateDiffs",
"params": {
"subscription": 4273862109,
"result": {
"blockNumber": "String", // Hex, the block number that the builder is building
"blockTimestamp": "String", // Hex, seconds since the Unix epoch
"blockUuid": "String", // UUID of this candidate block
"stateOverrides": { // Each changed address
"<address>": {
"balance": "String",
"nonce": "String",
"code": "String", // Bytecode of a contract created in this block, or 0x for an account destroyed in it
"stateDiff": {
"<storage slot>": "String"
}
}
}
}
}
}
What the stream carries:
- Each message is the full state diff of one candidate block against its parent. It is not a change since the previous message.
- It includes the effect of private orderflow that BuilderNet received. You see the state changes but not the transactions.
- It does not include other searchers' bottom-of-block bundles.
- Messages start 1 second before the slot and continue until 2 to 4 seconds after it starts. Each builder sends a message for the blocks it submits, typically between 60 and 300 per slot. A subscriber that reads slowly can miss messages.
stateOverrides has the shape of an eth_call state override, so you can simulate against it directly.
Send bottom-of-block bundles
Send eth_sendBobBundle to https://rpc.buildernet.org:
{
"jsonrpc": "2.0",
"id": 1,
"method": "eth_sendBobBundle",
"params": [
{ // The fields of eth_sendBundle
txs,
blockNumber
},
targetUuid, // String, the blockUuid of the candidate block that the bundle targets
targetPools // Array[String], the pool addresses that the bundle targets
]
}
- BuilderNet accepts
targetUuidandtargetPoolsin these positions and ignores them today. Their place in the request may change when they are supported. - A bundle from a Flashbox is only considered at the bottom of the block, because your bot has seen the block. This also holds when the bundle object has
targetPoolsortargetLogs. - Sign the request with the
X-Flashbots-Signatureheader, as foreth_sendBundle. - The bundle object takes the same fields as
eth_sendBundle, includingreplacementUuid.
How bottom-of-block bundles are ordered
After the builder has built a block, and if there is time left, it tries bottom-of-block bundles in the order of what it expects each to pay. The estimate comes from simulating each bundle at the bottom of earlier candidate blocks of the same slot. Bundles from a Flashbox and bottom-of-block bundles from outside compete in the same order.