System Architecture

Precognition implements a three-tier architecture combining a modern web frontend, the Precognition AI Agent, and a secure Solana smart contract for trustless prediction market operations.

System Architecture

Precognition operates as a three-tier decentralized system, combining a modern web interface with the Precognition AI Agent and on-chain smart contracts.

Web Application

User Interface Layer

Real-time prediction dashboard
Wallet connection & management
Staking and voting interface
Historical data visualization
Next.js 16React 19TypeScriptTailwind
RPC / WS

Precognition AI Agent

AI Processing Layer

Market data aggregation
AI prediction generation
Confidence score calculation
On-chain transaction signing
Node.jsAnchor SDKML ModelsData APIs
Transactions

Solana Program

On-Chain Logic Layer

Prediction state management
Token staking & escrow
Vote tallying & resolution
Reward distribution logic
RustAnchor 0.32SPL TokenPDAs

Role-Based Access Control

The system implements strict role separation to ensure security and proper authorization for all operations.

Admin

Initializes markets, configures parameters, and withdraws accumulated treasury fees.

Precognition AI Agent

Creates predictions, resolves outcomes based on real-world data, and cancels invalid predictions.

User

Stakes tokens on predictions, votes VALID or FUD, and claims rewards or refunds.

Data Flow Summary

1. Users interact with the web app to view predictions and submit votes

2. The web app communicates with Solana via RPC for reads and wallet for writes

3. The Precognition AI Agent monitors markets and creates predictions with AI confidence scores

4. Smart contracts handle all token movements and state transitions on-chain

Technology Stack

Frontend

  • Next.js 16 React framework with App Router
  • React 19 UI library
  • TypeScript Type-safe JavaScript
  • Tailwind CSS 4 Utility-first styling
  • Framer Motion Animations
  • Zustand State management

Precognition AI Agent

  • AI/ML Models Market analysis and predictions
  • Data Aggregation Real-time market data feeds
  • Verification Engine Outcome validation

Smart Contract

  • Anchor 0.32.1 Solana development framework
  • Rust Systems programming language
  • SPL Token Token standard integration

Role-Based Access Control

The system implements strict role-based access control at the smart contract level, ensuring that only authorized entities can perform specific operations.

Admin

System administrator with full control over market configuration

Permissions

  • Initialize prediction market
  • Configure fee parameters
  • Set voting duration and quorum
  • Withdraw treasury funds

Precognition AI Agent

AI-powered agent responsible for prediction management

Permissions

  • Create new predictions
  • Resolve predictions with outcomes
  • Cancel predictions (no quorum)
  • Set AI confidence scores

User

Market participant who votes on predictions

Permissions

  • Stake tokens on predictions
  • Vote VALID or FUD
  • Claim rewards (if winner)
  • Request refunds (if cancelled)

Data Flow Overview

1

Prediction Creation

The Precognition AI Agent analyzes market data and creates predictions on-chain with metadata stored on IPFS. Each prediction includes target metrics, timeframes, and AI confidence scores.

2

User Participation

Users connect their Solana wallets through the web app, browse active predictions, and stake tokens to vote. All transactions are signed client-side and submitted to the Solana network.

3

Resolution

After the voting period ends, the Precognition AI Agent verifies real-world outcomes against prediction criteria and submits the resolution transaction, determining winners.

4

Reward Distribution

Winners claim rewards through the smart contract, receiving their original stake plus a proportional share of the losing pool. All calculations are performed on-chain.