Skip to content

Circuits and contracts for zk-hangman V2

Notifications You must be signed in to change notification settings

prajwolrg/zk-hangmanV2

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

zk-hangmanV2

Circuits and contracts for zk-hangmanV2.

An implementation of a frontend can be found here: https://github.com/prajwolrg/zk-hangmanV2-frontend

Overview

This is the implementation of the classic Hangman game with the use of smart contracts and zero knowledge proofs. It improves upon the work here.

Table of Contents

Project Structure

The project has three main folders:

  • circuits
  • contracts
  • scripts

circuits

The circuits folder contains all the circuits used in zkHangmanV2.

contracts

The contracts folder contains all the smart contracts used in zkGames. InitVerifier and GuessVerifier contracts are auto-generated.

scripts

The scripts folder contains the scripts for easy compilation of circuits and deployment of contracts.

Zero Knowledge Structure

The following graphic shows the structure of the most important zero knowledge elements of the zkHangmanV2 project. public folder is created on compile.

├── circuits
│   ├── circomlib
│   │   ├── comparators.circom
│   │   ├── mimcsponge.circom
│   ├── guess
│   │   ├── guess.circom
│   ├── init
│   │   ├── init.circom
├── contracts
│   ├── contracts
│   │   ├── GuessVerifier.sol
│   │   ├── InitVerifier.sol
│   │   ├── zkHangman.sol
│   │   ├── zkHangmanFactory.sol
├── public
│   ├── guess_0001.zkey
│   ├── guess_verification_key.json
│   ├── guess.wasm
│   ├── init_0001.zkey
│   ├── init_verification_key.json
│   ├── init.wasm

Run Locally

Clone the Repository

git clone https://github.com/prajwolrg/zk-hangmanV2

Install dependencies

yarn

Run circuits

To run cicuits, we'll utilize te script the scripts folder:

source .scripts/compile_circuits.sh

Run contracts

//TODO: Automate this with script Update the solidity version and the contract name. InitVerifier: contract Verifier -> contract InitVerifier GuessVerifier: contract Verifier -> contract GuessVerifier Also bump the solidity versions on both contracts to ^0.8.0

Before deploying the contracts, create a .env file and add to it:

MNEMONIC=<YOUR_MNEMONIC>

Now deploy to the appropriate network

npx hardhat run --network devnet scripts/deploy.js

About

Circuits and contracts for zk-hangman V2

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Solidity 82.3%
  • JavaScript 10.2%
  • Shell 7.5%