How to use the snarkjs.original.genProof function in snarkjs

To help you get started, we’ve selected a few snarkjs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github barryWhiteHat / maci / app / utils / generate_circuit_input.js View on Github external
sender_updated_pubkey: [newAlice.pubkey[0], newAlice.pubkey[1]],
  sender_updated_detail: newAlice.detail,
  signature_R8x: signature.R8[0],
  signature_R8y: signature.R8[1],
  signature_S: signature.S,
  sender_proof: [bobHash],
  sender_proof_pos: [1]
}

const circuit = new Circuit(circuitDef)

console.log('Calculating witnesses....')
const witness = circuit.calculateWitness(circuitInput)

console.log('Generating proof....')
const { proof, publicSignals } = zkSnark.genProof(
  unstringifyBigInts(provingKey), witness
)

const isValid = zkSnark.isValid(
  unstringifyBigInts(verificationKey),
  proof,
  publicSignals
)

console.log(`Inputs passes circuit: ${isValid}`)