Skip to main content

Predicta System Architecture 🧠

Cortex Engine, Hedgehog (Risk), and Mimic (Social) Integration
Overview: Predicta is an autonomous intelligence layer for decentralized prediction markets. It combines AI-driven alpha generation (Cortex), automated risk management (Hedgehog), and community-driven copying (Mimic).

1. Core Ecosystem Components


2. Integrated System Map


3. Key Subsystems

3.1 The Cortex Brain (System 2)

The β€œAnalyst” layer that scores markets from 0 to 1 based on:
  • E1 - Theta: Time decay.
  • E2 - Depth: Order book liquidity.
  • E4 - AI Prob: Domain-aware ML prediction (Crypto/Sports/Politics).
  • E5 - Delusion: Market price vs. AI conviction.
  • E7 - Sentiment: News and social analytics.

3.2 Hedgehog (The Hedge Engine)

Aims for delta-neutrality. When Cortex takes a directional bet on a crypto market (e.g., β€œBTC > $100k”), Hedgehog automatically opens an offsetting short position on a perpetual exchange (SynFutures or ZEUS).

3.3 Mimic Mode (The Social Relay)

Leverages Farcaster social signals.
  • Signal: A Leader places a trade.
  • Relay: The mimic_relay.py service detects the signal.
  • Execution: The relay triggers mirror trades for all followers via their individual PreonVault contracts.

3.4 Yield Gateway & Preon Vaults

Predicta’s treasury management system:
  • Personal Vaults: Each user (or mimic relationship) has a dedicated vault that holds PUSD.
  • Yield Generation: Idle funds in vaults can be routed through the YieldGateway to Moonwell to earn interest, which can then be used to fund β€œRisk-Free” micro-bets.

3.5 Identity & Simulation (V2)

  • Privy: Non-custodial identity provider supporting Email, Social, and Web3 logins.
  • Embedded Wallets: Privy-managed MPC EOAs serve as the signers for Smart Accounts.
  • Simulation Bypass: A headless authentication mechanism for persona-sim agents using deterministic tokens derived from a shared secret.

4. Technical Stack

  • Blockchain: Base (Ethereum L2)
  • Identity: Privy (Non-custodial, Social + Email + Wallet)
  • Account Abstraction: ERC-4337 (Pimlico / Coinbase CDP Paymaster)
  • Smart Contracts: Solidity (Foundry)
  • Backend: Python (FastAPI, Web3.py) & Node.js (Next.js Server Actions)
  • Frontend: Next.js 15, Tailwind CSS, Lucide React
  • Data: Firestore (Real-time sync), Polymarket API (Gamma/CLOB)

5. Directory Structure