diff --git a/phase2/.gitignore b/phase2/.gitignore index cfa3316..bd0389f 100644 --- a/phase2/.gitignore +++ b/phase2/.gitignore @@ -7,5 +7,4 @@ phase1radix2m* /*.json /*.bin /*.params -/*.circom /verifier.sol \ No newline at end of file diff --git a/phase2/circuit.circom b/phase2/circuit.circom new file mode 100644 index 0000000..ade4725 --- /dev/null +++ b/phase2/circuit.circom @@ -0,0 +1,15 @@ +template Num2Bits(n) { + signal input in; + signal output out[n]; + var lc1=0; + + for (var i = 0; i> i) & 1; + out[i] * (out[i] -1 ) === 0; + lc1 += out[i] * 2**i; + } + + lc1 === in; +} + +component main = Num2Bits(253); \ No newline at end of file diff --git a/phase2/input.json b/phase2/input.json new file mode 100644 index 0000000..ec2e84c --- /dev/null +++ b/phase2/input.json @@ -0,0 +1 @@ +{"in": 42} \ No newline at end of file diff --git a/phase2/test.sh b/phase2/test.sh index eed736a..e33ec2b 100755 --- a/phase2/test.sh +++ b/phase2/test.sh @@ -29,7 +29,7 @@ cargo run --release --bin verify_contribution circuit.json circom3.params circom # generate resulting keys cargo run --release --bin export_keys circom4.params vk.json pk.json # create dummy keys in circom format -echo "generating dummy key files..." +echo "Generating dummy key files..." npx snarkjs setup --protocol groth # patch dummy keys with actual keys params cargo run --release --bin copy_json proving_key.json pk.json transformed_pk.json