This is a PlutusTx smart contract that implements the Mastermind game. The aim of this project is to illustrate the use of Zero-Knowledge proofs. It is part of our F10 catalyst proposal.
Mastermind is an ideal use case for zk-Snarks, a zero-knowledge proof cryptographic protocol. This game is played by two players: the codemaster and the codebreaker. The codemaster selects a sequence of colored pegs, while the codebreaker attempts to guess the sequence within a limited number of turns. ZK-Snark can be used to verify the correctness of the codebreaker's guesses without revealing the actual code, ensuring privacy and integrity during gameplay.
The project has the following structure:
├── app
├── nix
├── output
├── src
└── test
- App: Folder with the main application function.
- nix: Configurations files to Nix package manager.
- output: Folder where .uplc compilation is outputted.
- src Folder with application logic.
- test Folder with test to the validator.
To compile the validator use the following commnand.
cabal exec zk-mastermind-onchain
This will automatically build the project and output the .uplc code.
cabal test zk-mastermind-onchain-test
The relevant repositories of the mastermind Dapp are as follows:
- zk-mastermind-webdapp: Frontend application of the Mastermind Dapp.
- zk-mastermind-backend: Backend application of the Mastermind Dapp.
- zk-mastermind-backend-onchain: Hada mint contrat of the Mastermind Dapp.
- zk-mastermind-docker: Docker container with the Kupo, Hydra and Cardano node components of the Dapp.
- zk-mastermind-circom: Circom circuits of the mastermind Dapp.
- zk-mastermind-plutus: PlutusTx validator that implements the logic of the game.
- zk-mastermind-aiken: Aiken validator that implements the logic of the game.