Binary Order Entry Framing
This page defines the byte-level session of senticore-bsl-tcp-v2. Integers are little-endian.
Handshake
| Step | Message | Notes |
|---|---|---|
| 1 | HandshakeHello (48 bytes) | Offers version 2. Bytes 36..40: requested heartbeat in ms, 0 lets the gateway choose. gateway_capabilities selects execution reports |
| 2 | HandshakeAck (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.
| Kind | Value | Direction | Use |
|---|---|---|---|
CompactActionFrame | 1 | Client to gateway | One 192-byte order frame |
CoreAck | 2 | Gateway to client | Acknowledgement, inside SequencedData |
GatewayReject | 3 | Gateway to client | Fast reject, inside SequencedData |
AuthSidecar | 4 | Client to gateway | Authorization for the next frame |
CompactFrameGroup | 10 | Client to gateway | Atomic group; each item embeds its own sidecar |
CoreAckBatch | 11 | Gateway to client | Batch acknowledgement, inside SequencedData |
ClientHeartbeat | 12 | Client to gateway | Liveness, u64 send timestamp |
ServerHeartbeat | 13 | Gateway to client | Liveness on the granted cadence |
ResendRequest | 14 | Client to gateway | Replay from a session sequence |
SessionResume | 15 | Client to gateway | Resume a prior session |
SessionResumeResult | 16 | Gateway to client | code 0 accepted, 2 sequence aged out |
SequencedData | 17 | Gateway to client | Envelope with per-session sequence |
EndOfSession | 18 | Gateway to client | Graceful end |
ExecutionReport | 26 | Gateway to client | Private 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
CompactFrameGroupwith 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_idto a fresh non-zerou64per connection. Keepgateway_seqstrictly increasing. A quote-replace group uses onegateway_seqper frame.
Session-key sidecar (AuthSidecarV2)
| Field | Size | Meaning |
|---|---|---|
auth_scheme | text | senticore_session_key_v1 |
algorithm | text | ed25519 |
session_key_id | 32 bytes | Registered key |
session_seq | u64 | Strictly increasing per key; persist it across restarts |
policy_hash | 32 bytes | Hash of the registered policy |
order_hash | 32 bytes | Chain-bound hash of the frame |
signature | 64 bytes | Ed25519 over order_hash |
auth_binding | 32 bytes | Copied into the frame |
Sequencing and recovery
SequencedData payload: u64 session_seq (starts at 1), u32 inner_kind, inner payload.
- If
session_seqskips, sendResendRequestwithfrom_session_seqset 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
SessionResumewith the previous token and the highest processedsession_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.