Trade and bet on crypto prices inside X: Flash swap quotes, pools settled onchain by Chainlink CRE
PredictX turns any post on X into a trade or a bet. It is a Chrome extension plus a dashboard, backend and smart contract. When a post mentions a coin like $ETH, you hover the cashtag and get the live price, a 24h chart, market stats, a short AI tip with a suggested buy price, and a real Definitive Flash swap quote on Base.
The main feature is prediction pools. A user writes a take such as "ETH above $3,000 at 18:00 UTC", creates a pool in one click, and posts it to X with a link. Anyone can bet YES or NO with test USDC right under the post, through a bet box the extension adds. When the time is up, a Chainlink CRE workflow reads the real price, decides the outcome, and writes the result onchain. Winners claim their share. If one side has no stakes, everyone is refunded.
The contract has no owner and no admin. Only the Chainlink forwarder can set an outcome, so neither the creator nor PredictX can change a result. The goal is simple: opinions on X become bets that settle themselves, without leaving the timeline.
Stack: Chrome MV3 extension (React, Shadow DOM so nothing leaks into x.com), a Vite dashboard, a Fastify backend, shared TypeScript packages, and Foundry contracts on Base Sepolia.
Chainlink CRE: a TypeScript workflow (@chainlink/cre-sdk) runs on a cron trigger. It uses EVMClient to find due pools and read each pool's coin, direction and strike. It then uses HTTPClient with median consensus to fetch the CoinGecko price. It decides the outcome with bigint math, signs the report with runtime.report, and delivers it through EVMClient.writeReport to PredictionPool.onReport. The contract only accepts calls from the forwarder. If a price fetch fails, the pool is skipped and retried, never guessed. We ran it with the CRE CLI simulator and broadcast real transactions on Base Sepolia. Pools were resolved onchain and winners claimed (transaction hashes are in the repo docs).
Definitive Flash: the backend calls Flash /v1/quote for Base mainnet swaps (ETH, BTC, DEGEN, BRETT) for market and limit orders. It maps the response into price impact, minimum received and a 60-second expiry. The Swap tab is quote-only by design, so no real funds are used.
Other details: the extension never holds a key, and all API calls go through its service worker. Pool writes go straight from MetaMask to the contract, simulated first, with exact-amount approvals only. The AI can only return text and cannot sign or send anything. All money math uses one shared bigint library across the UI, backend, scripts and workflow. The contract has 49 Foundry tests, and the backend has hundreds of unit and contract tests.

