Skip to content

Instantly share code, notes, and snippets.

@johnson86tw
Created June 14, 2021 05:52
Show Gist options
  • Save johnson86tw/c6d76ef15c108464539de535d48a7f9b to your computer and use it in GitHub Desktop.
Save johnson86tw/c6d76ef15c108464539de535d48a7f9b to your computer and use it in GitHub Desktop.
describe("ZK", function () {
it("should process", async () => {
const secret = 42;
const input = { secret };
const output = secret * secret + 6;
const publicSignals = [BigInt(output)];
let { proof } = await groth16.fullProve(input, wasmPath, zkeyPath);
const calldata = await groth16.exportSolidityCallData(unstringifyBigInts(proof), publicSignals);
const args = JSON.parse("[" + calldata + "]");
await zk.process(...args);
expect(await zk.greet()).to.equal(
"answer to the ultimate question of life, the universe, and everything",
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment