About
## Wave 1 submission
CasFin — What We're Building & What Changed Every casino on-chain today has a dirty secret: your bets are public. The moment you submit a transaction — what you bet, how much, which side you picked — it's visible to everyone on the network before it even confirms. CasFin fixes this using Fully Homomorphic Encryption (FHE) via the Fhenix CoFHE coprocessor. For a casino, this changes everything. How a normal on-chain casino works: You call placeBet(true, 0.1 ETH) — "heads, 0.1 ETH." That transaction sits in the mempool as plaintext. Any bot can see it, front-run it, or use it to manipulate the outcome. The house knows your bet before it's even confirmed. The entire history of your plays — every amount, every guess, every win and loss — is permanently public on-chain forever.
How CasFin works: You encrypt your bet client-side using the cofhejs SDK before it ever reaches the network. What goes on-chain is ciphertext — InEbool for your coin flip guess, InEuint128 for your bet amount. The smart contract never decrypts these during your bet. It stores encrypted handles. When resolution time comes, the CoFHE coprocessor — a network of nodes running FHE computation off-chain — compares your encrypted guess against the encrypted outcome homomorphically, produces an encrypted win/loss flag, and posts it back to the chain. The contract then settles your balance, also encrypted, so your final balance is never exposed either. What we shipped this wave: The encrypted resolution flow was rebuilt from scratch. Previously the contracts tried to decrypt and read values in the same transaction — the CoFHE coprocessor doesn't work that way, it's async. Resolution now runs in two separate transactions by design: the first submits the decrypt task to the CoFHE network, the second — called after the coprocessor completes — reads the result and settles the vault. We encrypted the player's coin-flip guess end to end, which wasn't done before. We added an encrypted max-bet cap that's validated entirely inside FHE so even the cap value is never exposed. We eliminated an event that was broadcasting each crash player's exit multiplier publicly on-chain — their strategy is now completely private. We wrote the keeper bot spec that bridges the async gap — it watches for randomness fulfillment, submits the first transaction to trigger decryption, then monitors for CoFHE completion and submits the finalization. The frontend is being rebuilt from a developer debug panel into a premium glassmorphism casino UI . The core difference: Every other on-chain casino gives you provable fairness. CasFin gives you provable fairness plus provable privacy. The randomness is verifiable via Chainlink VRF. The game logic is on-chain and auditable. But your bet, your amount, your strategy — none of it is ever readable by anyone except you. That's not just better than on-chain casinos. That's better than most off-chain ones too.
## Wave 2 submission
CoFHE SDK Integration Rebuilt the entire FHE pipeline end-to-end. Every bet input is now encrypted in the browser before reaching the network. Coin Flip encrypts your side selection and bet amount. Dice encrypts your target number and amount. The CoFHE session initializes automatically on wallet connect — the frontend disables betting until the TFHE engine is fully warmed. No user action required. Resolution runs in two async transactions: the first submits a decrypt task to the CoFHE network, the second reads the result and settles the vault. The keeper bridges this gap automatically. Encrypted max-bet cap and win/loss comparison both happen entirely inside FHE — the contract never sees plaintext. On Arbitrum Sepolia, CoFHE nodes aren't present (they only run on Fhenix-native chains), so we added forceResolve to each contract — bypasses async decrypt and settles using on-chain randomness. Testnet-only. When CasFin moves to Fhenix, forceResolve disables and the full FHE flow takes over. Same interface, zero frontend changes. Privy Wallet Integration Wave 1 wallet UX was raw MetaMask-only — manual network switching, no embedded wallets, high drop-off. Wave 2 replaced the entire wallet layer with Privy. Embedded wallets for users without MetaMask. Social login (email, Google, Twitter) as onramp. Automatic network switching. Session persistence across refreshes. Onboarding now reduces to: click Connect → sign in → play. New Game: Poker Four games now live: Coin Flip, Dice, Crash, and Poker. Poker uses the same FHE pipeline — card values encrypted on-chain, hand evaluation over encrypted state, payouts to encrypted vault balance. Same architecture: CoFHE session gating, encrypted inputs, keeper-driven resolution. Deployed alongside existing contracts, managed by the same keeper. Event-Driven Resolution: WebSocket + Redis Pub/Sub Killed polling entirely. The Wave 1 keeper polled every 15–60 seconds — slow and wasteful. Keeper now connects via WebSocket and subscribes to contract events. When BetPlaced fires, keeper hears it within the same block and immediately submits resolution. Resolution drops from 30–90 seconds to 3–6 seconds — just blockchain confirmation time. Redis pub/sub (Upstash) sits between keeper and frontend. Results publish to a Redis channel; frontend subscribes via Server-Sent Events through a Next.js API route — UI updates live, no refresh. Backup polling worker catches events missed during WebSocket reconnection. Multi-RPC Load Balancing Single RPC in Wave 1 meant rate limits and failures cascaded. Wave 2 adds four RPC URLs with automatic failover and rotation. Keeper has its own dedicated endpoint to prevent resolution transactions from competing with user reads. Infura, Alchemy, and public endpoints configured as fallbacks. Casino UI Overhaul
## Wave 3 submission
CoFHE Result Processor Migration We completely ripped out the legacy HTTP polling loops from the keeper infrastructure. In Wave 2, we started using WebSockets, but the keeper still polled contract states incorrectly. Wave 3 aligns directly with official Fhenix CoFHE architecture. The keeper now uses a resilient WebSocketProvider wrapper to listen strictly for DecryptionResult events emitted by the on-chain TaskManager. Instead of brute-force block scanning, the keeper sleeps until the Threshold Network officially publishes the decrypt result, triggering finalizeResolution instantly.
Infrastructure Hardening & Deployment The local/VPS keeper bot was migrated to a highly available PaaS (Railway) with native auto-restart policies and strict environment management. AWS Lambda fallback workers were optimized using AWS Secrets Manager to pull RPCs and private keys dynamically, removing hardcoded credentials from the repository entirely. The multi-RPC load balancer was further hardened with exponential backoff and 500-error cooldowns to guarantee the keeper never stalls during Alchemy/Infura outages.
Midnight Nebula UI Overhaul The frontend received a massive aesthetic upgrade to the "Midnight Nebula" design system. Visual dead space was eliminated across the Casino interface. We introduced a premium, terminal-inspired dark mode featuring scanlines, pulse-gold interactive buttons, dynamic hero panels, and cinematic glassmorphism. Typography was standardized using JetBrains Mono and DM Serif Display to create a high-end, immersive trading and betting environment.
Legacy Contract Audit & FHE Exclusivity Conducted a comprehensive smart contract audit to permanently purge all legacy, transparent (non-encrypted) game contracts and mock interfaces from the repository. The protocol is now strictly and exclusively an FHE ecosystem. The EncryptedCasinoVault and corresponding game contracts are the only active logic, guaranteeing that all player data, balances, and outcomes remain mathematically private from end to end.
## Wave 4 submission
will update
## Wave 5 submission
In this wave we strengthened CasFin’s core Web3 and realtime flow, not just the surface UI. The wallet transaction layer now follows a cleaner path: before any transaction, the app checks wallet availability, requests the account, verifies Arbitrum Sepolia, checks wallet balance, and starts or reuses the encrypted CoFHE session. Only after those checks does it create the ethers signer and submit the contract call. This makes casino bets, vault actions, prediction trades, resolver calls, and claims go through one safer transaction pipeline. We also improved CoFHE session handling so encrypted-session startup no longer breaks the page layout. The session loader now appears as a controlled overlay, uses the public landing video, shows live progress, and includes a Skip action that moves the loader into a compact top-corner status view while the app continues loading. On the backend/protocol side, we reviewed the keeper architecture. The keeper watches encrypted casino and prediction-market contracts, requests CoFHE resolution, retries while decrypt results are pending, finalizes resolved bets, closes/finalizes crash rounds, and handles expired prediction markets. It serializes keeper writes through a transaction queue to avoid nonce conflicts. The system supports optional blockchain WebSocket subscriptions through an ethers WebSocketProvider with reconnect/backoff logic. If ARBITRUM_SEPOLIA_WSS_URL is available, the keeper subscribes to bet and market events in near real time; if WSS is unavailable, it falls back to polling so settlement still works reliably. Redis pub/sub is also wired: the keeper publishes bet- resolution events to casfin:bets, the Next.js SSE route streams those events through /api/events/bets, and the frontend hook reconnects automatically with exponential backoff and refreshes state when the browser tab becomes visible again. We also reviewed the indexing layer. The Prisma event indexer syncs on-chain events from casino, vault, crash, and prediction-market contracts into the database using block-range queries and sync cursors. It supports continuous polling, one-shot sync, and backfill mode. Chainlink integration was audited as well: Chainlink price-feed support exists in the encrypted market resolver, including stale-price checks, threshold comparison, and latestRoundData validation. A live Arbitrum Sepolia ETH/USD feed call worked through the configured RPC, and the VRF adapter/subscription were readable and funded. However, active FHE casino randomness currently uses Fhenix native encrypted randomness, while frontend-created prediction markets still use manual keeper resolution unless Chainlink market creation is added later.
From the public Akindo product page. Votes, swipes and the judge score are hackfeed's own.





