-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: setup `lefthook` (#137) chore: setup lefthook Manages git hooks. Replacement for a typical husky+lint-staged setup Used for formatting, lint check and typecheck * chore: shorten and sort imports * chore: add node:fs/promises to external deps * chore: update changeset config * changeset * docs: update READMEs * chore: bump lockfile * revert changes in tsconfig.build.json * fix: update default and types exports * chore: add baseUrl to tsconfig.build * refactor: reuse `banner` to define `bannerCli`
- Loading branch information
Showing
40 changed files
with
3,973 additions
and
3,533 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,9 @@ | ||
{ | ||
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json", | ||
"changelog": ["@changesets/changelog-github", { "repo": "privacy-scaling-explorations/snark-artifacts" }], | ||
"commit": false, | ||
"fixed": [], | ||
"linked": [], | ||
"access": "public", | ||
"baseBranch": "main", | ||
"updateInternalDependencies": "patch", | ||
"ignore": [] | ||
"bumpVersionsWithWorkspaceProtocolOnly": true, | ||
"changelog": ["@changesets/changelog-github", { "repo": "privacy-scaling-explorations/snark-artifacts" }], | ||
"commit": false, | ||
"updateInternalDependencies": "patch" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@zk-kit/artifacts": major | ||
--- | ||
|
||
Move CLI into `@zk-kit/artifacts` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,9 @@ | |
🗄️ SNARK Artifacts | ||
</h1> | ||
<p align="center">A streamlined mechanism for distributing SNARK artifacts.</p> | ||
<p align="center"> | ||
<a href="https://snark-artifacts.pse.dev"><b>snark-artifacts.pse.dev</b></p></a> | ||
</p> | ||
</p> | ||
|
||
| [P0tion](https://github.com/privacy-scaling-explorations/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). | | ||
|
@@ -135,20 +138,20 @@ Interested in contributing to this project? See the [board](https://github.com/o | |
</tr> | ||
<tr> | ||
<td> | ||
<a href="https://github.com/privacy-scaling-explorations/snark-artifacts/tree/main/packages/cli"> | ||
@zk-kit/artifacts-cli | ||
<a href="https://github.com/privacy-scaling-explorations/snark-artifacts/tree/main/packages/artifacts"> | ||
@zk-kit/artifacts | ||
</a> | ||
</td> | ||
<td> | ||
<!-- NPM version --> | ||
<a href="https://npmjs.org/package/@zk-kit/artifacts-cli"> | ||
<img src="https://img.shields.io/npm/v/@zk-kit/artifacts-cli.svg?style=flat-square" alt="NPM version" /> | ||
<a href="https://npmjs.org/package/@zk-kit/artifacts"> | ||
<img src="https://img.shields.io/npm/v/@zk-kit/artifacts.svg?style=flat-square" alt="NPM version" /> | ||
</a> | ||
</td> | ||
<td> | ||
<!-- Downloads --> | ||
<a href="https://npmjs.org/package/@zk-kit/artifacts-cli"> | ||
<img src="https://img.shields.io/npm/dm/@zk-kit/artifacts-cli.svg?style=flat-square" alt="Downloads" /> | ||
<a href="https://npmjs.org/package/@zk-kit/artifacts"> | ||
<img src="https://img.shields.io/npm/dm/@zk-kit/artifacts.svg?style=flat-square" alt="Downloads" /> | ||
</a> | ||
</td> | ||
<td> | ||
|
@@ -167,10 +170,9 @@ Interested in contributing to this project? See the [board](https://github.com/o | |
- ❌ **File integrity**: A system that guarantees the integrity of the artifacts. | ||
- ❌ **Automated Distribution**: A system that automatically distributes artifacts after the ceremony (possibly through [P0tion](https://github.com/privacy-scaling-explorations/p0tion)). | ||
|
||
## 📜 Getting Started | ||
|
||
To add a new set of artifacts for your project, simply add your NPM package to the [`packages`](https://github.com/privacy-scaling-explorations/snark-artifacts/tree/main/packages) folder. The packages are published on NPM and made available on your preferred CDN (e.g. https://unpkg.com). | ||
## 📜 Develop | ||
|
||
To add a new set of artifacts for your project, simply add your NPM package to the [`packages`](https://github.com/privacy-scaling-explorations/snark-artifacts/tree/main/packages) folder.\ | ||
You can also create [issue](https://github.com/privacy-scaling-explorations/snark-artifacts/issues/new/choose) and let the core contributors add your files. | ||
|
||
### Partial clone | ||
|
@@ -201,28 +203,13 @@ After the first time clone, you can use the following npm scripts: | |
|
||
### [Contribute](./CONTRIBUTING.md) | ||
|
||
### Downloading artifacts | ||
|
||
ZK-Kit provides a set of functions to automatically download your artifacts. For example: | ||
|
||
```ts | ||
import { maybeGetSnarkArtifacts, Project } from '@zk-kit/artifacts' | ||
## Downloading artifacts | ||
|
||
// It will return the artifacts' paths. | ||
const { wasm, zkey } = await maybeGetSnarkArtifacts(Project.POSEIDON, { | ||
parameters: [2], | ||
version: '1.0.0', | ||
}) | ||
You can download all artifacts either: | ||
|
||
console.log(wasm) // "/tmp/@zk-kit/[email protected]/poseidon-2.wasm" | ||
console.log(zkey) // "/tmp/@zk-kit/[email protected]/poseidon-2.zkey" | ||
|
||
// Paths on browsers will be the `unpkg` URLs directly. | ||
// e.g. https://unpkg.com/@zk-kit/[email protected]/poseidon-2.zkey | ||
``` | ||
|
||
You can download all artifacts from this repository with: | ||
|
||
```bash | ||
bash <(curl -sSL https://raw.githubusercontent.com/privacy-scaling-explorations/snark-artifacts/main/scripts/bin/dowload-artifacts.bash) -h | ||
``` | ||
- directly from this repository with: | ||
```bash | ||
bash <(curl -sSL https://raw.githubusercontent.com/privacy-scaling-explorations/snark-artifacts/main/scripts/bin/dowload-artifacts.bash) -h | ||
``` | ||
- with functions exported in [`@zk-kit/artifacts`](./packages/artifacts/README.md#downloading-artifacts) | ||
- with the [`snarkli` CLI](./packages/artifacts/README.md#cli) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,42 @@ | ||
TODO | ||
<p align="center"> | ||
<h1 align="center"> | ||
@zk-kit/artifacts | ||
</h1> | ||
</p> | ||
<p align="center"> | ||
<a href="https://npmjs.org/package/@zk-kit/artifacts"> | ||
<img src="https://img.shields.io/npm/v/@zk-kit/artifacts.svg?style=flat-square" alt="NPM version" /> | ||
</a> | ||
<a href="https://npmjs.org/package/@zk-kit/artifacts"> | ||
<img src="https://img.shields.io/npm/dm/@zk-kit/artifacts.svg?style=flat-square" alt="Downloads" /> | ||
</a> | ||
</p> | ||
|
||
## Downloading artifacts | ||
|
||
`@zk-kit/artifacts` provides a set of functions to automatically download your artifacts. For example: | ||
|
||
```ts | ||
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/[email protected]/poseidon-2.wasm" | ||
console.log(zkey) // "/tmp/@zk-kit/[email protected]/poseidon-2.zkey" | ||
|
||
// Paths on browsers will be the `unpkg` URLs directly. | ||
// e.g. https://unpkg.com/@zk-kit/[email protected]/poseidon-2.zkey | ||
``` | ||
|
||
## CLI | ||
|
||
Or you can install our `snarkli` CLI to download artifacts, list available packages or generate artifacts (`.zkey`, `.wasm`) from `.circom` source files. | ||
|
||
```commandline | ||
pnpm add -g @zk-kit/artifacts | ||
snarkli | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
7 changes: 4 additions & 3 deletions
7
packages/cli/src/commands/download/index.ts → ...ifacts/src/cli/commands/download/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...ages/cli/src/commands/download/prompts.ts → ...acts/src/cli/commands/download/prompts.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...cli/src/commands/generate-batch/action.ts → ...src/cli/commands/generate-batch/action.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
6 changes: 3 additions & 3 deletions
6
packages/cli/src/commands/generate/action.ts → ...facts/src/cli/commands/generate/action.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/cli/src/commands/generate/index.ts → ...ifacts/src/cli/commands/generate/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ages/cli/src/commands/generate/prompts.ts → ...acts/src/cli/commands/generate/prompts.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { download } from './download' | ||
import { generate } from './generate' | ||
import { generateBatch } from './generate-batch' | ||
import { list } from './list' | ||
|
||
export default [download, generate, generateBatch, list] |
4 changes: 2 additions & 2 deletions
4
packages/cli/src/commands/list.ts → packages/artifacts/src/cli/commands/list.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
packages/cli/src/validators.ts → packages/artifacts/src/cli/validators.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export * from './index.shared' | ||
import maybeGetSnarkArtifacts from './download/index.browser' | ||
export * from 'index.shared' | ||
import maybeGetSnarkArtifacts from 'download/index.browser' | ||
export { maybeGetSnarkArtifacts } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
export { download, maybeDownload } from './download/download' | ||
export * from './index.shared' | ||
import maybeGetSnarkArtifacts from './download/index.node' | ||
export { download, maybeDownload } from 'download/download' | ||
export * from 'index.shared' | ||
import maybeGetSnarkArtifacts from 'download/index.node' | ||
export { maybeGetSnarkArtifacts } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
export * from './download/types' | ||
export * from './projects' | ||
export * from 'download/types' | ||
export { Project, projects } from 'projects' |
Oops, something went wrong.