TCP submissions
The Ultra Sound relay accepts bid submissions over TCP for latency-sensitive builders. Keep one TCP connection open per builder pubkey and stream submissions over it.
TCP submissions support everything HTTP does except non-cancellable bids, plus compact v2 dehydrated submissions and merging data. We recommend v2: it is fewer bytes to send for your builder and fewer to process for our relay.
Compared to HTTP
- Every TCP submission is cancellable, the same as HTTP with
cancellations=true: a newer bid replaces your previous one even if it is lower. See floor-bid.md. - The sequence number in the submission header takes the place of
x-sequence. - Rate limits are the same, and shared with your HTTP submissions. See rate-limits.md.
Getting started
We expect to charge $3,000/month for dedicated TCP access, but you're welcome to try it for free. Contact us on Telegram to get started.
- Ask us on Telegram for an API key and connection details. The API key is a UUID, separate from your HTTP
X-Api-Token. - Send a registration frame with your API key and pubkey.
- Stream submissions, and read the responses as they come back.
Frames
Everything on the connection, in both directions, is a frame:
| Bytes | Field | Encoding |
|---|---|---|
| 4 | Payload length | Little-endian u32 |
| 8 | Send time, nanoseconds since the unix epoch | Little-endian u64 |
| N | Payload |
Registration
The first frame must be a registration. The payload is SSZ, 64 bytes:
| Bytes | Field |
|---|---|
| 16 | API key, the raw bytes of the UUID |
| 48 | Builder BLS pubkey |
The pubkey must be one of yours. If the API key or the pubkey does not check out, we close the connection. All submissions on the connection must be for the registered pubkey.
Submissions
A submission payload is a 6-byte header followed by the SSZ body.
| Bytes | Field | Encoding |
|---|---|---|
| 4 | Sequence number | Big-endian u32 |
| 1 | Merge type | 0 none, 1 mergeable, 2 append only |
| 1 | Flags | Bitmask, see below |
Sequence number. Increase it with every submission in a slot. A new bid replaces your current one only if its sequence number is higher.
Merge type. The same as the x-merge-type HTTP header, see block merging for builders.
Flags.
| Bit | Flag | Meaning |
|---|---|---|
| 0 | IS_DEHYDRATED | Body is a v1 dehydrated submission, the same format as HTTP with x-hydrate, see builder-getting-started.md |
| 1 | WITH_ADJUSTMENTS | Body carries adjustment data, see bid-adjustment.md |
| 2 | ZSTD_COMPRESSED | Body is zstd compressed |
| 3 | PESSIMISTIC | Ignored |
| 4 | DEHYDRATED_V2 | Body is a v2 dehydrated submission |
| 5 | MERGING_V2 | Merging data is v2, needs merge type 1 |
Body. SSZ:
- With
DEHYDRATED_V2orMERGING_V2: a container of the submission, then the adjustment data ifWITH_ADJUSTMENTSis set, then the merging data if the merge type is mergeable. - Otherwise: the same body as over HTTP. The one exception is a full mergeable submission without adjustments, which is a container of the submission and then the merging data.
Dehydrated submissions v2
Send each transaction, blob and withdrawals list once per slot, then refer to it by a 64-bit key.
// All types are assuming Fulu fork
struct DehydratedBidSubmissionV2 {
message: BidTrace,
// transactions holds only the transactions not sent earlier in this slot
execution_payload: ExecutionPayload,
blobs_bundle: DehydratedBlobsBundleV2,
execution_requests: ExecutionRequests,
signature: BlsSignature,
tx_root: Option<B256>,
tx_refs: Vec<u64>,
withdrawals_ref: u64,
}
struct DehydratedBlobsBundleV2 {
refs: Vec<u64>,
new_items: Vec<BlobItem>,
}
tx_refs: one entry per transaction in the block, in block order. Either the key of a transaction you sent earlier in the slot, or0to take the next transaction fromexecution_payload.transactions. For a blockA B Cwhere onlyBis new:transactions = [B],tx_refs = [key(A), 0, key(C)].blobs_bundle.refs: the same for blobs. Either the key of a blob sent earlier, or0for the next entry ofnew_items.withdrawals_ref:0when the withdrawals are inexecution_payload.withdrawals, otherwise the key of a withdrawals list sent earlier in the slot.
Keys are 64-bit FxHash values:
- Transaction: FxHash of its last 67 bytes, the same key as in v1 dehydrated submissions.
- Blob: FxHash of its KZG commitment.
- Withdrawals list: FxHash over each withdrawal's index, validator index, address and amount, in order.
We cache per slot and per builder pubkey, and the cache is shared with your HTTP dehydrated submissions. Frames on a connection are processed in the order they arrive, so a submission can refer to items sent in the frame right before it.
Merging data v2
With MERGING_V2 set, the merging data is:
struct BlockMergingDataV2 {
allow_appending: bool,
builder_address: Address,
orders: Vec<OrderV2>,
tx_codes: Vec<OrderTxCodes>,
}
struct OrderV2 {
start: u16, // index of the order's first transaction in the block
len: u8, // number of consecutive transactions in the order
flags: u8, // bit 0: LATEST_ONLY, bit 1: ALL_REVERT
}
struct OrderTxCodes {
order: u16, // index into orders
codes: Vec<u8>, // 2 bits per transaction of that order
}
- Every order is a run of consecutive transactions in the block.
- An order of one transaction without
LATEST_ONLYis a single transaction.ALL_REVERTmarks it as allowed to revert. - A longer order, or any order with
LATEST_ONLY, is a bundle.ALL_REVERTlets every transaction in it revert. - Only a bundle whose transactions behave differently needs an
OrderTxCodesentry. Transactioniof the order sits at bits2 * (i % 4)of bytei / 4:0must succeed,1may revert,2may be dropped. An order with codes must not also setALL_REVERT. - A
LATEST_ONLYorder is only used while it is in your most recent submission.
Without MERGING_V2 we expect the v1 merging data, the same as over HTTP.
Responses
Every submission frame gets one response frame. The payload is SSZ:
| Field | Type |
|---|---|
| Sequence number | u32 |
| Request id | 16 bytes UUID |
| Status | u8: 0 ok, 1 invalid request, 2 internal error |
| Error message | UTF-8 bytes |
With status 0 the error message is empty, except for a bid below the floor, which gets accepted bid below floor, skipped validation, the same text as the HTTP 202. That bid is not simulated and does not enter the auction, see floor-bid.md. With status 1 or 2 it is the same message as the HTTP 4xx or 5xx.
Responses can arrive out of order, so match them by sequence number. You can include the request id when you ask us about a submission.