-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1012 from liberhe/dev
refactor the code
- Loading branch information
Showing
60 changed files
with
2,254 additions
and
372 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
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 |
---|---|---|
@@ -1,9 +1,6 @@ | ||
//SPDX-License-Identifier: Unlicense | ||
pragma solidity ^0.8.0; | ||
|
||
|
||
|
||
|
||
contract Greeter { | ||
string greeting; | ||
|
||
|
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
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 |
---|---|---|
|
@@ -14,3 +14,4 @@ witness.wtns | |
witness.json | ||
proof.json | ||
proving_key.json | ||
*//multiplier2_cpp/ |
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.0.0; | ||
|
||
/*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.
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,34 @@ | ||
{ | ||
"n8": 32, | ||
"prime": "21888242871839275222246405745257275088548364400416034343698204186575808495617", | ||
"nVars": 4, | ||
"nOutputs": 1, | ||
"nPubInputs": 0, | ||
"nPrvInputs": 2, | ||
"nLabels": 4, | ||
"nConstraints": 1, | ||
"useCustomGates": false, | ||
"constraints": [ | ||
[ | ||
{ | ||
"2": "21888242871839275222246405745257275088548364400416034343698204186575808495616" | ||
}, | ||
{ | ||
"3": "1" | ||
}, | ||
{ | ||
"1": "21888242871839275222246405745257275088548364400416034343698204186575808495616" | ||
} | ||
] | ||
], | ||
"map": [ | ||
0, | ||
1, | ||
2, | ||
3 | ||
], | ||
"customGates": [ | ||
], | ||
"customGatesUses": [ | ||
] | ||
} |
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 @@ | ||
1,1,0,main.c | ||
2,2,0,main.a | ||
3,3,0,main.b |
Binary file not shown.
Binary file not shown.
20 changes: 20 additions & 0 deletions
20
basic/22-zk-snarkjs/circom2/multiplier2_js/generate_witness.js
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.