UNPKG

@aptos-labs/zk-ceremony

Version:

All-in-one interactive command-line for interfacing with zkSNARK Phase 2 Trusted Setup ceremonies

80 lines (68 loc) 2.75 kB
#!/usr/bin/env node import "./lib/init-env.js" import { createCommand } from "commander" import { readPackageUpSync } from "read-package-up" import { setup, auth, contribute, observe, finalize, clean, logout, validate, listCeremonies } from "./commands/index.js" import { fileURLToPath } from 'node:url' import path from 'node:path' const __dirname = path.dirname(fileURLToPath(import.meta.url)) const { packageJson: { name, description, version } } = readPackageUpSync({cwd: __dirname}) const program = createCommand() // Entry point. program.name(name).description(description).version(version) // User commands. program.command("auth").description("authenticate yourself using your Github account (OAuth 2.0)").action(auth) program .command("contribute") .description("compute contributions for a Phase2 Trusted Setup ceremony circuits") .option("-c, --ceremony <string>", "the prefix of the ceremony you want to contribute for", "") .option("-e, --entropy <string>", "the entropy (aka toxic waste) of your contribution", "") .option("-a, --auth <string>", "the Github OAuth 2.0 token", "") .action(contribute) program .command("clean") .description("clean up output generated by commands from the current working directory") .action(clean) program.command("list").description("List all ceremonies prefixes").action(listCeremonies) program .command("logout") .description("sign out from Firebae Auth service and delete Github OAuth 2.0 token from local storage") .action(logout) program .command("validate") .description("Validate that a Ceremony Setup file is correct") .requiredOption("-t, --template <path>", "The path to the ceremony setup template", "") .option("-c, --constraints <number>", "The number of constraints to check against") .action(validate) // Only coordinator commands. const ceremony = program.command("coordinate").description("commands for coordinating a ceremony") ceremony .command("setup") .description("setup a Groth16 Phase 2 Trusted Setup ceremony for zk-SNARK circuits") .option("-t, --template <path>", "The path to the ceremony setup template", "") .option("-a, --auth <string>", "The Github OAuth 2.0 token", "") .action(setup) ceremony .command("observe") .description("observe in real-time the waiting queue of each ceremony circuit") .action(observe) ceremony .command("finalize") .description( "finalize a Phase2 Trusted Setup ceremony by applying a beacon, exporting verification key and verifier contract" ) .option("-a, --auth <string>", "the Github OAuth 2.0 token", "") .action(finalize) program.parseAsync(process.argv)