> For the complete documentation index, see [llms.txt](https://sonic-ai-works.gitbook.io/sonic-networks-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sonic-ai-works.gitbook.io/sonic-networks-docs/sonic-1.0.0-rc-production-architecture/sale-and-commerce.md).

# Sale & Commerce

SONIC Token Sale r30: key-identified quotes, rotatable release verification keys, externally signed receipts, Payment Kernel execution, reconciliation and receipt verification.

The customer-facing product is **SONIC Token Sale**. Navigation uses **Token Sale** and the canonical public route is `https://sonicnetwork.fun/token-sale`.

Internal commerce contracts remain stable:

| Concept              | Contract              |
| -------------------- | --------------------- |
| activation authority | `SaleRelease`         |
| activation evidence  | `SaleReleaseManifest` |
| policy acceptance    | `SaleTermsAcceptance` |
| purchase request     | `SaleIntent`          |
| signed quote         | `SaleQuote`           |
| chain execution      | `SaleTransaction`     |
| reconciled receipt   | `SaleReceipt`         |
| API namespace        | `/api/v1/sale/*`      |

## Quote key rotation

Every r30 quote persists `quoteKeyId`. The key ID is included in the canonical quote payload before HMAC-SHA256 signing, so mutating the key ID invalidates the signature.

```mermaid
sequenceDiagram
  participant API
  participant Ring as Quote keyring
  participant DB
  API->>Ring: Resolve current key ID
  Ring-->>API: keyId + secret
  API->>API: Sign canonical quote incl. quoteKeyId
  API->>DB: Persist quote + key ID + signature
  Note over API,DB: Later verification resolves quote.quoteKeyId
```

During rotation, add the new key first, make it current, and retain the previous key until all quotes signed under it have expired.

## Release activation trust

Production approval sends the deterministic Sale Release hash to the external signer. The returned `activationKeyId` must resolve to a configured Ed25519 public key, and the API verifies the signature before accepting the approval evidence.

## Receipt signing

After reconciliation and allocation, the worker computes the deterministic receipt hash and asks the external production receipt signer to sign it. The worker verifies the returned Ed25519 signature before persisting `receiptKeyId` and `receiptAlgorithm`.

`GET /api/v1/receipts/:id/verify` recomputes the receipt hash and verifies the stored signature against the matching public receipt key.

## Execution lifecycle

```mermaid
flowchart LR
  A[Release] --> B[Cluster]
  B --> C[Eligibility]
  C --> D[Intent]
  D --> E[Signed Quote]
  E --> F[Prepare]
  F --> G[Wallet Sign]
  G --> H[Submit]
  H --> I[Confirm]
  I --> J[Settle]
  J --> K[Reconcile]
  K --> L[Allocate + Receipt]
```

Confirmation is not settlement. Settlement is not reconciliation. Allocation cannot complete before reconciliation.

## Key endpoints

```
GET  /api/v1/sale/product
GET  /api/v1/trust/keys
GET  /api/v1/sale/releases/current
GET  /api/v1/sale/releases/current/manifest
GET  /api/v1/sale/terms/current
POST /api/v1/sale/terms/accept
POST /api/v1/sale/eligibility
POST /api/v1/sale/intents
GET  /api/v1/sale/intents/:id
POST /api/v1/sale/intents/:id/quote
POST /api/v1/sale/intents/:id/prepare
GET  /api/v1/sale/intents/:id/prepared
POST /api/v1/sale/intents/:id/broadcast
POST /api/v1/sale/intents/:id/submit
GET  /api/v1/receipts/:id
GET  /api/v1/receipts/:id/verify
```

{% hint style="danger" %}
Private activation keys, quote HMAC secrets, receipt signer tokens, legacy receipt HMAC secrets, and `.env` contents are never exposed by the trust API or public documentation.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://sonic-ai-works.gitbook.io/sonic-networks-docs/sonic-1.0.0-rc-production-architecture/sale-and-commerce.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
