From d204df3071c1e5997fc37f342a2cd8b1327eb377 Mon Sep 17 00:00:00 2001 From: ash <52472400+AgustinBadi@users.noreply.github.com> Date: Wed, 27 Mar 2024 18:20:05 -0300 Subject: [PATCH] Update README.md --- README.md | 55 +++++++++++++++++++++++-------------------------------- 1 file changed, 23 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index 2851246..f9b0095 100644 --- a/README.md +++ b/README.md @@ -1,55 +1,46 @@ -# mastermind-aiken +# zk-mastermind-aiken -Write validators in the `validators` folder, and supporting functions in the `lib` folder using `.ak` as a file extension. +This is a Aiken validator that implements the Mastermind game. The aim of this project is to illustrate the use of zero-knowledge proofs, and it is part of our F10 Catalyst proposal. -For example, as `validators/always_true.ak` +Mastermind is an ideal application for zk-SNARKs, a cryptographic protocol enabling zero-knowledge proofs. This two-player game features a codemaster, who chooses a sequence of colored pegs, and a codebreaker, who aims to guess this sequence within a set number of attempts. zk-SNARKs can verify the accuracy of the codebreaker's guesses without disclosing the actual sequence, thereby preserving the secret code and integrity simultaneously throughout the game. -```gleam -validator { - fn spend(_datum: Data, _redeemer: Data, _context: Data) -> Bool { - True - } -} -``` +## Versions -## Building +There are two versions of the validator to suit different transaction construction. Each one reside in different branches of the repository: -```sh -aiken build -``` +* **Main:** In the main branch resides the inlined datum version. +* **feature/datum-hash:** In this branch resides the datum-hashed version. -## Testing +## Compilation -You can write tests in any module using the `test` keyword. For example: +To compile the validator use the following command: -```gleam -test foo() { - 1 + 1 == 2 -} +```sh +aiken build ``` -To run all tests, simply do: +This will create a blueprint of the validator where the compiled code can be accessed and interfaces of the data. Also the blueprint can be converted into a .plutus format with the following command. ```sh -aiken check +aiken blueprint convert ``` -To run only tests matching the string `foo`, do: +## Execute test + +Several test have been made to check the game logic. One can execute a simulation of a full game running: ```sh -aiken check -m foo +aiken check -t silent -m tests/full_game ``` -## Documentation - -If you're writing a library, you might want to generate an HTML documentation for it. - -Use: +The game also allows winning by default, that is when an user doesn't respond to the game within a 20minutes range. This is tested with: ```sh -aiken docs +aiken check -t silent -m tests/win_by_default ``` -## Resources +Finally many attacks have been anticipated and tested. To check this run: -Find more on the [Aiken's user manual](https://aiken-lang.org). +```sh +aiken check -t silent -m tests/attacks +```