File tree Expand file tree Collapse file tree 2 files changed +24
-13
lines changed
Expand file tree Collapse file tree 2 files changed +24
-13
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import dotenv from 'dotenv';
44dotenv.config();
55
66import * as path from 'path';
7+ import * as fs from 'fs';
78
89async function main() {
910 const secretKey = process.env.ADMIN_PRIVATE_KEY;
@@ -33,19 +34,29 @@ async function main() {
3334 });
3435
3536 const circuitPower = '2-1-1-5';
37+
38+ const wasmPath = path.join(
39+ process.cwd(),
40+ `add-new-key_v3/${circuitPower}/addKey.wasm`
41+ );
42+ const zkeyPath = path.join(
43+ process.cwd(),
44+ `add-new-key_v3/${circuitPower}/addKey.zkey`
45+ );
46+
47+ const wasmUint8Array = new Uint8Array(fs.readFileSync(wasmPath));
48+ const zkeyUint8Array = new Uint8Array(fs.readFileSync(zkeyPath));
49+
50+ console.log('WASM Length:', wasmUint8Array.length);
51+ console.log('ZKEY Length:', zkeyUint8Array.length);
52+
3653 const genProof = await voterClient.buildPreAddNewKeyPayload({
3754 stateTreeDepth: 2,
3855 operatorPubkey:
3956 15985671812509037697999452079047723323214510694838922960102081803756551067669n,
4057 deactivates,
41- wasmFile: path.join(
42- process.cwd(),
43- `add-new-key_v3/${circuitPower}/addKey.wasm`
44- ),
45- zkeyFile: path.join(
46- process.cwd(),
47- `add-new-key_v3/${circuitPower}/addKey.zkey`
48- ),
58+ wasmFile: wasmUint8Array,
59+ zkeyFile: zkeyUint8Array,
4960 });
5061
5162 console.log(genProof);
Original file line number Diff line number Diff line change 11import CryptoJS from 'crypto-js';
22import { solidityPackedSha256 } from 'ethers';
3- import { groth16 } from 'snarkjs';
3+ import { groth16, ZKArtifact } from 'snarkjs';
44
55import { MaciAccount } from './account';
66import {
@@ -210,8 +210,8 @@ export class VoterClient {
210210 stateTreeDepth: number;
211211 operatorPubkey: bigint;
212212 deactivates: DeactivateMessage[];
213- wasmFile: string ;
214- zkeyFile: string ;
213+ wasmFile: ZKArtifact ;
214+ zkeyFile: ZKArtifact ;
215215 derivePathParams?: DerivePathParams;
216216 }): Promise<{
217217 proof: {
@@ -269,8 +269,8 @@ export class VoterClient {
269269 stateTreeDepth: number;
270270 operatorPubkey: bigint;
271271 deactivates: bigint[][];
272- wasmFile: string ;
273- zkeyFile: string ;
272+ wasmFile: ZKArtifact ;
273+ zkeyFile: ZKArtifact ;
274274 derivePathParams?: DerivePathParams;
275275 }): Promise<{
276276 proof: {
You can’t perform that action at this time.
0 commit comments