snarkjs-groth16-multi-verifier
v0.0.3
Published
Combine multiple similar groth16 Solidity verifier contracts into one contract
Downloads
4
Readme
snarkjs-groth16-multi-verifier
Combine multiple similar groth16 Solidity verifier contracts into one contract
Inspired by Semaphore v4
Installation for development
[!NOTE] Requires pnpm package manager! The tests will fail using yarn.
$ git clone https://github.com/circuitscan/snarkjs-groth16-multi-verifier
$ cd snarkjs-groth16-multi-verifier
$ pnpm i
$ pnpm test
Usage
A single mergeVerifiers
function is exposed
import { readFileSync } from 'node:fs';
import { mergeVerifiers } from 'snarkjs-groth16-multi-verifier';
const mergedSol = mergeVerifiers(
// First argument is an array of Groth16 verifier contracts output by SnarkJS
[
readFileSync('./test/contracts/semaphorev4-1.sol', 'utf8'),
readFileSync('./test/contracts/semaphorev4-2.sol', 'utf8'),
],
// Second argument is the offset for the verifyProof() function
// A value of one means the first verifier in the array is index 1.
1
);
License
MIT