Zero-knowledge puzzle solving using Noir, Barretenberg, and an on-chain Solidity verifier.
ZK Panagram is a privacy-preserving puzzle game where users prove they solved a Panagram without revealing the solution.
A Noir circuit validates correctness, generates a SNARK proof, and a Solidity contract verifies this proof on-chain.
If verification succeeds, the user mints an ERC-1155 reward token.
This project demonstrates the complete ZK workflow:
- Noir circuit design for puzzle validation
- Proof + key generation using Barretenberg
- Auto-generated Solidity verifier
- ERC-1155 minting gated by valid ZK proofs
- Full Foundry-based test suite
Implements puzzle validation:
- Inputs: user’s guessed letters
- Constraint: guess must match the correct puzzle solution
- Output: a SNARK proof that the solver knows the correct answer without revealing it
Circuit produces:
- Proving and verification keys
- Proof artifacts
- Solidity verifier source file
Used to compile circuits, produce keys, and generate proofs.
Key commands:
nargo compile
bb prove
bb write_vk
bb write_solidity_verifier- Solidity verifier contract is generated directly from the Noir/Barretenberg circuit outputs.
PanagramToken.solimplements ERC-1155 minting, restricted to users who provide a valid SNARK proof.
Flow:
- User solves the puzzle locally.
- Noir + Barretenberg generate a zero-knowledge proof.
- User submits the proof to the smart contract.
- Contract verifies the proof on-chain.
- If valid → ERC-1155 token is minted to the caller.
The test suite validates the entire pipeline:
- Proof verification on-chain
- Correct ERC-1155 minting
- Rejection of invalid/malformed proofs
- Enforcing that each wallet can mint only once
Run tests:
forge test -vvvvEnsure both tools are installed and accessible:
nargo --version
bb --versionCompile the Noir circuit:
cd circuits/panagram
nargo compileCreate the SNARK proof and output artifacts:
bb proveGenerate the on-chain verifier contract:
bb write_solidity_verifierMove the generated Solidity file into the contracts/ directory.
Execute the end-to-end test suite:
forge test -vvvvzk_panagram/
│── circuits/
│ └── panagram/
│ ├── main.nr
│ ├── Prover.toml
│ ├── Verifier.toml
│ └── outputs/
│
│── contracts/
│ ├── PanagramVerifier.sol
│ └── PanagramToken.sol
│
│── script/
│── test/
│── README.md- Writing and compiling Noir circuits
- Generating SNARK proofs with Barretenberg
- On-chain verification using auto-generated Solidity contracts
- ERC-1155 minting secured through zero-knowledge proofs