Circuits are written in circom, and we use the hardhat-circom plugin to generate verifier smart contracts. We use hardhat for local smart contract and script development. The frontend is built using React, Vite, Tailwind, and consumes our smart contracts and circuits using wagmi/rainbowkit and snarkjs respectively.
Before starting, complete a Phase 1 trusted setup ceremony or download the results of a completed ceremony.
We recommend using one of the .ptau
files generated from the Polygon Hermez team's ceremony, which can be found here. For more information on why this necessary, see this writeup. We recommend using powersOfTau28_hez_final_20.ptau
for a good tradeoff between the number of constraints supported and file size.
Copy this file into the directory circuits/ptau
(make it if it does not exist).
yarn --dev
yarn compile && yarn deploy
yarn dev
Starting at repo root:
yarn --dev
Compile circom (generate .wasm and .zkey files).
yarn hardhat circom --verbose
Compile smart contracts (generate artifacts)
yarn hardhat compile
Start a local blockchain
yarn hardhat node
In a new terminal, deploy game smart contracts.
yarn hardhat run --network localhost scripts/deploy.ts
Start the frontend dev server.
cd frontend && yarn dev
Happy hacking!