Created
June 14, 2021 05:52
-
-
Save johnson86tw/c6d76ef15c108464539de535d48a7f9b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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