> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chok.market/llms.txt
> Use this file to discover all available pages before exploring further.

# Order Lifecycle

> What happens between clicking Buy and owning shares.

CHOK uses a **hybrid** design. Orders are matched off chain for speed, and every match settles on chain.

**1. You sign an order**

The app builds an order and you sign it. The signature is EIP-712 typed data, with the exchange domain name `CHOK CTF Exchange`.

**2. The engine checks it**

The matching engine checks the signature, your balance, the price, the tick size and the market's status. If anything fails, the order is rejected right away with a message. See [Error Messages](https://docs.chok.market/resources/error-messages.md).

**3. The order is matched**

The order is matched against the book by **price-time priority**: best price first, then the oldest order at that price.

**4. The match settles on chain**

An operator submits the match to the CTF Exchange contract. The exchange checks every signature again, then moves chUSD and outcome tokens between the two sides.

## Trade statuses

| Status | Meaning |
| - | - |
| `MATCHED` | Matched by the engine and sent for settlement |
| `MINED` | Included in a block |
| `CONFIRMED` | Final. The trade is settled |
| `RETRYING` | Settlement failed once and is being retried |
| `FAILED` | Settlement failed for good |

The order response comes back as soon as the engine matches it. Settlement transaction hashes arrive afterwards.

## Why both on and off chain

* **Off chain** matching is instant and free to cancel.
* **On chain** settlement means the exchange contract only moves your tokens with your signature, at your price or better.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.