e.eq,
e.or, e.and, and e.select on encrypted values. The contract never branches
on a plaintext letter.
How it works
AHangmanFactory holds a list of encrypted words. A master account seeds them
with addWord or seedWords, paying one inco.getFee() per word. Each word is a
4-character string packed into one euint256 and stored encrypted.
To start a game, the factory picks a word and deploys a per-player
HangmanGame, granting that game access to the chosen word. The word index is
chosen pseudo-randomly from block data, but that only picks which entry to use.
The word itself stays encrypted, so the selection never leaks it.
The game holds all state encrypted, readable only by the player:
Guessing a letter
guessLetter runs entirely on encrypted data:
e.allow. The frontend
decrypts them off-chain to paint the board and show remaining lives. The contract
stores only handles, so the word and the running state never appear in the clear.
Running it
The repo is a Next.js frontend plus a Hardhat contracts folder. It targets Base Sepolia testnet.PRIVATE_KEY, SEED_PHRASE, and BASE_SEPOLIA_RPC_URL in contracts/.env
before deploying or testing.