Binary Order Entry Session Keys
The owner wallet signs one delegation. The quote engine then signs each order locally with an Ed25519 session key. Wallet-signed TCP orders are acknowledged with 202 and not applied, so session keys are required for TCP order entry.
Steps
- Read
GET /api/v1/bsl/connectivityforactionSigning.chainIdandverifyingContract. - Create an Ed25519 key pair locally.
- Define a policy for one account, one gateway and the intended markets.
- Sign the EIP-712
SessionDelegationV2with the owner wallet. - Register the key with
POST /api/v1/bsl/session-keys/register. - Open the TCP connection and sign every frame with the session key.
- Revoke the key when the engine stops.
Endpoints
| Route | Purpose | Authorization |
|---|---|---|
POST /api/v1/bsl/session-keys/register | Register a key | Owner wallet signature in the body |
POST /api/v1/bsl/session-keys/list | List keys | Owner wallet signature |
POST /api/v1/bsl/session-keys/revoke | Revoke a key | Fresh wallet signature for revoke_session_key; never reuse the registration signature or nonce |
Reference: register, list, revoke.
Registration rules
| Rule | Detail |
|---|---|
| Headers | Send Origin of the registered app. Send no SC-* machine-auth headers; they cause 403 |
| App identity | appName and domain must match your registered app. The Sentico app uses appName: "Sentico", domain: "app.sentico-labs.xyz", Origin: https://app.sentico-labs.xyz |
| Signed fields | Never change a signed app or domain field without a new signature |
| Chain id | From the connectivity bundle of the host you use (42161 production) |
| Delegation | senticore_session_delegation_eip712_v2; EIP-712 domain name: SentiCore, version: 1, with chainId and verifyingContract from the bundle |
| Account ids | Delegation accountIdHex is the 32-byte trading-account id from GET /api/v1/trading/accounts?owner=<wallet>. Order payloads use the 20-byte engine account |
| Lifetime | At most 24 hours; rotate on restart |
Policy
{
"allowedMarkets": [7],
"allowedActions": ["spot_place", "cancel"],
"maxOrderQtyLots": 1000000,
"maxNotionalMicro": 250000000,
"gatewayId": 1,
"cancelOnDisconnect": false
}
| Field | Behavior |
|---|---|
allowedMarkets | Enforced per frame. Empty means all markets available to the account |
allowedActions | place, spot_place, cancel, amend, quote_replace, spot_quote_replace; each leg of a group must be allowed |
maxOrderQtyLots | Per frame |
maxNotionalMicro | Per place frame |
gatewayId | Enforced when set |
cancelOnDisconnect | When true, a TCP disconnect cancels the live orders admitted through this key. Place frames must carry a derived order id |
maxOpenExposureMicro, sourceIpAllowlist, clientCertFingerprint | Not supported; registration rejects them |
Sign an order
const encoded = encodeBslSessionOrder(payload, {
...routing, // from bslCompactRoutingFromConnectivityBundle(bundle)
accountIdx: routing.accountIdx,
sessionId: tcpSessionId, // fresh non-zero u64 per connection
gatewaySeq,
sessionPrivateKey: sessionKey.privateKey,
sessionKeyId: sessionKey.sessionKeyId,
sessionSeq, // persisted, strictly increasing
policyHash
});
for (const message of encoded.tcpMessages) socket.write(message);
Persist session_seq for every reused key. Never restart it at 1.
Sidecar forms
| Order shape | Sidecar | Signed action payload |
|---|---|---|
| Independent place, cancel or amend | Fixed binary form, 236 bytes | Omitted |
| Atomic quote-replace group | JSON sidecars inside CompactFrameGroup | Required |
Both forms enforce the registered policy and a chain-bound signature. See Framing.