relay wip

This commit is contained in:
poma 2019-07-16 18:38:55 +03:00
parent 6e05a678dd
commit f3b1b7f96e
3 changed files with 46 additions and 1 deletions

View file

@ -10,7 +10,7 @@ const unstringifyBigInts2 = require("snarkjs/src/stringifybigint").unstringifyBi
const rbigint = (nbytes) => snarkjs.bigInt.leBuff2int(crypto.randomBytes(nbytes));
const pedersenHash = (data) => babyjub.unpackPoint(pedersen.hash(data))[0];
async function snarkVerify(proof) {
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);