Precedence is an AI-powered legal prediction market platform that enables trading on high-profile case outcomes. Users can bet on Supreme Court rulings, major criminal trials, and regulatory battles. By leveraging Polymarket's Builder Program for gasless trading infrastructure and CourtListener's API for legal data, Precedence provides unprecedented insights into judicial behavior and case outcomes.
- CourtListener Integration - Search millions of court cases
- LLM Case Analysis - AI-generated outcome predictions with confidence scores
- Full Opinion Text - Analysis includes actual court opinion text
- Key Factors Extraction - Identifies critical legal factors affecting outcomes
- Judge Behavior Analysis - ML models trained on judicial opinions
- Case Outcome Predictions - Confidence scores and probability distributions
- Historical Pattern Recognition - Identify how judges rule on similar cases
- Sentiment Analysis - Track media and public sentiment around cases
- Gasless Trading - Safe wallet deployment, no gas fees for users
- Builder Program - Full attribution for trading volume
- Real Market Access - Direct integration with Polymarket CLOB
- Live Prices - Real-time Yes/No outcome prices
- Legal-Focused Markets - Supreme Court, regulatory, political-legal markets
- Volume & Liquidity Data - 24hr, weekly, monthly trading stats
- Price Change Indicators - Track market movements
- Market Images - Visual market cards from Polymarket
How markets get created and how you win.
-
STEP 01 // DISCOVER
Search Live Legal Events
Browse thousands of active Supreme Court and Federal cases. Use our AI-powered search to find high-impact motions, rulings, and appeals worth trading on. -
STEP 02 // ANALYZE
AI Probability Engine
Our AI models analyze judicial history, case precedents, and legal patterns to generate probability forecasts. Know the odds before you trade. -
STEP 03 // REQUEST ⭐
Submit Market Proposals
Found a case with trading potential? Request a new prediction market. If approved by Polymarket, you earn a percentage of trading volume as the market creator. Turn legal insight into passive income.
Market Creators Earn 0.5%
Lifetime earnings on trading volume
-
STEP 04 // TRADE
Execute Positions Instantly
Once markets go live, trade on Polymarket's Central Limit Order Book. Zero gas fees. Millisecond execution. Your funds stay in your self-custodial wallet. -
STEP 05 // SETTLE
Automated Smart Contract Payouts
When cases resolve, UMA Oracle verifies outcomes and smart contracts automatically distribute USDC to winning positions. No disputes. No delays.
- Landing Page: www.precedence.fun
- App Dashboard: www.precedence.fun/app
- Live Markets www.precedence.fun/app/markets
- Court Cases www.precedence.fun/app/cases
| Component | Status | Details |
|---|---|---|
| Safe Wallet Deployment | ✅ | Gasless wallet deployment via Polymarket Relayer |
| User API Credentials | ✅ | Derived via wallet signature (EIP-712) |
| Token Approvals | ✅ | 7 contracts approved (USDC + CTF exchanges) |
| Market Resolution | ✅ | Slug/conditionId → tokenIds mapping |
| Order Placement | ✅ | Full pipeline with Builder attribution |
| Builder Attribution | ✅ | HMAC-signed headers for volume tracking |
| Feature | Status |
|---|---|
| Dashboard with market overview | ✅ Live |
| Legal prediction markets display | ✅ Live |
| AI-powered case search | ✅ Live |
| Case outcome predictions (LLM) | ✅ Live |
| CourtListener integration | ✅ Live |
| Real-time market prices | ✅ Live |
| Feature | Status |
|---|---|
| User profile persistence | 🚧 Planned |
| Portfolio tracking | 🚧 Planned |
| Trade history | 🚧 Planned |
| Leaderboards | 🚧 Planned |
┌─────────────────────────────────────────────────────────────┐
│ PRECEDENCE PLATFORM │
├─────────────────────────────────────────────────────────────┤
│ Frontend (Next.js 14) │ Hosted on Vercel │
│ • Dashboard │ • www.precedence.fun/app │
│ • Markets listing │ │
│ • Case search + AI analysis │ │
│ • Portfolio (coming soon) │ │
├─────────────────────────────────────────────────────────────┤
│ Backend (FastAPI + Node.js) │ Hosted on Railway │
│ • /api/markets/* endpoints │ │
│ • /api/predictions/* endpoints │ │
│ • /api/cases/* endpoints │ │
├─────────────────────────────────────────────────────────────┤
│ Trading Service (Node.js) │ Port 5002 │
│ • /init-session │ │
│ • /deploy-safe │ │
│ • /derive-credentials │ │
│ • /set-approvals │ │
│ • /resolve-market │ │
│ • /place-order │ │
├─────────────────────────────────────────────────────────────┤
│ Signing Server (Node.js) │ Port 5001 │
│ • HMAC signature generation │ │
│ • Builder credential management│ │
├─────────────────────────────────────────────────────────────┤
│ External APIs │
│ • Polymarket Gamma API (markets) │
│ • Polymarket CLOB API (trading) │
│ • Polymarket Relayer (gasless transactions) │
│ • CourtListener API (legal data) │
│ • OpenAI API (LLM analysis) │
└─────────────────────────────────────────────────────────────┘
Frontend:
- Next.js 14+ with App Router
- Wallet integration (Phantom, MetaMask)
- Real-time WebSocket updates
- Responsive mobile-first design
Backend:
- FastAPI (Python 3.11+)
- PostgreSQL for case/judge data
- Redis for caching
- CourtListener API integration
- Polymarket CLOB client
AI/ML:
- Judge behavior models
- Case outcome predictors
- Semantic search integration
- ModernBERT embeddings
# Required
- Node.js 18+
- Python 3.11+
- PostgreSQL 14+ (for user profiles - coming soon)
# API Keys Needed
- Polymarket Builder credentials (from polymarket.com/settings?tab=builder)
- CourtListener API key
- OpenAI API key# Clone the repository
git clone https://github.com/tony-42069/precedence.git
cd precedence
# 1. Backend Setup
cd backend
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env
# Edit .env with your API keys
# 2. Signing Server Setup
cd builder-signing-server
npm install
cp .env.example .env
# Edit .env with Builder credentials
# 3. Frontend Setup
cd ../frontend
npm install# Terminal 1: Signing Server (Port 5001)
cd backend/builder-signing-server
npm run start-dev
# Terminal 2: Trading Service (Port 5002)
cd backend
node trading_service_v2.js
# Terminal 3: Python Backend (Port 8000)
cd backend
uvicorn api.main:app --reload --port 8000
# Terminal 4: Frontend (Port 3000)
cd frontend
npm run devprecedence/
├── frontend/ # Next.js 14 frontend
│ ├── src/
│ │ ├── app/
│ │ │ ├── page.tsx # Landing page
│ │ │ ├── dashboard/ # Main dashboard
│ │ │ ├── markets/ # Markets listing
│ │ │ ├── cases/ # Case search + AI
│ │ │ └── portfolio/ # User portfolio
│ │ └── components/
│ └── public/
│ └── precedence-logo-transparent.png
│
├── backend/ # Python + Node.js backend
│ ├── api/
│ │ ├── routes/
│ │ │ ├── markets.py # Market endpoints
│ │ │ ├── predictions.py # AI prediction endpoints
│ │ │ └── cases.py # Case search endpoints
│ │ └── services/
│ │ └── llm_analyzer.py # LLM case analysis
│ ├── integrations/
│ │ ├── polymarket.py # Polymarket client
│ │ └── court_listener.py # CourtListener API
│ ├── trading_service_v2.js # Node.js trading service
│ ├── builder-signing-server/ # HMAC signing server
│ └── .env
│
├── database/
│ └── schema.sql # PostgreSQL schema
│
└── docs/ # Documentation
GET /api/markets/ # Get all markets
GET /api/markets/legal # Get legal-focused markets
GET /api/markets/search?q= # Search markets
GET /api/markets/{id} # Get market details
POST /api/predictions/analyze-case-llm # AI case analysis
GET /api/predictions/insights # Get prediction insights
GET /api/cases/search?q= # Search CourtListener cases
GET /api/cases/{id} # Get case details
POST /init-session # Initialize trading session
POST /deploy-safe # Deploy Safe wallet
POST /derive-credentials # Derive User API credentials
POST /set-approvals # Set token approvals
POST /resolve-market # Get tokenIds for market
POST /place-order # Place order
GET /session/:address # Get session status
GET /health # Health check
- Polymarket Builder integration
- Safe wallet deployment (gasless)
- User credential derivation
- Token approvals (7 contracts)
- Market resolution (slug → tokenIds)
- Order placement pipeline
- Frontend dashboard
- Legal markets display
- AI case search & analysis
- CourtListener integration
- Vercel + Railway deployment
- User profile system
- Database persistence
- Portfolio tracking
- Trade history
- Leaderboards
- Badge/reputation system
- Mobile responsive improvements
- Real-time WebSocket updates
- Email/push notifications
We welcome contributions! Please see our Contributing Guidelines for details.
# Fork and clone
git clone https://github.com/YOUR_USERNAME/precedence.git
# Create feature branch
git checkout -b feature/amazing-feature
# Commit and push
git commit -m "Add amazing feature"
git push origin feature/amazing-feature
# Create Pull RequestThis project is licensed under the MIT License - see the LICENSE file for details.
Precedence is a prediction market platform for informational and entertainment purposes. Trading involves risk and you may lose some or all of your investment. The predictions and odds displayed are not legal advice. Always consult with qualified legal professionals for legal matters.
Prediction markets may not be legal in all jurisdictions. Users are responsible for ensuring compliance with local laws and regulations.
- Live Platform: www.precedence.fun
- App Dashboard: www.precedence.fun/app
- GitHub: @tony-42069
- Polymarket Builder: polymarket.com/settings?tab=builder
- CourtListener API: courtlistener.com/help/api
