| 🎯 Start Trading | 🤖 Build an Agent |
|---|---|
| Join Discord to get an invite code and start using the app during early access. | Point your AI agent at SKILL.md — everything it needs to start trading is in that one file. |
Sapience is an open-source prediction market protocol where you stake USDe on the outcomes of future events. You make a prediction, an auction finds you the best odds, and a smart contract handles the rest.
What makes it different:
- RFQ-based pricing — You don't buy from an order book. You broadcast a prediction and market makers compete via request-for-quote (RFQ) to give you the best payout. This works especially well for niche questions and combos that traditional markets can't support.
- Combos — Combine multiple picks into a single position. "BTC over $100k AND ETH over $5k by July" — if both are correct, you win.
- AI-native — Sapience is built for agents from day one. The SKILL.md file gives any LLM-based agent everything it needs to trade: API endpoints, WebSocket flows, signing schemes, and contract ABIs. No SDK required (though we have one).
- Fully onchain settlement — An immutable smart contract holds collateral, verifies signatures, and distributes winnings. The offchain layer just passes messages.
- Liquidity vaults — Pool capital with a vault manager who deploys it across prediction markets.
- Build a prediction — Pick one or more outcomes across available markets
- Set your position size — How much USDe you want to stake
- Watch the auction — Market makers compete to offer you the highest payout
- Accept and settle — The smart contract locks collateral from both sides
- Collect if you're right — When markets resolve, winners receive the staked collateral
All trading happens on Ethereal using USDe as collateral.
| Package | Description |
|---|---|
protocol |
Solidity smart contracts — PredictionMarket, Vaults, Resolvers |
sdk |
TypeScript SDK — auction helpers, ABI exports, signing utilities |
api |
Backend — GraphQL API and blockchain indexers |
relayer |
WebSocket relayer brokering auctions between predictors and vaults |
app |
Next.js frontend at sapience.xyz |
ui |
Shared React component library |
docs |
Documentation site at docs.sapience.xyz |
market-keeper |
Cron pipeline for ingesting Polymarket markets and running settlement |
pnpm install
# Frontend
pnpm run dev:app # http://localhost:3000
# API
pnpm run dev:api # http://localhost:3001
# Relayer
pnpm run dev:relayer # ws://localhost:3002
# Docs
pnpm run dev:docs # http://localhost:3003For contract development see packages/protocol/CLAUDE.md. Most app/API work runs against the deployed Ethereal contracts rather than a local chain — see packages/sdk/contracts/addresses.ts.
The fastest path: read SKILL.md. It's a self-contained reference that covers:
- GraphQL queries for markets and positions
- WebSocket auction flow (taker and maker)
- EIP-712 signing for bids
- On-chain minting and claiming
For deeper dives, see the Forecasting Agent Guide and Trading Agent Guide.
- The relayer only routes messages. It can't forge bids, modify sizes, or steal funds.
- Signatures are verified onchain. A bid is worthless unless cryptographically signed.
- The smart contract is the sole authority. It holds collateral, validates everything, and distributes winnings.
- Vaults are smart contracts. Managers decide strategy but can't withdraw your funds.
Binary options and secondary market sales are experimental features and are out of scope of the bug bounty program.
- App: sapience.xyz
- Docs: docs.sapience.xyz
- Agent Skill: sapience.xyz/skills
- Discord: discord.gg/sapience
- Twitter: @sapiencexyz
MIT — the entire protocol is fully open source. Contracts, SDK, API, frontend — all of it. We believe prediction markets should be transparent and verifiable top to bottom.
We welcome pull requests. If you want to contribute or just chat, come hang out in Discord.