Deal or NOT
On-chain Deal or No Deal with an AI Banker via CRE + Gemini, provably fair via VRF + CRE Confidential
What it is
Deal or NOT is an on-chain version of Deal or No Deal where case values are provably fair yet hidden from players - a problem that's fundamentally hard on a public blockchain.
The core problem: every storage slot on-chain is public. We tried three approaches (Fisher-Yates shuffle, ZK proofs, commit-reveal) and each one was broken - attackable for as little as $0.005 on Base. The solution is CRE Confidential Compute: case values are derived from hash(vrfSeed, caseIndex, CRE_SECRET, bitmap) where the VRF seed is on-chain for fairness and the CRE secret lives inside the enclave for privacy. Players can't precompute values because they're missing the secret. After the game, the secret is published for full auditability.
The AI Banker is a CRE workflow that computes an EV-based offer (mirroring an on-chain BankerAlgorithm library), then calls Gemini 2.5 Flash for a personality message - "I'm feeling generous today... or am I?" - and writes both the offer and the quote on-chain via dual writeReport.
Four CRE workflows run the game autonomously:
- confidential-reveal - derives case values using VRF seed + CRE secret
- banker-ai - EV calculation + Gemini API for AI personality + dual write to game + BestOfBanker gallery
- save-quote - archives banker quotes to BestOfBanker gallery for community voting
- sponsor-jackpot - distributes sponsor-funded prizes per case opening
Additional features: cross-chain play via CCIP (ETH Sepolia to Base Sepolia), BestOfBanker gallery where users upvote AI quotes for $0.02 via Price Feeds, autonomous agent gameplay with staking/leaderboards, and prediction markets on agent outcomes.
Five Chainlink products integrated: VRF v2.5, CRE Confidential Compute, CRE + Gemini AI, Price Feeds (ETH/USD), and CCIP.
```
How it Works
Smart Contracts: Solidity 0.8.24 on Foundry - DealOrNotQuickPlay (game logic + VRF + CRE receiver), BankerAlgorithm (pure EV library), SponsorVault, BestOfBanker, CCIP Gateway/Bridge, plus agent infrastructure (AgentRegistry, AgentStaking, SeasonalLeaderboard, PredictionMarket). 244 Foundry tests passing across 13 test suites.
CRE Workflows: 4 TypeScript workflows deployed to Chainlink CRE - confidential-reveal (EVM Log trigger to case value derivation with enclave secret), banker-ai (EVM Log trigger to EV calc + Gemini 2.5 Flash API to dual writeReport), save-quote (EVM Log trigger to archive quotes to BestOfBanker gallery), sponsor-jackpot (EVM Log trigger to jackpot distribution). All use encryptOutput for CRE Confidential Compute.
Frontend: Next.js 16 (App Router) + RainbowKit + Wagmi + Viem + Tailwind/DaisyUI. Pages for game play, spectating, agent arena, prediction markets, BestOfBanker gallery. Deployed at https://dealornot.vercel.app
Architecture: Player creates game to VRF generates seed to player opens cases to CRE enclave derives values using secret from Vault DON to CRE AI Banker computes offer + calls Gemini to player accepts (DEAL) or rejects (NOT) to game resolves on-chain. Cross-chain: CCIP Gateway on ETH Sepolia sends message to Bridge on Base Sepolia.
Chain: Base Sepolia (primary) + ETH Sepolia (CCIP spoke). Started at ETHDenver, rebuilt for Convergence.
Links
Created by
- Ryan Dobbeck
- Tippi Fifestarr