This document describes the generic sponsored transaction flow.
- Call
GET /relay/config. - Choose a settlement token from
supportedSettlementSwapPaths. - Build transaction-kind bytes.
- Hash
txKindBytesand ask the sender to sign the prepare authorization personal message. - Call
POST /relay/preparewithtxKindBytes,senderAddress,settlementTokenType,txKindBytesHash,prepareAuthorizationTimestampMs,prepareAuthorizationRequestNonce, andprepareAuthorizationSignature. - Ask the user wallet or signer to sign returned
txBytes. - Call
POST /relay/sponsorwithtxBytes,userSignature, andreceiptId.
The txKindBytes value must satisfy the User TransactionKind rules. The short rule is: user-supplied transaction-kind bytes contain the user's action and no Stelis settlement call; the Host appends the settlement call later.
sequenceDiagram
participant App
participant Host as Stelis Host
participant Wallet
App->>Host: GET /relay/config
App->>Wallet: sign prepare authorization
Wallet-->>App: prepareAuthorizationSignature
App->>Host: POST /relay/prepare
Host-->>App: txBytes, receiptId
App->>Wallet: sign txBytes
Wallet-->>App: userSignature
App->>Host: POST /relay/sponsor
Host-->>App: digest, effects
App and service developers start with @stelis/sdk.
The SDK wraps the prepare, sign, and sponsor sequence while still leaving signing and wallet approval to the caller. Generic sponsored execution requires two caller-provided signing functions: a personal-message signer for prepare authorization and a transaction signer for the returned txBytes.
Agent runtimes start with @stelis/mcp-server.
The MCP server exposes tools for relay config, prepare, sponsor, promotion list, promotion claim, promotion prepare, and promotion sponsor. It does not hold keys or sign for users.
Promotion-sponsored flows use /studio/promotions/* routes and a developer JWT. See payment-platform.md.
Backends that use generic settlement for fulfillment should verify the final digest with verifySettleEventAgainstExpected from @stelis/sdk/server.
Required expected fields are:
receiptIduser- exactly one of
orderIdororderIdHash
Amount-sensitive backends should also pass expected executionCostClaimMist, quotedHostFeeMist, and protocolFeeMist.
Use extractSettleEvents only for reconciliation scans. It decodes matching events but does not prove application payment completion by itself.