privacy-scaling-explorations / snark-artifacts

A streamlined mechanism for distributing SNARK artifacts.
https://snark-artifacts.pse.dev
MIT License
4 stars 2 forks source link
artifacts distribution snark-artifacts

πŸ—„οΈ SNARK Artifacts

A streamlined mechanism for distributing SNARK artifacts.

P0tion has made conducting SNARK phase 2 trusted setup ceremonies easier for many zero-knowledge projects. However, there still seems to be no simple mechanism for distributing the artifacts generated in ceremonies. This project aims to build step-by-step a simple and easily accessible mechanism for distributing zero-knowledge artifacts (wasm/zkey files).

πŸ‘₯ Contributing   |   🀝 Code of conduct   |   πŸ”Ž Issues   |   πŸ—£οΈ Chat & Support

For more info here see: OVERVIEW.md.

Interested in contributing to this project? See the board and upcoming issues to work on or propose other ideas.

[!NOTE]\ This system is probably best suited to small and medium-sized circuits.

Artifacts

Package Version Downloads Circuits JS library
@zk-kit/poseidon-artifacts NPM version Downloads poseidon-proof.circom @zk-kit/poseidon-proof
@zk-kit/semaphore-artifacts NPM version Downloads semaphore.circom @semaphore-protocol/proof
@zk-kit/semaphore-identity-artifacts NPM version Downloads identity-proof.circom @semaphore-extensions/identity-proof

πŸš€ Features

πŸ“œ Getting Started

To add a new set of artifacts for your project, simply add your NPM package to the packages folder. The packages are published on NPM and made available on your preferred CDN (e.g. https://unpkg.com).

You can also create issue and let the core contributors add your files.

Partial clone

For a more manageable clone that includes only the packages relevant to you or none of them, we use git's sparse-checkout and --filter features. This will reduce clone time and improve git performance.

git clone --sparse --filter=blob:none <forkedUrl>

And finally, if you need a specific package:

git sparse-checkout add packages/<package>

For convenience we provide an interactive setup script.\ It will ask you where to clone the repository, and what packages you want to sparse checkout.

bash <(curl https://raw.githubusercontent.com/privacy-scaling-explorations/snark-artifacts/main/scripts/bin/setup.bash) fetch

After the first time clone, you can use the following npm scripts:

Contribute

Downloading artifacts

ZK-Kit provides a set of functions to automatically download your artifacts. For example:

import { maybeGetSnarkArtifacts, Project } from '@zk-kit/artifacts'

// It will return the artifacts' paths.
const { wasm, zkey } = await maybeGetSnarkArtifacts(Project.POSEIDON, {
  parameters: [2],
  version: '1.0.0',
})

console.log(wasm) // "/tmp/@zk-kit/poseidon-artifacts@1.0.0/poseidon-2.wasm"
console.log(zkey) // "/tmp/@zk-kit/poseidon-artifacts@1.0.0/poseidon-2.zkey"

// Paths on browsers will be the `unpkg` URLs directly.
// e.g. https://unpkg.com/@zk-kit/poseidon-artifacts@1.0.0/poseidon-2.zkey

You can download all artifacts from this repository with:

bash <(curl -sSL https://raw.githubusercontent.com/privacy-scaling-explorations/snark-artifacts/main/scripts/bin/dowload-artifacts.bash) -h