# Hybrid CLOB

Pitchcast uses a hybrid Central Limit Order Book: off-chain order matching combined with non-custodial on-chain settlement. This is the architecture proven in production by Polymarket and is the correct choice for a live prediction market platform.

## Architecture overview

The "hybrid" model splits responsibilities between two layers:

* **Off-chain**: order book storage, matching engine, and order routing. This is fast, cheap to operate, and easy to iterate on.
* **On-chain**: settlement, collateral custody, and share minting/burning. This is the trust layer. The smart contract enforces the constraints in every signed order and cannot be overridden by the operator.

The operator receives signed orders from users and matches them against the order book. When a match is found, the operator submits the matched pair to the on-chain settlement program. The program verifies both signatures and executes settlement. If verification fails, the transaction is rejected.

## CLOB vs AMM

The alternative to a CLOB is an AMM using the Logarithmic Market Scoring Rule (LMSR). LMSR is elegant in theory: it prices trades via a cost-function differential `C(q') - C(q)`, with a bounded worst-case loss of `b * log(n)` for a liquidity parameter `b` across `n` outcomes. In practice, it has significant weaknesses for a production trading platform.

| Dimension          | CLOB                                         | LMSR AMM                                                 |
| ------------------ | -------------------------------------------- | -------------------------------------------------------- |
| Price discovery    | Efficient, real market prices                | Bounded by liquidity parameter; distorts in thin markets |
| Capital efficiency | High, capital deployed at specific prices    | Low, spread across all price points                      |
| Market maker loss  | No guaranteed subsidy                        | Always `b * log(n)` regardless of volume                 |
| UX                 | Familiar limit/market order model            | Simpler but less precise                                 |
| Scalability        | Excellent, standard financial infrastructure | Degrades as volume grows                                 |

For a platform trading football events where markets can be thin, events are time-sensitive, and price precision matters, CLOB is the correct architecture.

## Non-custodial settlement

The critical property of the hybrid CLOB is that it is non-custodial. The operator never holds user funds. The operator never holds the private keys that would allow them to move user funds.

When a user places an order, they sign it with their Solana wallet. That signature contains the price, size, direction, and expiry of the order. The on-chain program verifies this signature at settlement. If the operator tries to submit a fraudulent order (one that was never signed by the user, or one with modified terms), the transaction fails.

The result: the operator has order routing capability but not custody. Users can trust the system without trusting the operator.

{% hint style="info" %}
The off-chain operator is a centralised component. It can go offline, which would halt trading. It cannot, however, steal funds. Funds are only at risk if the smart contract itself has a vulnerability, which is why the contract undergoes a security audit before mainnet deployment.
{% endhint %}


---

# Agent Instructions: 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:

```
GET https://docs.pitchcast.xyz/trading/hybrid-clob.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
