First, follow the examples guide to install dependencies and check out the correct version of the example.
Then, run the example with:
cargo run --release
Welcome to Wordle! Start guessing 5 letter words!
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.
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.