@devtion/backend
TypeScript icon, indicating that this package has built-in type declarations

0.0.0-e312890 • Public • Published

Backend ⚙️

An easy-to-configure, deploy and maintain cloud infrastructure solution for automating the coordination, scalability, and storage of your Groth16 zkSNARKs Phase 2 Trusted Setup ceremonies.

Github License NPM Version Downloads Linter Prettier

This library provides everything needed to configure, deploy and manage the infrastructure required to run one or more Phase 2 Trusted Setup ceremonies.

Launching the ready-to-run customized scripts everyone could handle whatever is needed to accomplish the users authentication, ceremony setup, coordination and finalization. You could count on the combination of services provided by the far most popular cloud solutions in the market, as AWS for S3 Storage and GCP Firebase for Authentication, Firestore DB and, Cloud Functions services.

Components Diagram

🛠 Installation

Prerequisites

  • Node.js version 16.0 or higher.
  • Yarn version 3.5.0 or higher.
  • A Firebase Application w/ active billing (Blaze Plan) in order to support Cloud Functions deployment.
  • Follow the Installation and Usage guide.
  • Generate and store a configuration file with your service account's credentials as stated in this documentation inside the packages/backend/serviceAccountKey.json file.
  • Rename the .firebaserc production project alias with your Firebase project name.

Navigate to backend package by running

cd packages/backend

Copy the .default.env file as .env:

cp .env.default .env

And add your environment variables.

📜 Usage

Authorization

Login using your Google Account to Firebase CLI running

yarn firebase:login

Run the following to logout

yarn firebase:logout

Initialization

Initialize a new Firebase project interactively

yarn firebase:init

Deployment

AWS Infrastructure

  1. Login or create a new AWS Account.
    • The AWS free tier account will cover a good number of requests for ceremonies but there could be some costs based on your ceremony circuits size.
  2. Create an access key for a user with Admin privileges (NOT ROOT USER)
  3. Setup the awscli (docs) and add the keys for this user.
  4. Install terraform (docs)
  5. Decide on an AWS region (by default this is us-east-1) - if you want to change you will need to do the following:
    1. update aws/lambda/index.mjs (exact line) to the new region
    2. update main.tf (exact line) to the new region
  6. zip the Lambda folder:
    1. cd lambda
    2. zip -r ../lambda.zip .
  7. Run terraform:
    1. terraform init
    2. terraform plan
    3. terraform apply
    4. terraform output secret_key
      • To print the secret access key for the IAM user
    5. Store the other values (sns_topic_arn etc.)
      • These will be needed for the .env file configuration

The IAM user created with the steps above can be used for all p0tion's features.

Firebase

Deploy the current configuration to the prod project running

yarn firebase:deploy

To deploy only the latest Cloud Functions run

yarn firebase:deploy-functions

To deploy only the latest Firestore configuration and rules run

yarn firebase:deploy-firestore

Local Emulator

Firebase provides a Local Emulator Suite as a set of advanced dev-tools w/ a rich user-interface to build and test apps locally using Firebase services as Cloud Functions, Firestore and Authentication.

Prerequisites

  • You will need Java JDK version 11 or higher to run the Firebase Local Emulator.

To start the Emulator run

yarn emulator:serve

To emulate only Cloud Functions service run

yarn emulator:serve-functions

To run the Emulator shell in a new command line window run

yarn emulator:shell

To run tests (e2e/unit) locally in the Emulator run

yarn test:emulator

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.0.0-e3128900latest

Version History

VersionDownloads (Last 7 Days)Published
0.0.0-e3128900
0.0.0-e22d20d0
0.0.0-92392071
0.0.0-a7b749e1
0.0.0-bbc217a1
0.0.0-5fad82d1
0.0.0-004e6ad1
0.0.0-98438911
0.0.0-2cb74181
0.0.0-671e6531
0.0.0-c1f4cbe1
0.0.0-67a46291
0.0.0-2e5a17d1
0.0.0-57a8ab91
0.0.0-0fb27d71
0.0.0-56ecf351
0.0.0-142ec0a1
0.0.0-521e6781
0.0.0-b499eaf1
0.0.0-a9e4cd41
0.0.0-f11504f1
0.0.0-c749be48
0.0.0-23198231
0.0.0-09f6b451
0.0.0-8bb94891
0.0.0-3df16451
0.0.0-2ed8e181
0.0.0-7cfaa5d1
0.0.0-f7df5e11
0.0.0-3c7b0921
0.0.0-40886791
0.0.0-f3ea0561
0.0.0-8b5a17f1
0.0.0-36caea11
0.0.0-4f2b2be1
0.0.0-56491a81
0.0.0-92056fa1
0.0.0-9614e0c1
0.0.0-101d43f1
0.0.0-71405961
0.0.0-9c50f661
0.0.0-4e5bca41
0.0.0-eb3bb7d1
0.0.0-f784f3a1
0.0.0-ed314b81
0.0.0-bfc9ee41
0.0.0-5d170d31
0.0.0-0fd43681
0.0.0-270e9e02
0.0.0-7e983e31

Package Sidebar

Install

npm i @devtion/backend

Weekly Downloads

50

Version

0.0.0-e312890

License

MIT

Unpacked Size

704 kB

Total Files

50

Last publish

Collaborators

  • nicoserranop
  • glamperd
  • gurrpi