zk-MNIST scaffold app. Authors: @horacepan @sunfishstanford @henripal
This project is part of 0xPARC's winter 2021 applied zk learning group
This draws heavily from 0xJOF's zk learning in public repo and Wei Jie Koh's zk nft mint repo
- draw a digit
- pass the digit through 2 conv layers and one FC layer in browser, generating a dim 50 embedding
- generate a ZKsnark proof in browser that the embedding represents a given digit
- verify proof on-chain using ethers + snarkjs
Prerequisites: global install of circom 2.0
- git clone the repo
cd
into the directorynpm i
to install dependencies- generate powers of tau
yarn zk:ptau
- compile circuits
yarn zk:compile
- compile the contracts
npx hardhat compile
- start a local ether node:
npx hardhat node
- switch to another terminal
- deploy the smart contract
npx hardhat run scripts/deploy.js --network localhost
- make a note of where the contract address has been deployed
- edit
verifierAddress
in./src/App.js
- start web app
npm start
All zk circuits are in the zk
directory.
- generate basic powers of tau phase 1 with
yarn zk:ptau
- compile the circuits, generate the solidty validator with
yarn zk:compile
- test the circuits:
node src/generateJSProof.js
yarn contracts:test
- tests the contracts