predikt/ENV-AND-KEYS.md
caelum0x 2b68bde5d5 Predikt: full Polymarket-style prediction market โ€” web + mobile + on-chain + bots
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>
2026-07-06 23:29:50 +03:00

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).