Working tree is now the canonical repo. Off-chain play-money + trustless on-chain (FPMM AMM + CLOB via UMA settlement), AI market factory, creator/social/distribution, mobile shell + push, one-command demo + deploy-kit. Secrets excluded (see ENV-AND-KEYS.md). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
79 lines
5.8 KiB
Markdown
79 lines
5.8 KiB
Markdown
# Predikt โ env & keys you need to fill in
|
|
|
|
Everything you must supply to run/deploy Predikt, grouped by component. **๐ = private secret (never commit).** โฌ = public value (safe). Every component ships a `.env.example` / `.env.local.template`; copy it to `.env` / `.env.local` and fill in. All committed values are safe local-dev defaults or public placeholders โ replace them with yours.
|
|
|
|
---
|
|
|
|
## 1. Backend + database (the app's core) โ `oracle/`
|
|
The app runs on Supabase + Firebase (Manifold's stack). See `oracle/web/docs/BACKEND-CONFIG.md`.
|
|
|
|
**Create these free-tier accounts:** [Supabase](https://supabase.com) project ยท [Firebase](https://console.firebase.google.com) project.
|
|
|
|
Set in `oracle/common/src/envs/prod.ts` (+ `dev.ts`) โ the committed values are Manifold's placeholders and **auth breaks until replaced**:
|
|
- โฌ `supabaseInstanceId` โ your Supabase project ref
|
|
- โฌ `supabaseAnonKey` โ Supabase anon key (public, RLS-protected)
|
|
- ๐ Supabase **service_role key** โ admin/SSR (server env `DEV_ADMIN_SUPABASE_KEY` / prod secret)
|
|
- ๐ Supabase **DB connection** โ host/port/**password** (`SUPABASE_HOST/PORT/PASSWORD`)
|
|
- ๐ `SUPABASE_JWT_SECRET`, `API_SECRET`, `SCHEDULER_AUTH_PASSWORD`
|
|
- โฌ Firebase web config โ `apiKey` (public, domain-locked) / `authDomain` / `projectId` / `appId` / `messagingSenderId` / `measurementId`
|
|
- ๐ Firebase **service account JSON** (backend admin SDK) + **Apple sign-in** provider config (App Store requirement)
|
|
|
|
Backend templates: `oracle/backend/api/.env.local.template`, `oracle/backend/scheduler/.env.local.template`.
|
|
|
|
---
|
|
|
|
## 2. Web app โ `oracle/web/.env.local`
|
|
- โฌ `NEXT_PUBLIC_SUPABASE_URL` / `NEXT_PUBLIC_SUPABASE_KEY` / `SUPABASE_URL` / `SUPABASE_KEY` โ your Supabase project (prod) or local (`npx supabase start`)
|
|
- ๐ `DEV_ADMIN_SUPABASE_KEY` โ Supabase service_role (SSR)
|
|
- **AI market factory** โ ๐ `OPENROUTER_API_KEY` ([openrouter.ai](https://openrouter.ai), server-only) ยท โฌ `NEXT_PUBLIC_AI_MODEL` (default free Llama) ยท โฌ `OPENROUTER_SITE_URL` / `OPENROUTER_SITE_NAME`
|
|
- **On-chain (all โฌ PUBLIC addresses โ see ยง5):** `NEXT_PUBLIC_ONCHAIN_UMA_ADAPTER`, `_EXCHANGE`, `_CONDITIONAL_TOKENS`, `_UMA_OPTIMISTIC_ORACLE`, `_USDC` (optional), `_FPMM_FACTORY`, `_RELAY_URL`
|
|
- **Jurisdiction (optional โฌ):** `NEXT_PUBLIC_ONCHAIN_BLOCKED_REGIONS` / `NEXT_PUBLIC_ONCHAIN_ALLOWED_REGIONS` (ISO-3166 codes)
|
|
- **Gasless (optional):** โฌ `NEXT_PUBLIC_PAYMASTER_URL` (free-tier ERC-4337 paymaster)
|
|
|
|
---
|
|
|
|
## 3. Mobile app โ `oracle/native`
|
|
See `oracle/native/FIREBASE-SETUP.md`. Run `npx expo prebuild --clean` before building.
|
|
- โฌ `EXPO_PUBLIC_WEB_DOMAIN` / `EXPO_PUBLIC_WEB_URL` โ your deployed Predikt web URL (required for WebView/deep-links/OTA)
|
|
- โฌ `EAS_PROJECT_ID` (run `eas init`) ยท โฌ `EAS_OWNER` (your Expo account)
|
|
- ๐ **Firebase config files** โ your own `google-services.json` (Android, package `com.predikt.app`) + `GoogleService-Info.plist` (iOS, bundle `com.predikt.app`) into `configs/{dev,prod}/`
|
|
- ๐ `EXPO_PUBLIC_SENTRY_DSN` (optional) + โฌ `EAS`/Sentry org
|
|
- Replace app icons/splash in `assets/` with real Predikt art
|
|
- Accounts: Apple Developer, Google Play, Expo/EAS
|
|
|
|
---
|
|
|
|
## 4. On-chain relay + market maker โ `predikt-relay/.env`
|
|
- โฌ `PORT`, `SUBMIT_RATE_LIMIT_PER_MIN`, `READ_RATE_LIMIT_PER_MIN`, `TRUST_PROXY`
|
|
- โฌ `RELAY_ALLOWED_ORIGINS` โ your app origin(s) (never `*`)
|
|
- โฌ `CHAIN_ID` (137 Polygon) ยท ๐ `RPC_URL` (your RPC โ [Alchemy](https://alchemy.com)/[Infura](https://infura.io) free tier, or public)
|
|
- โฌ `EXCHANGE_ADDRESS` / `USDC_ADDRESS` / `CTF_ADDRESS` (from ยง5 deploy)
|
|
- ๐ `OPERATOR_PK` โ the relay operator EOA key (granted the exchange operator role via `addOperator`)
|
|
- โฌ `DATABASE_PATH`, `START_BLOCK`
|
|
- **Market maker (`npm run mm`):** ๐ `MM_PRIVATE_KEY` (funded maker EOA โ USDC) ยท โฌ `MM_MARKETS`, `MM_SPREAD_BPS`, `MM_ORDER_SIZE`, `MM_LEVELS`, `MM_REFRESH_MS`
|
|
|
|
---
|
|
|
|
## 5. Contracts deploy โ `predikt-contracts/`
|
|
Deploy each with its own forge script (or `deploy-kit`). See `predikt-contracts/DEPLOY.md`.
|
|
- **ctf-exchange** (`.env`): ๐ `PK` (deployer key) ยท โฌ `ADMIN`, `RPC_URL`, `COLLATERAL` (native USDC), `CTF`, `PROXY_FACTORY`, `SAFE_FACTORY`
|
|
- **uma-ctf-adapter** (`.env`): ๐ `PK` ยท โฌ `CTF`, `FINDER`, `OPTIMISTIC_ORACLE`, `RPC_URL` ยท โฌ `ETHERSCAN_API_KEY` (Polygonscan, for verify)
|
|
- **deploy-kit**: ๐ `PRIVATE_KEY` ยท โฌ `RPC`, `--chain amoy|polygon`
|
|
- Real Polygon primitive addresses (ConditionalTokens/USDC/UMA) are documented in `DEPLOY.md`.
|
|
- (`clob-client/.env` โ the hosted-CLOB SDK client; NOT needed since we self-host the relay.)
|
|
|
|
---
|
|
|
|
## 6. Bots / distribution
|
|
- **liquify** (off-chain MM) + **autopilot** (trader) โ `.env`: ๐ `MANIFOLD_API_KEY` (your Predikt account API key, from Profile โ API key) ยท โฌ `MANIFOLD_USERNAME` ยท โฌ `ORACLE_API_URL` (optional) ยท autopilot: โฌ `MANIFOLD_MARKET_SLUG`
|
|
- **herald** (Discord) โ `.env`: ๐ `DISCORD_BOT_TOKEN`, โฌ `DISCORD_CLIENT_ID` ([Discord dev portal](https://discord.com/developers)) ยท โฌ `ORACLE_API_URL` ยท ๐ `ORACLE_API_KEY` (fallback)
|
|
- **relay-tg** (Telegram) โ `.env`: ๐ `BOT_TOKEN` ([@BotFather](https://t.me/BotFather)) ยท โฌ `ORACLE_API_URL` ยท ๐ `ORACLE_API_KEY` (fallback)
|
|
- Bots store per-user keys in `keys.json` (gitignored, plaintext โ keep the dir private).
|
|
|
|
---
|
|
|
|
## Free-tier accounts summary
|
|
Supabase ยท Firebase ยท OpenRouter ยท an EVM RPC (Alchemy/Infura) ยท Expo/EAS ยท Apple Developer ยท Google Play ยท Discord + Telegram bots ยท Polygonscan (verify). Plus a funded EVM wallet (USDC on Polygon) for the operator + market maker to go on-chain.
|
|
|
|
**Nothing in this repo is a real private secret** โ committed values are safe local defaults / public placeholders / public contract addresses. Fill your own into the `.env` files (which are gitignored).
|