A garaga workshop, featuring Groth16 proof generation and on-chain verification and a small ui. Features complete circuit compilation, client-side proving, and onchain verify
resources link: https://hackmd.io/@IrxgNBpSQKSNBTpimFhtYA/ByEsI1Kjll
# 1. Install dependencies
pnpm install
# 2. Setup Python environment
~/.pyenv/versions/3.10.12/bin/python -m venv .venv
source .venv/bin/activate
pip install garaga python-dotenv
# 3. Build circuits
pnpm setup:circuits
# 4. Generate verifiers
pnpm generate:verifiers
# 5. Deploy to Sepolia (requires .secrets file)
pnpm deploy:sepolia
# 6. Start app
pnpm devRequired Tools:
# Node.js tools for circuit compilation
npm install -g circom snarkjs
# Starknet development tools
curl https://get.starkli.sh | sh && starkliup
curl -L https://docs.swmansion.com/scarb/install.sh | bash
# Python 3.10 + Garaga for verifier generation
curl https://pyenv.run | bash
pyenv install 3.10.12 && pyenv local 3.10.12
pip install garagaSepolia Deployment (Optional):
Create .secrets file with your Sepolia credentials:
SEPOLIA_ACCOUNT_ADDRESS=0x...
SEPOLIA_PRIVATE_KEY=0x...
SEPOLIA_RPC_URL=https://starknet-sepolia.g.alchemy.com/...Age Verification Circuit (circuits/circom/age_verification.circom)
Private Inputs: age, salt
Public Outputs: hash
Constraints:
- age >= 18
- hash = Poseidon(age, salt)
Features:
- Hash Function: Poseidon for cryptographic security
- Privacy: Age remains private, only hash is public
- Verification: Prove you're 18+ without revealing exact age
- Randomness: Salt prevents hash table attacks
├── apps/web/ # React frontend
│ ├── src/
│ │ ├── components/ # UI components
│ │ ├── context/ # Starknet wallet context
│ │ └── config/ # Contract addresses
│ └── public/circom/ # Circuit artifacts (WASM, zkey, vkey)
├── circuits/circom/ # Age verification circuit
├── verifiers/ # Garaga-generated Cairo contracts
├── scripts/ # Automation scripts
└── setup-fresh-clone.sh # Complete setup script
# Setup and building
pnpm setup:circuits # Build circuits with all artifacts
pnpm circuits:copy # Copy verification key to frontend
pnpm generate:verifiers # Generate Garaga Cairo contracts
# Deployment
pnpm deploy:sepolia # Deploy to Sepolia testnet
pnpm deploy:devnet # Deploy to local devnet
pnpm deploy:mainnet # Deploy to mainnet
# Development
pnpm dev # Start development server
pnpm build # Build for production
pnpm clean # Clean all artifacts and restart- Open: Visit http://localhost:5174 (after running setup)
- Input: Enter age (≥18) and salt for privacy
- Generate Proof: Click to create ZK proof (takes 2-5 seconds)
- Connect Wallet: Use Argent X or Braavos wallet on Sepolia
- Verify: Submit proof to Starknet for on-chain verification
- Result: View transaction hash and verification status
1. snarkjs.groth16.fullProve() → Standard Groth16 proof
2. snarkJsProofIntoGaraga() → Convert to Garaga format
3. garaga.getGroth16CallData() → Generate massive calldata (~2000 entries)
Circom → R1CS + WASM + Witness → Powers of Tau → zkey → Verification Key
- "Garaga unreachable": Run
pnpm circuits:copyto copy verification key - "Verification failed": Ensure deployed verifier matches frontend verification key
- "Transaction failed": Check wallet is connected to correct network (Sepolia)