|
@ -183,7 +183,31 @@ generate call parameters |
|
|
|
|
|
|
|
|
Default: public.json |
|
|
Default: public.json |
|
|
|
|
|
|
|
|
|
|
|
circuit info |
|
|
|
|
|
============ |
|
|
|
|
|
|
|
|
|
|
|
snarkjs info <options> |
|
|
|
|
|
|
|
|
|
|
|
Print statistics of a circuit |
|
|
|
|
|
|
|
|
|
|
|
-c or --circuit <circuitFile> |
|
|
|
|
|
|
|
|
|
|
|
Filename of the compiled circuit file generated by circom. |
|
|
|
|
|
|
|
|
|
|
|
Default: circuit.json |
|
|
|
|
|
|
|
|
|
|
|
print constraints |
|
|
|
|
|
================= |
|
|
|
|
|
|
|
|
|
|
|
snarkjs printconstraints <options> |
|
|
|
|
|
|
|
|
|
|
|
Print all the constraints of a given circuit |
|
|
|
|
|
|
|
|
|
|
|
-c or --circuit <circuitFile> |
|
|
|
|
|
|
|
|
|
|
|
Filename of the compiled circuit file generated by circom. |
|
|
|
|
|
|
|
|
|
|
|
Default: circuit.json |
|
|
`)
|
|
|
`)
|
|
|
.alias("c", "circuit") |
|
|
.alias("c", "circuit") |
|
|
.alias("pk", "provingkey") |
|
|
.alias("pk", "provingkey") |
|
@ -219,7 +243,23 @@ function p256(n) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
try { |
|
|
try { |
|
|
if (argv._[0].toUpperCase() == "SETUP") { |
|
|
|
|
|
|
|
|
if (argv._[0].toUpperCase() == "INFO") { |
|
|
|
|
|
const cirDef = JSON.parse(fs.readFileSync(circuitName, "utf8")); |
|
|
|
|
|
const cir = new zkSnark.Circuit(cirDef); |
|
|
|
|
|
|
|
|
|
|
|
console.log(`# Wires: ${cir.nVars}`); |
|
|
|
|
|
console.log(`# Constraints: ${cir.nConstraints}`); |
|
|
|
|
|
console.log(`# Private Inputs: ${cir.nPrvInputs}`); |
|
|
|
|
|
console.log(`# Public Inputs: ${cir.nPubInputs}`); |
|
|
|
|
|
console.log(`# Outputs: ${cir.nOutputs}`); |
|
|
|
|
|
|
|
|
|
|
|
} else if (argv._[0].toUpperCase() == "PRINTCONSTRAINTS") { |
|
|
|
|
|
const cirDef = JSON.parse(fs.readFileSync(circuitName, "utf8")); |
|
|
|
|
|
const cir = new zkSnark.Circuit(cirDef); |
|
|
|
|
|
|
|
|
|
|
|
cir.printConstraints(); |
|
|
|
|
|
|
|
|
|
|
|
} else if (argv._[0].toUpperCase() == "SETUP") { |
|
|
const cirDef = JSON.parse(fs.readFileSync(circuitName, "utf8")); |
|
|
const cirDef = JSON.parse(fs.readFileSync(circuitName, "utf8")); |
|
|
const cir = new zkSnark.Circuit(cirDef); |
|
|
const cir = new zkSnark.Circuit(cirDef); |
|
|
const setup = zkSnark.setup(cir); |
|
|
const setup = zkSnark.setup(cir); |
|
@ -322,7 +362,7 @@ try { |
|
|
const public = unstringifyBigInts(JSON.parse(fs.readFileSync(publicName, "utf8"))); |
|
|
const public = unstringifyBigInts(JSON.parse(fs.readFileSync(publicName, "utf8"))); |
|
|
const proof = unstringifyBigInts(JSON.parse(fs.readFileSync(proofName, "utf8"))); |
|
|
const proof = unstringifyBigInts(JSON.parse(fs.readFileSync(proofName, "utf8"))); |
|
|
|
|
|
|
|
|
inputs = ""; |
|
|
|
|
|
|
|
|
let inputs = ""; |
|
|
for (let i=0; i<public.length; i++) { |
|
|
for (let i=0; i<public.length; i++) { |
|
|
if (inputs != "") inputs = inputs + ","; |
|
|
if (inputs != "") inputs = inputs + ","; |
|
|
inputs = inputs + p256(public[i]); |
|
|
inputs = inputs + p256(public[i]); |
|
|