Skip to main content

System Architecture

Prophet is composed of four distinct layers: the blockchain layer (smart contracts on 0G Chain), the agent layer (off-chain autonomous services), the data layer (0G Storage), and the inference layer (0G Compute). The frontend serves as the user interface across all four.

Component Responsibilities

Smart Contracts (0G Chain)

The contracts are the source of truth for all financial state. They hold funds, enforce rules, and emit events. ProphetFactory (0xEd51e3d6Ba8914875616bBcDd9aa9D4A00B27bD4) Creates and tracks all markets. Anyone can call createMarket(). The factory wires each new market to the vault, distributor, oracle agent, and market-maker agent at deployment. MarketContract (one per market, deployed by factory) Implements the binary YES/NO AMM. Holds all market collateral (USDT). Enforces the complete-set accounting invariant. Manages the market lifecycle from Open through Resolved. LiquidityPool (0x13AbE644693DA19f9A895C8c82Cf53879580DA8e) Holds protocol-owned USDT. The market-maker agent allocates portions to new markets and reclaims settled funds after resolution. No human LP is needed. PositionVault (0x89FAcA46A2782b4751F697ddFe0A0b9124Eb794E) Stores encrypted bet commitments. Receives position reveals from the oracle after resolution. Enforces that positions cannot be revealed before the market is resolved. PayoutDistributor (0x238D341Bb358AC7C8Ae0A22b35897bECE97b9740) Calculates and distributes winnings after reveal. Handles fee splits between oracle, market-maker, and protocol treasury.

Agent Layer

The agents are TypeScript services that run off-chain. They read events from 0G Chain, call 0G Compute and 0G Storage, and submit transactions back to the chain. Oracle Agent (agent/src/oracle/index.ts) The brain of market resolution. It listens for resolution events, calls the AI model on 0G Compute, stores reasoning on 0G Storage, and posts verdicts on-chain. It also handles the position reveal after finalization. Market Maker Agent (agent/src/market-maker/index.ts) Keeps markets liquid. It watches for new market creation, allocates USDT from LiquidityPool to seed each market’s AMM, monitors active markets, and returns settled funds to the pool after resolution.

0G Compute

Provides decentralized AI inference via the @0glabs/0g-serving-broker SDK. Prophet uses it for:
  1. Question validation at market creation (is this a valid, resolvable question?)
  2. Oracle resolution at deadline (did the event happen? what is the evidence?)
  3. Market pricing inference (what is a fair initial price for this market?)
All inference goes through the 0G Compute provider at 0xa48f01287233509FD694a22Bf840225062E67836 (Qwen 2.5 7B on testnet). TEE attestation is verified before each inference session.

0G Storage

Provides permanent, decentralized storage via the @0gfoundation/0g-storage-ts-sdk SDK. Prophet uses the turbo indexer at https://indexer-storage-testnet-turbo.0g.ai. Prophet writes to 0G Storage:
  • Market metadata (question, deadline, sources, category) — written at creation
  • Oracle reasoning chains (full JSON with confidence, evidence, reasoning) — written before each verdict
  • Agent state (active markets, liquidity allocation) — updated continuously
  • Price snapshots (YES/NO prices at intervals) — written by market-maker
Root hashes returned by uploads are stored in the relevant smart contracts, creating a verifiable link between on-chain state and off-chain data.

Data Flow: Market Creation


Data Flow: Trading


Data Flow: Resolution


Separation of Concerns

No component is a single point of failure in terms of data integrity. The contracts enforce rules. 0G Storage holds the permanent record. 0G Compute runs inference. The agents are the coordination layer — if they go down, the on-chain state is preserved and agents can resume from where they left off using the catch-up scan on startup.

Next: Deep Dive on 0G Integration

0G Integration Depth

A technical audit of every 0G module integration in Prophet — written for judges and engineers evaluating the depth of 0G use.