npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@pcd/artifacts

v0.4.0

Published

A command line utility designed to manage PCD artifacts.

Downloads

57

Readme

| An essential command line tool created to simplify the retrieval and storage of artifacts, primarily focusing on zero-knowledge. It is meant for use across various PCD components and packages and can also be used to run simulated zero-knowledge ceremonies for testing purposes. External developers can use it to download the artifacts to be used in PCD packages (e.g. .wasm and .zkey files). | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

Artifacts reside in an R2 Cloudflare instance and are publicly accessible using the following URL format: https://artifacts.pcdpass.xyz/<package-name>/latest/<file-name> (e.g. https://artifacts.pcdpass.xyz/zk-eddsa-event-ticket-pcd/latest/circuit.json). There are currently 3 files for each package: circuit.wasm, circuit.zkey, circuit.json (i.e. zk verification key).

🛠 Install

Install the @pcd/artifacts CLI with npm:

npm i -g @pcd/artifacts

or run specific commands with npx:

npx @pcd/artifacts download

📜 Usage

The CLI currently includes four commands and is mainly used in zk PCD packages to generate .wasm, .zkey and .json (verification key) files with a dummy ceremony, to upload the same files that are supposed to be used in production, and to download them.

Usage: pcd-artifacts [options] [command]

A command line utility designed to manage PCD artifacts.

Options:
  -v, --version                     Show PCD artifacts CLI version.
  -h, --help                        display help for command

Commands:
  download [options] [pcd-package]  Download artifacts for 1 or all PCD supported packages.
  generate [options]                Generate zero-knowledge unsafe artifacts with a dummy trusted-setup (only for testing).
  list-packages                     List supported PCD packages containing artifacts for downloading.
  upload [options] [pcd-package]    Upload artifacts of a PCD package into an R2 instance.
  help [command]                    display help for command

The following is an example of how @pcd/zk-eddsa-event-ticket-pcd uses the CLI to handle artifacts in the package.json scripts:

{
  "scripts": {
    "artifacts:download": "pcd-artifacts download zk-eddsa-event-ticket-pcd",
    "artifacts:generate": "pcd-artifacts generate",
    "artifacts:upload": "pcd-artifacts upload zk-eddsa-event-ticket-pcd"
  }
}

The passport app (server and client) also downloads and place them in the public folder. The following is the script they use:

{
  "scripts": {
    "artifacts:download": "pcd-artifacts download -o public"
  }
}

Adding a new supported PCD package

If you are working on a PCD package that needs this CLI, simply add the name of the package to the list of supported packages, in the file packages/artifacts/src/config.js, and use the scripts as the example above.

Remember to ignore the folder containing the artifacts (i.e. packages/<your-package>/artifacts).

Each time you update the circuits, remember to upload the new artifacts.

Generate zero-knowledge artifacts for testing

PCD packages using Circom circuits and needing zero-knowledge artifacts to generate and verify proofs can make a dummy ceremony with the following command: pcd-artifacts generate. You can also specify the ptau power and the output directory. The command is supposed to be executed from the package directory, as it automatically detects the circuits folder which must contain an index.circom file as the entry point. The files will be saved in the ./artifacts folder by default.

If you don't have Circom installed, please see the official documentation and install a version > 2.0.0.

Usage: pcd-artifacts generate [options]

Generate zero-knowledge unsafe artifacts with a dummy trusted-setup (only for testing).

Options:
  -p, --ptau-power <power>  Power of two of the maximum number of constraints that the ceremony can accept.
  -o, --output <output>     Path to the directory where the output will be written [default: artifacts].
  -h, --help                display help for command

Upload artifacts on the R2 instance

Artifacts can be loaded onto the R2 instance with the command: pcd-artifacts upload <pcd-package>. The first time you use this command you will be asked for the access key and the secret. Please ask the PCD team if you can request them.

Usage: pcd-artifacts upload [options] [pcd-package]

Upload artifacts of a PCD package into an R2 instance.

Arguments:
  pcd-package                       Supported PCD package.

Options:
  -a, --artifacts <artifacts-path>  Path to the directory containing the artifacts [default: artifacts].
  -h, --help                        display help for command

Download artifacts from the R2 instance

Artifacts can be downloaded from the R2 instance with the command: pcd-artifacts download. If you want to download the artifacts of 1 specific package you can specify it by running pcd-artifacts download <pcd-package>. The files will be saved in the ./artifacts folder by default. This command can also be used by external developers.

Usage: pcd-artifacts download [options] [pcd-package]

Download artifacts for 1 or all PCD supported packages.

Arguments:
  pcd-package            Supported PCD package.

Options:
  -o, --output <output>  Path to the directory where the output will be written [default: artifacts].
  -h, --help             display help for command