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

# Build on Ambi

> The contracts, the indexer and API, and the app: how the pieces fit and where to start.

![Market, registry and inboxes on Ethereum; routers on destination chains](https://mintcdn.com/ambi/zxJ8qP3zW6Y_3Fqs/images/art/architecture-light.webp?fit=max\&auto=format\&n=zxJ8qP3zW6Y_3Fqs\&q=85\&s=7ca31d5a7811d22ddef679ae5d8073b9)

```mermaid theme={null}
flowchart LR
  subgraph Ethereum
    M[Ambi market] -- reads --> I[Inbox per route]
    M -- requires --> R[VerifierRegistry]
  end
  subgraph Destination["Destination chain"]
    X[Router]
  end
  X -- canonical messenger --> I
  IDX[Indexer + API] -. events .-> M
  IDX -. events .-> X
  APP[App, bots, agents] --> IDX
  APP -- transactions --> M
  APP -- transactions --> X
```

| Piece | What it is | Where |
| - | - | - |
| `Ambi` | The market: escrow, matching, settlement, credits | `src/Ambi.sol` |
| `VerifierRegistry` | Approved inboxes and their pinned code hashes | `src/VerifierRegistry.sol` |
| `OptimismRouter` / `ArbitrumRouter` | Take payment and record the outcome on the destination | `src/outcomes/` |
| `OptimismInbox` / `ArbitrumInbox` | Receive outcomes on Ethereum; the order's verifier | `src/outcomes/` |
| Indexer + API | Reads every event on every chain, serves the book | `scripts/v1/indexer.mjs`, `scripts/v1/api.mjs` |
| App | The interface, built on the API | `app/` |

## Where to start

> [card] [Market reference](https://docs.ambichain.org/contracts/ambi.md)
>
> Every function, who can call it and what it does.

> [card] [API](https://docs.ambichain.org/api/overview.md)
>
> Read the book, history and stats over HTTP.

> [card] [Statement spec](https://docs.ambichain.org/specs/statement.md)
>
> Byte-exact encoding for any implementation.


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