ZK-Kit is a set of libraries (algorithms or utility functions) that can be reused in different projects and zero-knowledge protocols, making it easier for developers to access user-friendly, tested, and documented code for common tasks. ZK-Kit provides different repositories for each language - this one contains JavaScript code only.
โ Yarn workspaces: minimal monorepo package management (yarn, yarn build, yarn docs)
โ Conventional Commits: human and machine readable meaning to commit messages (yarn commit)
โ Jest: tests and test coverage for all libraries (yarn test:libraries)
โ ESLint, Prettier: code quality and formatting (yarn prettier & yarn lint)
โ Typedocs: documentation generator for TypeScript (yarn docs)
โ Benny: simple benchmarking framework for JavaScript/TypeScript (yarn benchmarks)
โ Github actions: software workflows for automatic testing, documentation deploy and code quality checks
yarn version:bump <package-name> <version># e.g. yarn version:bump utils 2.0.0
This step creates a commit and a git tag.
Push the changes to main:
git push origin main
Push the new git tag:
git push origin <package-name>-<version># e.g. git push origin utils-v2.0.0
After pushing the new git tag, a workflow will be triggered and will publish the package on npm and release a new version on Github with its changelogs automatically.
ZK-kit provides a set of pre-configured development tools. All you have to deal with is your own code, testing and documentation. To create a package follow these steps:
Fork this repository and clone it (or simply clone it directly if you are a collaborator),
Copy one of our current libraries and update the README.md and package.json files with your package name:
cd zk-kitcp -r packages/smt packages/my-packagecd packages/my-package && rm -fr node_modules distgrep -r -l "smt" . | xargs sed -i 's/smt/my-package/'# Update the remaining description/usage sections, and write your code in the src & tests folders!
You can see some examples in the benchmarks folder. All you have to do is create a file that exports a function to run your benchmark in that folder and add that function to the index.ts file. The yarn benchmarks command can be run with no parameters (it will run all the benchmarks), or you can specify the name of your benchmark file to run just that. When you run the command it will create a benchmarks/results folder with your results.