> For the complete documentation index, see [llms.txt](https://docs.fermi.trade/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fermi.trade/readme.md).

# README

Fermi-v1 (`frmv1`) is a non-custodial, fully on-chain perpetual-futures exchange built on Solana. A single on-chain program owns the order book, the cross-margin risk engine, funding, and liquidation; [POSq](broken://pages/ac31e9ddbaaf6ba0dc00cd9026f42e08117ea99d) sequences encrypted intents over VDF ticks and anchors that order into a per-market commit/reveal execution queue; and an optimistic harness gives traders millisecond-level feedback while on-chain finality follows behind.

This site is the user-facing reference for **traders, market makers, liquidators, integrators, and prospective partners** evaluating the system. It explains both *how Fermi-v1 works* and *why the design is viable* — start with [02 - Architecture](broken://pages/890697491fdf2eed943cb23b394c6638d28ed1ce) for the system-level case.

## Getting started

* [**01 - Overview**](broken://pages/58ed578d6aab74d47c04b0dab43df44578f47615) — What Fermi-v1 is, what makes it different, and the moving pieces.
* [**02 - Architecture**](broken://pages/890697491fdf2eed943cb23b394c6638d28ed1ce) — The on-chain program, [POSq sequencing layer](broken://pages/ac31e9ddbaaf6ba0dc00cd9026f42e08117ea99d), relayer/executor plumbing, and optimistic harness; how they interact; why the design is fair (auditable FCFS) and fast (low optimistic latency); the trust model and viability case.
* [**03 - Getting Started**](broken://pages/c8072c86887d42e609a5a2fc8dee16796fca6b18) — Connect a wallet, fund an account, place your first order.
* [**04 - Glossary**](broken://pages/8fcba8a19d20cbda15c7c66b790c330fe022ce8b) — Every term used in these docs.

## Accounts & collateral

* [**05 - Accounts**](broken://pages/ca8918148c166aebd4698506e26c10082b232997) — Fermi account, sub-accounts, delegation, account size.
* [**06 - Collateral & Banks**](broken://pages/006081c63f595cffd3f589c2ecf05d0512e1816c) — Supported tokens, deposit/borrow indexes, weight scaling.

## Markets

* [**07 - Perp Market Specs**](broken://pages/5a5c4fca57620dfcc1e42afe5dfde68fa937cfba) — Lot sizes, tick sizes, leverage tiers, market parameters by symbol.
* [**08 - Pricing & Mark Price**](broken://pages/aafaf8bdfcfb4dda589e5271a469b1902a6c481f) — Oracle feeds, stable price, mark price.
* [**09 - Funding**](broken://pages/680f8696e9d9dc5f1eb5c7a817b364fad32da7f8) — Funding rate algorithm, impact price, settlement cadence.

## Order book and matching

* [**10 - FIFO Order Book**](broken://pages/c22a8887caeab589a71645012a2e3efda04843ea) — Price-time priority encoding, fixed and oracle-pegged trees.
* [**11 - Matching Engine**](broken://pages/0f0463f601862e7cb23b3633eab97633d590c2f9) — Match loop, fill events, eviction, post-only behavior.
* [**12 - Order Types**](broken://pages/d61d1c45b4e81e4eb4921acecc04a09233799515) — Limit, IOC, Market, PostOnly, PostOnlySlide, OraclePegged, with TIF and reduce-only.
* [**13 - Self-Trade Prevention**](broken://pages/efabcddfd0349e27806630879d63c011dbfb8fd8) — DecrementTake, CancelProvide, AbortTransaction.
* [**14 - Fees**](broken://pages/7f4793754fa07ae1152573c67fa3c7dd0e232ad1) — Maker/taker, IOC penalty, settle incentive, liquidation fees, platform fees.

## Risk and PnL

* [**15 - Margin Math & Account Health**](broken://pages/854a94521c8968d1ac32269b054622c7369c60d5) — Init / Maint / Liquidation-end health, weighted positions.
* [**16 - Entry Price and PnL**](broken://pages/3f285b6f16a5c7e3f06bf676148ed29a8353c928) — Average entry, unrealized vs settled, hupnl, realized trade P\&L.
* [**17 - Risk Tiers and Liquidation**](broken://pages/bec8219b5c85ab951e627331f9357231dbccb330) — Triggers, phases, fees, force-cancel and force-close.
* [**18 - Bankruptcy & Insurance Fund**](broken://pages/72e830bc825f1dd6d395844a72534e964ba2a00d) — Insurance flow, socialized loss, unsocialized loss.
* [**19 - Risk Warning**](broken://pages/9dbe4de0920cae1438fa8ffa5fb06e421efae6c6) — What can go wrong, what cannot, and what's still your responsibility.

## Execution queue

* [**20 - Execution Queue v5**](broken://pages/be48c90533e062fae8818e133338dcf126bb706d) — Per-market AMQ-style FIFO, commit/reveal, sequencing, gap recovery, autodrop.
* [**21 - Direct Fallback Pool**](broken://pages/31cdbebbf779c24c05fcc4cf4188188d5f306bc7) — Censorship-resistant submission path.
* [**30 - POSq Sequencing**](broken://pages/ac31e9ddbaaf6ba0dc00cd9026f42e08117ea99d) — Verifiable off-chain sequencing, v1 single-sequencer mode, and the v2 roadmap.

## Integrating

* [**22 - Trader Workflow**](broken://pages/cac7d3e6caa388b654e79fb8cf990d9bf2291d2f) — End-to-end flow for a bot or UI.
* [**23 - SDK**](broken://pages/88a989d71b1d8331cc545ef7e2c98215730bb800) — TypeScript and Rust clients.
* [**24 - Direct CPI Integration**](broken://pages/0a599c7a4024495eee1028623a4e112f9535315c) — Submit orders from another Solana program.
* [**25 - HTTP & SSE API**](broken://pages/cde6fe8b251bf446b6350f65563e1ee1a7083b1f) — Optimistic harness REST, fanout SSE.
* [**26 - gRPC API (Relayer)**](broken://pages/0e7a840819337d746ed8e882c2eb48f78a789e68) — `SubmitIntent`, signing, error codes.
* [**27 - WebSocket / Streams**](broken://pages/7d3c5e45e454daccab97c229e4fad94404a4d92b) — Subscriptions for fills, book deltas, funding.
* [**28 - FAQ**](broken://pages/ccf84bc16cddac76c19d20da254ea4573925278f) — Common questions about execution, margin, and recovery.
* [**29 - Support**](broken://pages/affc0a808b406efad6224bf9735688ee3b9ade77) — Where to get help.

## Conventions used in these docs

* Every formula is taken from the on-chain code; the source file and line range is cited in italics under the formula.
* All amounts on chain are in **native** (smallest token unit, e.g. USDC = 6 decimals → 1 USDC = `1_000_000` native). Where docs show human numbers we use **HU**.
* Prices on the book are in **price lots**: integer ratio of `quote_lot_size` to `base_lot_size`. To convert: `native_price = price_lots × quote_lot_size / base_lot_size`.
* `I80F48` is a fixed-point type — 80 integer bits, 48 fractional bits — used everywhere weights, fees, and funding are stored.
* Solana primitives: a *slot* is the validator round (\~400ms). A *signature* is the on-chain tx hash you can look up on a block explorer.

## Network deployment

| Field          | Value                                          |
| -------------- | ---------------------------------------------- |
| Cluster        | Solana mainnet-beta                            |
| Program ID     | `FRMiKrj2hQGvcZQtSDdiFRZ4cmaTjuc1QVkM2B5ShUvA` |
| Group          | `87qUKYQoK1f9gYQjYzw5NcRo7wx6VmfhTGJ7JenoeYAA` |
| SOL-PERP queue | `H298eJU5b4uyAHpeeZQdXS9JUttmmaMh2U6RYkUHFfE9` |
| ETH-PERP queue | `764RYGQACUpWqx3dtYUmfG2G3MK6wXT5WPPRHJxzCJQP` |
| BTC-PERP queue | `ArvDdpYTojBbH4FkCxLxALmX3Sb5qr4VsmFFkgV2NSC3` |

Devnet endpoints are listed in [03 - Getting Started](broken://pages/c8072c86887d42e609a5a2fc8dee16796fca6b18).


---

# 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://docs.fermi.trade/readme.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.
