1.5 KiB
FHEWordle
How the Game Works
-
Game Setup: A factory contract deploys unique game instances for each player using minimal proxies. Each game has:
- An encrypted target word (represented as encrypted letter indices 0-25)
- A player address who can submit guesses
- A relayer address who helps with FHE operations
-
Word Submission: The relayer submits the encrypted target word letters using
submitWord1. The letters are stored as encrypted uint8 values. -
Player Guessing: Players submit guesses by calling
guessWord1with:- A word encoded as a uint32 (each letter as index 0-25)
- A Merkle proof verifying the word is valid
- Limited to 5 guesses total
-
Guess Feedback: After each guess, players can request feedback via
getGuesswhich returns:- An encrypted equality mask showing exact letter matches (green)
- An encrypted letter presence mask showing letters in wrong positions (yellow)
-
Winning: Players can claim victory using
claimWinif they get all letters correct. The contract verifies this using FHE operations. -
Word Revelation: After game completion, the target word can be revealed using
revealWordAndStore. -
Proof Verification: The relayer can verify game outcomes using Merkle proofs via
checkProof.
The game leverages FHE operations to keep the target word encrypted while still allowing comparison with guesses. This prevents players from seeing the word until the game is complete.