Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const nullifiers_hash = w[circuit.getSignalIdx('main.nullifiers_hash')];
assert(circuit.checkWitness(w));
assert.equal(w[circuit.getSignalIdx('main.root')].toString(), identity_path.root);
//console.log(w[circuit.getSignalIdx('main.root')]);
/*
console.log(tree[0]);
console.log(w[circuit.getSignalIdx('main.signal_hash')]);
console.log(w[circuit.getSignalIdx('main.external_nullifier')]);
console.log(w[circuit.getSignalIdx('main.root')]);
console.log(w[circuit.getSignalIdx('main.nullifiers_hash')]);
console.log(w[circuit.getSignalIdx('main.identity_commitment.out')]);
*/
const vk_proof = unstringifyBigInts(JSON.parse(fs.readFileSync(path.join(__dirname,'../../build/proving_key.json')).toString()));
const {proof, publicSignals} = groth.genProof(vk_proof, w);
await semaphore.broadcastSignal(
signal_to_contract,
[ proof.pi_a[0].toString(), proof.pi_a[1].toString() ],
[ [ proof.pi_b[0][1].toString(), proof.pi_b[0][0].toString() ], [ proof.pi_b[1][1].toString(), proof.pi_b[1][0].toString() ] ],
[ proof.pi_c[0].toString(), proof.pi_c[1].toString() ],
[ publicSignals[0].toString(), publicSignals[1].toString(), publicSignals[2].toString(), publicSignals[3].toString() ],
);
/*
const evs = await semaphore.getPastEvents('allEvents', {
fromBlock: 0,
toBlock: 'latest'
});
console.log(evs);
*/