SentAI
Verifiable AI trading signals for Polymarket, powered by CRE and xAI Grok
What it is
SentAI is an on-chain, end-to-end automated workflow that generates verifiable trading decisions for Polymarket crypto prediction markets using real-time X sentiment analysis.
Every 5 minutes, the CRE workflow fetches active crypto markets from Polymarket, looks up baseline prices from Chainlink Price Feeds using a binary search on historical rounds, and sends everything to xAI Grok which analyzes recent X posts for sentiment. The validated decisions are then cryptographically signed by the DON and logged on-chain to a smart contract on Sepolia.
It solves three problems:
(1) the impossibility of manually synthesizing hundreds of X posts into actionable signals within tight 5-15 minute windows,
(2) the lack of verifiability when using AI for trading decisions since all data goes through CRE consensus, and
(3) the absence of on-chain proof for trading decisions, as every actionable decision is signed and logged on-chain with a tamper-proof audit trail.
How it Works
The CRE workflow is written in TypeScript, compiled to WASM, and executed deterministically via a simulation.
Core components:
- CRE Workflow — Orchestrates the entire pipeline with cron-based scheduling, consensus on all external data, and signed report submission.
- Polymarket Integration — Fetches active crypto prediction markets via Gamma API using CRE's HTTP capability with consensus.
- Chainlink Price Feeds — Reads BTC/USD and ETH/USD prices on Sepolia via AggregatorV3Interface. Uses a custom binary search over getRoundData() and latestRoundData() to find historical prices at market creation time.
- xAI Grok + X Search — Analyzes real-time X sentiment per token via the Responses API with structured JSON output.
- Zod Validation — Validates Grok's response against a strict schema, falling back to HOLD (inconclusive decision) on invalid responses.
- On-chain Logging — Actionable decisions are ABI-encoded with viem, signed by the workflow, and submitted to a smart contract which verifies signatures through Chainlink's KeystoneForwarder.
Links
Created by
- Husni