/p0tion

The MPC suite of tools for conducting zkSNARK Phase 2 Trusted Setup ceremonies

Primary LanguageTypeScriptMIT LicenseMIT

๐Ÿงช p0tion ๐Ÿงช

GitHub License GitHub Workflow Test CI Prod Coverage Status Linter ESLint Code style Prettier Repository Top Language


p0tion has been intentionally designed as an agnostic-from-ceremony public good toolkit, with the aim of making Groth16 zk-applications scale and become production-ready in a safe and secure manner by running Phase 2 Trusted Setup ceremonies.

Our design philosophy ensures that p0tion stands as the optimal choice for running secure Groth16 zk-applications via automated phase2 ceremonies. The entire process has been streamlined through the easy to use and configure infrastructure, simplifying coordination, scalability, and minimizing the burden of conducting ceremonies from scratch. Additionally, our clear and user-friendly documentation and code, as well as rapid onboarding and deployment, guarantee an adaptable tool that can easily accommodate the evolving needs of developers.

๐Ÿ“ฆ Packages

Package Version Downloads
@p0tion/actions NPM version Downloads
@p0tion/backend NPM version Downloads
@p0tion/phase2cli NPM version Downloads

๐Ÿ›  Installation

Clone this repository

git clone https://github.com/privacy-scaling-explorations/p0tion.git

Install the dependencies

cd p0tion && yarn

๐Ÿ“œ Usage

Run Rollup to build all the packages

yarn build

๐Ÿ”Ž Code Quality

Run ESLint to analyze the code and catch bugs

yarn lint

Or to automatically lint the code

yarn lint:fix

Run Prettier to check formatting rules

yarn prettier

Or to automatically format the code

yarn prettier:write

๐Ÿ“ Testing

For test execution (e2e/unit) we leverage Jest.

Local Environment

Prerequisites

  • Node.js version 16.0 or higher.
  • Java JDK version 11 or higher.

The Java JDK is required in order to simulate the Firebase services by using the official Firebase Emulator. Note that the first run will result in a download of ~62 MB and no additional configuration is required.

Run Jest to execute (e2e/unit) tests on the emulator locally

yarn test

Production Environment

Prerequisites

  • A Firebase Application w/ active billing (Blaze Plan) in order to support Cloud Functions deployment.
  • Copy the packages/actions/.env.default file as .env cp .env.default .env and add your environment variables.
  • Copy the packages/backend/.default.env file as .env cp .default.env .env and add your environment variables.
  • Generate and store a configuration file with your service account's credentials as described in this documentation inside the packages/backend/serviceAccountKey.json file.
  • Navigate to the backend package by running cd packages/backend
  • Rename the .firebaserc production project alias with your Firebase project name.
  • Deploy your Firebase Application in production by running yarn firebase:deploy (this may take a while to propagate).
  • Remember that if it is your first time using these functions, you might need to give permissions in Google Cloud Console so any user can execute them without running into unauthenticated errors. For more info check this stack overflow thread.

Run Jest to run (e2e/unit) tests in a production environment:

yarn test:prod

โž• Contributions

p0tion uses Conventional Commits. The rules are enforced when running git commit or the command line utility yarn commit.

The commands trigger a verification of changed files to check compliance with custom ESLint and Prettier rules.

License

This repository is released under the MIT License.