zkGames is a platform that allows users to play zk (zero knowledge) games and mint an NFT as proof that they have won.
zkGames

zkGames is a platform that allows users to play zk (zero knowledge) games and mint an NFT as proof that they have won.
The project is currently on Harmony Mainnet and the frontend is hosted on Vercel.
zkGames has 3 games so far: Futoshiki, Skyscrapers and Sudoku.
zkGames Link:
zkGames Demo Video:
Table of Contents
- circuits - contracts - zkgames-ui - Clone the Repository - Run circuits - Run contracts - Run zkgames-ui - Initial page - Futoshiki Game - Skyscrapers Game - Sudoku GameProject Structure
The project has three main folders:
- circuits
- contracts
- zkgames-ui
circuits
The circuits folder contains all the circuits used in zkGames.
To learn more about the zkGames circuits, read the README file inside the circuits folder.
contracts
The contracts folder contains all the smart contracts used in zkGames.
To learn more about the zkGames smart contracts, read the README file inside the contracts folder.
zkgames-ui
The zkgames-ui folder contains the zkGames frontend.
To learn more about the zkGames frontend, read the README file in the zkgames-ui folder.
Zero Knowledge Structure
The following graphic shows the structure of the most important zero knowledge elements of the zkGames project.
โโโ circuits
โ โโโ futoshiki
โ โ โโโ futoshiki.circom
โ โโโ skyscrapers
โ โ โโโ skyscrapers.circom
โ โโโ sudoku
โ โ โโโ sudoku.circom
โโโ contracts
โ โโโ contracts
โ โ โโโ Futoshiki
โ โ โ โโโ Futoshiki.sol
โ โ โ โโโ verifier.sol
โ โ โโโ Skyscrapers
โ โ โ โโโ Skyscrapers.sol
โ โ โ โโโ verifier.sol
โ โ โโโ Sudoku
โ โ โ โโโ Sudoku.sol
โ โ โ โโโ verifier.sol
โโโ zkgames-ui
โ โโโ public
โ โ โโโ zkproof
โ โ โ โโโ futoshiki
โ โ โ โ โโโ futoshiki.wasm
โ โ โ โ โโโ futoshiki_0001.zkey
โ โ โ โโโ skyscrapers
โ โ โ โ โโโ skyscrapers.wasm
โ โ โ โ โโโ skyscrapers_0001.zkey
โ โ โ โโโ sudoku
โ โ โ โ โโโ sudoku.wasm
โ โ โ โ โโโ sudoku_0001.zkey
โ โโโ zkproof
โ โ โโโ futoshiki
โ โ โ โโโ snarkjsFutoshiki.js
โ โ โโโ skyscrapers
โ โ โ โโโ snarkjsSkyscrapers.js
โ โ โโโ sudoku
โ โ โ โโโ snarkjsSudoku.js
โ โ โโโ snarkjsZkproof.js
Run Locally
Clone the Repository
git clone https://github.com/vplasencia/zkGames.git
Run circuits
To run cicuits, go inside the circuits folder:
cd circuits
Then, follow the intructions in the README file in the circuits folder.
Run contracts
To run contracts, go inside the contracts folder:
cd contracts
Then, follow the intructions in the README file in the contracts folder.
Run zkgames-ui
To run the frontend, go inside the zkgames-ui folder:
cd zkgames-ui
Then, follow the intructions in the README file in the zkgames-ui folder.
Steps to Add a New Game
Steps to follow to add a new game (in each step you can check how is done with the other games):
1\. Create the required circom circuits:
- Inside the circuits folder, create a new folder and inside the new folder, create the necessary circom circuits.
- Compile the circuit and generate the
wasm,zkeyandverifier.solfiles using theexecute.shfile.
- Inside the
contracts/contractsfolder, create a new folder with the necessary smart contracts. Add here the verifier.sol generated before using snarkjs. - Change the solidity version to
^0.8.4(it is the version used in the other smart contracts) and the contract name (to<gameName>Verifier) inverifier.sol. - Test the functionalities of the new smart contracts in
scripts/run.js. - Update the
contracts/scripts/deploy.jsfile and deploy smart contracts.
- Inside
zkgames-ui/components, add a new folder to create all the components needed to render the game. - Add a new page inside
zkgames-ui/pagesto access the new game. - Create the css of that page inside
zkgames-ui/styles, called<GameName>.module.css. - Add an image inside
zkgames-ui/assetsto represent the game (width: 700 pixels and height: 700 pixels). - Inside
zkgames-ui/public/zkproofadd a new folder with the wasm and zkey elements generated before. - Inside
zkgames-ui/utils/abiFiles, add a new folder with thejsonabi file of the smart contract. - In
zkgames-ui/utils/contractaddress.json, add the new contract address. - In
zkgames-ui/zkproof, create a new folder and inside the new folder create a new file calledsnarkjs<NewGame>.jswith the code to export the call data. - In
zkgames-ui/components/gameList.jsadd the game as follows:
{
nameGame: "<nameGame>",
imageGame: nameGameImage,
urlGame: "/<nameGame>",
}
Some Images of the zkGames Application
Initial page

Futoshiki Game

Skyscrapers Game

Sudoku Game
