Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
AgustinBadi authored Mar 27, 2024
1 parent e72bf5d commit d204df3
Showing 1 changed file with 23 additions and 32 deletions.
55 changes: 23 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
```

0 comments on commit d204df3

Please sign in to comment.