-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
acd386e
commit 1a245b5
Showing
15 changed files
with
512 additions
and
1 deletion.
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 |
---|---|---|
|
@@ -128,3 +128,6 @@ dist | |
.yarn/build-state.yml | ||
.yarn/install-state.gz | ||
.pnp.* | ||
|
||
#Computer files | ||
.DS_Store |
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
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,9 @@ | ||
# Circom Usage | ||
|
||
Assuming you are currently in this folder, | ||
|
||
1. `circom multiplier2.circom --r1cs --wasm` | ||
|
||
2. `node multiplier2_js/generate_witness.js multiplier2_js/multiplier2.wasm input.json witness.wtns` | ||
|
||
3. |
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 @@ | ||
{"a": "3", "b": "11"} |
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,16 @@ | ||
pragma circom 2.1.8; | ||
|
||
/*This circuit template checks that c is the multiplication of a and b.*/ | ||
|
||
template Multiplier2 () { | ||
|
||
// Declaration of signals. | ||
signal input a; | ||
signal input b; | ||
signal output c; | ||
|
||
// Constraints. | ||
c <== a * b; | ||
} | ||
|
||
component main = Multiplier2(); |
Binary file not shown.
Binary file not shown.
Binary file not shown.
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,20 @@ | ||
const wc = require("./witness_calculator.js"); | ||
const { readFileSync, writeFile } = require("fs"); | ||
|
||
if (process.argv.length != 5) { | ||
console.log("Usage: node generate_witness.js <file.wasm> <input.json> <output.wtns>"); | ||
} else { | ||
const input = JSON.parse(readFileSync(process.argv[3], "utf8")); | ||
|
||
const buffer = readFileSync(process.argv[2]); | ||
wc(buffer).then(async witnessCalculator => { | ||
// const w= await witnessCalculator.calculateWitness(input,0); | ||
// for (let i=0; i< w.length; i++){ | ||
// console.log(w[i]); | ||
// } | ||
const buff= await witnessCalculator.calculateWTNSBin(input,0); | ||
writeFile(process.argv[4], buff, function(err) { | ||
if (err) throw err; | ||
}); | ||
}); | ||
} |
Binary file not shown.
Oops, something went wrong.