ultra sound relay docs

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

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.

  1. Ask us on Telegram for an API key and connection details. The API key is a UUID, separate from your HTTP X-Api-Token.
  2. Send a registration frame with your API key and pubkey.
  3. Stream submissions, and read the responses as they come back.

Frames

Everything on the connection, in both directions, is a frame:

BytesFieldEncoding
4Payload lengthLittle-endian u32
8Send time, nanoseconds since the unix epochLittle-endian u64
NPayload

Registration

The first frame must be a registration. The payload is SSZ, 64 bytes:

BytesField
16API key, the raw bytes of the UUID
48Builder 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.

BytesFieldEncoding
4Sequence numberBig-endian u32
1Merge type0 none, 1 mergeable, 2 append only
1FlagsBitmask, 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.

BitFlagMeaning
0IS_DEHYDRATEDBody is a v1 dehydrated submission, the same format as HTTP with x-hydrate, see builder-getting-started.md
1WITH_ADJUSTMENTSBody carries adjustment data, see bid-adjustment.md
2ZSTD_COMPRESSEDBody is zstd compressed
3PESSIMISTICIgnored
4DEHYDRATED_V2Body is a v2 dehydrated submission
5MERGING_V2Merging data is v2, needs merge type 1

Body. SSZ:

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>,
}

Keys are 64-bit FxHash values:

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
}

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:

FieldType
Sequence numberu32
Request id16 bytes UUID
Statusu8: 0 ok, 1 invalid request, 2 internal error
Error messageUTF-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.