Skip to main content

Binary Order Entry Framing

This page defines the byte-level session of senticore-bsl-tcp-v2. Integers are little-endian.

Handshake​

StepMessageNotes
1HandshakeHello (48 bytes)Offers version 2. Bytes 36..40: requested heartbeat in ms, 0 lets the gateway choose. gateway_capabilities selects execution reports
2HandshakeAck (48 bytes)Bytes 8..10: version. Bytes 20..36: 16-byte session token. Bytes 36..40: granted heartbeat. sequencer_capabilities: granted capability bits

A client offering only version 1 receives HandshakeReject.

Message kinds​

Every message is u32_le kind, u32_le payload_len, payload.

KindValueDirectionUse
CompactActionFrame1Client to gatewayOne 192-byte order frame
CoreAck2Gateway to clientAcknowledgement, inside SequencedData
GatewayReject3Gateway to clientFast reject, inside SequencedData
AuthSidecar4Client to gatewayAuthorization for the next frame
CompactFrameGroup10Client to gatewayAtomic group; each item embeds its own sidecar
CoreAckBatch11Gateway to clientBatch acknowledgement, inside SequencedData
ClientHeartbeat12Client to gatewayLiveness, u64 send timestamp
ServerHeartbeat13Gateway to clientLiveness on the granted cadence
ResendRequest14Client to gatewayReplay from a session sequence
SessionResume15Client to gatewayResume a prior session
SessionResumeResult16Gateway to clientcode 0 accepted, 2 sequence aged out
SequencedData17Gateway to clientEnvelope with per-session sequence
EndOfSession18Gateway to clientGraceful end
ExecutionReport26Gateway to clientPrivate report inside SequencedData

Authorizing an order​

Each order needs its own sidecar. The connection is not authenticated once and then trusted.

AuthSidecar kind=4, cold-encoded sidecar
CompactActionFrame kind=1, 192 bytes
SequencedData kind=17, CoreAck or GatewayReject
  • The session holds one pending sidecar. A second sidecar before a frame replaces the first.
  • For atomic cancel and place, send one CompactFrameGroup with each frame and its sidecar. Loose sidecars do not apply to group legs.
  • Use one account and one signer per TCP session.
  • Set CompactActionFrame.session_id to a fresh non-zero u64 per connection. Keep gateway_seq strictly increasing. A quote-replace group uses one gateway_seq per frame.

Session-key sidecar (AuthSidecarV2)​

FieldSizeMeaning
auth_schemetextsenticore_session_key_v1
algorithmtexted25519
session_key_id32 bytesRegistered key
session_sequ64Strictly increasing per key; persist it across restarts
policy_hash32 bytesHash of the registered policy
order_hash32 bytesChain-bound hash of the frame
signature64 bytesEd25519 over order_hash
auth_binding32 bytesCopied into the frame

Sequencing and recovery​

SequencedData payload: u64 session_seq (starts at 1), u32 inner_kind, inner payload.

  • If session_seq skips, send ResendRequest with from_session_seq set to the expected value.
  • Heartbeat on the granted cadence. Treat a peer silent for three intervals as dead.
  • After reconnecting, complete a new handshake and send SessionResume with the previous token and the highest processed session_seq.
  • Resting orders stay on the book after a disconnect unless the session-key policy sets cancelOnDisconnect.

Standalone cancel and amend​

The frame for Cancel and AmendOrder carries only the order id. Pass routingMarket, the market of the referenced live order, to the SDK encoder. It is a routing hint; the gateway rejects frames whose market does not match the order. For quote refreshes use QuoteReplace or SpotQuoteReplace, which carry the market.

Next steps​