Crackd - a confidential 1v1 code-breaking game where your code is encrypted on-chain (fhEVM)

Crackd is a confidential 1v1 code-breaking game (think Mastermind) built on Zama’s fhEVM. You pick a secret 4-digit code; it’s sealed on-chain as an encrypted euint8[4], and every guess is scored directly on the ciphertext, so the code is never revealed to the opponent, the server, or the chain itself.

:video_game: Play live: crackd-fhe[dot]vercel[dot]app
:open_book: How it works: crackd-fhe[dot]vercel[dot]app/how-it-works
:laptop: Code: github[dot]com/martinvibes/Crackd-Fhe
:movie_camera: Demo video: youtu[dot]be/<7PpS6Z971tI>

Why it’s a real FHE use case

The hard part of Mastermind isn’t hiding the code, it’s scoring a guess without decrypting it, including the tricky duplicate-digit case. CrackdFHE computes both peg types entirely on ciphertext:

  • POT (right digit, right place): per position, FHE.eq(secret[i], guess[i]) → encrypted bool → summed.
  • PAN (right digit, wrong place): per digit value, FHE.min(count_in_secret, count_in_guess) minus the POTs, so duplicates never over-count.

Ops used: FHE.fromExternal, FHE.eq, FHE.min, FHE.add, FHE.sub, FHE.select, FHE.allow. The encrypted feedback handles are ACL-granted to the guesser, who decrypts them client-side via the relayer’s userDecrypt.

No trusted referee, no commit-reveal that leaks at the end, no ZK circuit, the contract is the referee, because it computes on data it can’t read.

Two-sided & fully confidential

It’s a real duel: you seal your code, the AI “Vault” seals its, and you alternate turns cracking each other, with every score on-chain, on ciphertext. There’s also a “Decrypt my code” button that pulls your sealed code back from the chain and unseals it just for you- proof it lived encrypted the whole time.

Stack: @fhevm/solidity, @zama-fhe/relayer-sdk, Hardhat, React + Vite, Node/Express. Live on Ethereum Sepolia (frontend on Vercel, backend on Railway).

Deployed contract: CrackdFHE 0x9A050f34B461D984ca227874265Bc2969024257a

Would love feedback — happy to answer anything about the ciphertext scoring! :unlocked:

1 Like

Hey @martinvibes thanks for submitting Crackd to the Mainnet Season 3 Builder Track! We’ve received it and the team will take a closer look soon.

Any questions in the meantime? Happy to help.

Best,
Jan

1 Like