mirror of
https://github.com/tlsnotary/label_decoding.git
synced 2026-01-09 12:08:01 -05:00
21 lines
1.2 KiB
Plaintext
21 lines
1.2 KiB
Plaintext
This repo generates a circom circuit which is used to decode output labels from GC.
|
|
|
|
Install snarkjs https://github.com/iden3/snarkjs
|
|
Download powers of tau^14 https://hermez.s3-eu-west-1.amazonaws.com/powersOfTau28_hez_final_14.ptau
|
|
|
|
Run:
|
|
python3 script.py 10
|
|
# 10 is how much plaintext (in Field elements of ~32 bytes) we want
|
|
# to decode inside the snark. (For tau^14 max is 21)
|
|
# if you need more than 21, you'll need to download another ptau file from
|
|
# https://github.com/iden3/snarkjs#7-prepare-phase-2
|
|
circom circuit.circom --r1cs --wasm --sym
|
|
snarkjs r1cs export json circuit.r1cs circuit.r1cs.json
|
|
cd circuit_js/ && node generate_witness.js circuit.wasm ../input.json ../witness.wtns && cd ..
|
|
snarkjs groth16 setup circuit.r1cs powersOfTau28_hez_final_14.ptau circuit_0000.zkey
|
|
snarkjs zkey contribute circuit_0000.zkey circuit_0001.zkey --name="1st" -v -e="kkk" # 10 sec one-time
|
|
snarkjs zkey contribute circuit_0001.zkey circuit_final.zkey --name="2nd" -v -e="Another"
|
|
snarkjs zkey export verificationkey circuit_final.zkey verification_key.json
|
|
snarkjs groth16 prove circuit_final.zkey witness.wtns proof.json public.json
|
|
snarkjs groth16 verify verification_key.json public.json proof.json
|