/wordle

intentionally vulnerable risc0 wordle example

Primary LanguageRust

Wordle in the zkVM

Quick Start

First, make sure rustup is installed. This project uses a nightly version of Rust. The rust-toolchain file will be used by cargo to automatically install the correct version.

To build all methods and play Wordle within the zkVM, run the following command:

cargo run

Then, start guessing 5 letter words!

About the game

The game consists of two agents: a player and a server. The zkVM enforces that the server plays fairly.

The game begins with the server choosing a secret word from the wordlist, and sending the player the hash of the secret word.

The player then submits guesses. After each guess, the server returns which letters from the guess match the letters in the secret word. In addition, the server returns a receipt that attests to the logic of the letter-checking and includes the hash of the secret word.

Ensuring fair play

The player ensures that server isn't cheating using the check_receipt function. This function first runs receipt.verify(WORDLE_ID) which ensures that the receipt is valid and was generated by the correct binary file. Then, the check_receipt function checks that the hash in the journal contents match the hash of the secret word provided at the start of the game.