How to use the snarkjs/src/stringifybigint.unstringifyBigInts 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_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}`)
github barryWhiteHat / maci / app / utils / generate_circuit_input.js View on Github external
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}`)
github tornadocash / tornado-core / scripts / utils.js View on Github external
function snarkVerify(proof) {
  proof = unstringifyBigInts2(websnarkUtils.fromSolidityInput(proof))
  const verification_key = unstringifyBigInts2(require('../build/circuits/withdraw_verification_key.json'))
  return groth.isValid(verification_key, proof, proof.publicSignals)
}
github tornadocash / tornado-core / scripts / utils.js View on Github external
function snarkVerify(proof) {
  proof = unstringifyBigInts2(websnarkUtils.fromSolidityInput(proof))
  const verification_key = unstringifyBigInts2(require('../build/circuits/withdraw_verification_key.json'))
  return groth.isValid(verification_key, proof, proof.publicSignals)
}