javiersuweijie / zk-example-cosmwasm

Simple PoC using Cosmwasm to verify a zkSNARK

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Simple ZK PoC on CosmWasm

Simple example of how to compile an example ZK circuit written in circom and verifying it using a Cosmwasm smart contract.

How to verify the proof

terrad query wasm contract-state smart <use contract address here> '{"verify_proof": {"proof": {
 "pi_a": [
  "21207858123081928081835846074913326302960964696364240280703352749535005991417",
  "14429150468123759443650991565415364798215824765125429040428551420671677992616",
  "1"
 ],
 "pi_b": [
  [
   "15662404886624262727465265508640650494405370259150920480154013569638703150350",
   "10283296036499209102393169638050065397675030063212584852145665102923514685161"
  ],
  [
   "6113417907567632135864420380523745444218298352256198754790207510758562784376",
   "11112475924875883212156627975289724665894183879403441941880007808522250916439"
  ],
  [
   "1",
   "0"
  ]
 ],
 "pi_c": [
  "1106026085610139148009582719136803041423232473131464724592610771188345785792",
  "5855598061604651767127447449696104355501826048299916594892918509175201340223",
  "1"
 ],
 "protocol": "groth16",
 "curve": "bn128"
}, "public_inputs": ["33"]}}'

## Result
data: true

About

Simple PoC using Cosmwasm to verify a zkSNARK


Languages

Language:Assembly 70.1%Language:C++ 13.8%Language:Rust 5.6%Language:Solidity 4.8%Language:JavaScript 4.4%Language:TypeScript 0.5%Language:Shell 0.4%Language:Makefile 0.2%Language:Circom 0.1%