-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
therealyingtong
committed
Jun 13, 2019
1 parent
a138d38
commit c4d99f6
Showing
8 changed files
with
1,375 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
node_modules | ||
witness.json | ||
verification_key.json | ||
proving_key.json | ||
input.json | ||
proof.json | ||
public.json | ||
circuit.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "circomlib"] | ||
path = circomlib | ||
url = https://github.com/iden3/circomlib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const fs = require("fs"); | ||
|
||
var a = 2; | ||
var b = 4; | ||
var c = 6; | ||
var d = 24; | ||
|
||
const inputs = { | ||
"a": a, | ||
"b": b, | ||
"c": c, | ||
"d": d | ||
} | ||
|
||
fs.writeFileSync( | ||
"./input.json", | ||
JSON.stringify(inputs), | ||
"utf-8" | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
template SimpleChecks(k) { | ||
signal private input a[k]; | ||
signal private input b[k]; | ||
signal input c[k]; | ||
signal private input d[k]; | ||
signal output out; | ||
|
||
var sum = 0; | ||
for (var i = 0; i < k; i++){ | ||
// force a + b = c | ||
a[i] + b[i] === c[i]; | ||
|
||
// force b * c = d | ||
b[i] * c[i] === d[i]; | ||
|
||
// add up c and d arrays | ||
sum = sum + c[i] + d[i]; | ||
} | ||
// output sum of c and d arrays | ||
out <== sum; | ||
} | ||
|
||
component main = SimpleChecks(4); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.