https://github.com/iotexproject/zkp-wallet-circuits
https://github.com/iotexproject/zkp-wallet-circuits
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/iotexproject/zkp-wallet-circuits
- Owner: iotexproject
- Created: 2023-02-26T14:53:46.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-06-25T03:11:18.000Z (almost 3 years ago)
- Last Synced: 2025-03-24T13:51:20.217Z (about 1 year ago)
- Language: TypeScript
- Size: 32.2 KB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Account Abstraction Circom
==========================
## Compile circuit
```
circom circuits/passport.circom --r1cs --wasm --sym --c
```
## Show circuit infomation
```
snarkjs info -r passport.r1cs
snarkjs r1cs print passport.r1cs passport.sym
```
## Calculate witness
```
# snarkjs calculatewitness --wasm ./passport_js/passport.wasm --input input.json
node ./passport_js/generate_witness.js ./passport_js/passport.wasm input.json witness.wtns
```
## Trusted setup (Groth16)
```
# Powers of Tau
snarkjs powersoftau new bn128 12 pot12_0000.ptau -v
snarkjs powersoftau contribute pot12_0000.ptau pot12_0001.ptau --name="First contribution" -v
# Phase 2
snarkjs powersoftau prepare phase2 pot12_0001.ptau pot12_final.ptau -v
snarkjs groth16 setup passport.r1cs pot12_final.ptau passport_0000.zkey
snarkjs zkey contribute passport_0000.zkey passport_0001.zkey --name="Second Contributor" -v
# Export verfication key
snarkjs zkey export verificationkey passport_0001.zkey verification_key.json
```
## Proof
### Off-chain
```
# Generate proof
snarkjs groth16 prove passport_0001.zkey witness.wtns proof.json public.json
# Verify proof
snarkjs groth16 verify verification_key.json public.json proof.json
```
### Contract
```
snarkjs zkey export solidityverifier passport_0001.zkey verifier.sol
# generate contract call data
snarkjs zkey export soliditycalldata public.json proof.json
snarkjs zkesc public.json proof.json
```