
theworldiscollapsing
A world that grows forever. Bet on anything in it. Nobody knows the outcome, not even us.
Demo
About
theworldiscollapsing is a world that never stops. An AI grows it event after event, forever. Matches get played, elections get called, awards get handed out, bills pass or fail, and every result becomes history that the next event builds on. Because something is always happening, there is always something to bet on, and every possible outcome of every event is its own market. Normal prediction markets can be gamed. Someone learns the result first, someone can move it, or someone decides how it settles. Here nobody can do any of that: not the players, not the house, and not us. Every outcome comes from a drand randomness round that is committed on chain before the first bet and does not exist until betting has closed. When it publishes, the contract verifies its signature on chain and derives the result from it. No person, model or operator picks the result, and anyone can re-check it from their own browser. The AI builds the world but cannot choose how anything in it ends. Every possible ending is rendered before betting closes and kept sealed. A Chainlink CRE confidential workflow running inside a TEE releases the key for the one ending the chain settled on. The losing endings are never released. That is a prediction market nobody in the world can control, not even the house. You watch the world live and bet with play USDC on Base Sepolia: https://theworldiscollapsing.vercel.app
How it's made
A pnpm monorepo: Solidity contracts, a Node engine that grows the world, a Next.js site, a subgraph and a Chainlink CRE workflow. Why it cannot be gamed. Two locks. The first decides: every event commits a drand evmnet round on chain when it is created, and that round must publish at least 10 seconds after betting locks. At resolve, the contract verifies the round's BLS signature on chain and sets outcome = keccak256(signature ‖ eventId) mod n. Nobody can know the result while money is on the table, and nobody can choose it. The second seals: every possible ending is rendered before the lock and stored as AES-256-GCM ciphertext, and only a Chainlink CRE confidential workflow inside a TEE derives the key for the ending the chain settled on. What we still hold is liveness, not outcomes: one resolver key can delay a result but not change it, and after three days anyone can bail an event for a full refund. Engine. One Node 24 process in TypeScript with viem and zod runs the world as one state machine per part of it (sports, politics, culture, region): author, render, createEvent, bet, lock, resolve, reveal, then the result is written into the world's history. It is restart-safe against chain state, presence-gated so an empty site costs nothing, and metered against a hard spend cap. All AI goes through OpenRouter. GPT-6 Astra grows the world: it writes each next event as strict JSON from everything that has already happened, which lives in Postgres and is injected into every prompt. GPT-5 mini is the cheap fallback for long soak runs. Gemini 3.1 Flash Image draws a key frame and MiniMax Hailuo 3 Max turns it into footage with image-to-video, under house-style prompts that make it look like real life filmed live: real time, never cinematic, never slow motion. Rendering every future. Generated video cannot stream, so every ending exists before anyone bets. The first half is shared and ends level. While it plays and people bet, one second half per outcome renders in the background, seeded from the first half's last frame. Only the winning branch is ever released, so the reveal has zero latency and nobody can skip ahead. Measured cost is $3.27 per event for 45 seconds of video. Contracts. Foundry, on Base Sepolia, verified on Basescan. Arena runs a YES/NO parimutuel pool on every outcome with a 2% fee, voids markets captured with dust, and has the three-day bail. DrandVerifier checks BN254 BLS signatures with the EVM pairing precompiles. The hacky bit: hash-to-curve needs field inverses and square roots, which we compute through the modexp precompile, so a verify costs about 153k gas with no external library. We chose drand over Chainlink VRF because a VRF result is public the moment it is fulfilled and costs LINK per request, and on OP-stack chains prevrandao can be set by the sequencer. Sponsors. Chainlink CRE: the confidential workflow in TypeScript listens for Arena's Resolved log, reads the outcome from chain on the Workflow DON, and inside the TEE pulls the seal root from the Vault DON and derives the key for the winning ending only. Keys are derived with keccak256 because the workflow runtime has no crypto library. It compiles to WASM and passes its handler tests, deployment is waiting on Confidential Workflows access, and until the engine drops its fallback copy of the root the engine can still decrypt a late key itself. The Graph: a subgraph on Studio indexes every Arena event and powers the markets and positions pages, and the engine can feed the last event's pools back into the next event. Privy: email login with an embedded wallet on Base Sepolia. World: Selfie Check through IDKit 4 with a server-side verify, then Gate.setVerified on chain gates the faucet and every bet; the hosted demo runs a checkbox fallback while the Selfie Check beta is pending. Web. Next.js 16 on Vercel, Prisma 7 on Neon Postgres, Vercel Blob for media. Every event page has a verify badge that fetches the round from api.drand.sh and re-derives the outcome in the browser. Testing without burning money. A fake OpenRouter server replays real MiniMax clips we already paid for, and perpetual bettor bots fund, verify and bet both sides of every market from six wallets. A 10-minute soak across four parts of the world placed 776 bets on 68 events with zero voids and survived restarts of the engine and the bettors mid-window. One framing note. Nowhere does the text say the AI or the TEE decides outcomes, because they don't. drand decides every ending and the chain verifies it. The AI only grows the world, and the TEE keeps the endings sealed. That split is what makes "not even the house can control it" true, and a judge who reads the code will see it matches. Three honest status lines are kept inside "How it's made": - The CRE workflow isn't deployed yet, and the engine still holds a fallback copy of the seal root. - The hosted demo uses a checkbox instead of World Selfie Check. - GPT-5 mini is the fallback author, so set the engine to Astra before any live demo.