Awesome
<p align="center"> <h1 align="center"> <picture> <source media="(prefers-color-scheme: light)" srcset="https://github.com/privacy-scaling-explorations/zk-kit/assets/11427903/f691c48c-021f-485d-89ef-9ddc8ba74787"> <source media="(prefers-color-scheme: dark)" srcset="https://github.com/privacy-scaling-explorations/zk-kit/assets/11427903/f43f4403-846a-48b4-a1fa-0ab234c225e5"> <img width="250" alt="ZK-Kit logo" src="https://github.com/privacy-scaling-explorations/zk-kit/assets/11427903/f691c48c-021f-485d-89ef-9ddc8ba74787"> </picture> <sub>Solidity</sub> </h1> </p> <p align="center"> <a href="https://github.com/privacy-scaling-explorations" target="_blank"> <img src="https://img.shields.io/badge/project-PSE-blue.svg?style=flat-square"> </a> <a href="https://github.com/privacy-scaling-explorations/zk-kit.solidity/blob/main/LICENSE"> <img alt="Github license" src="https://img.shields.io/github/license/privacy-scaling-explorations/zk-kit.solidity.svg?style=flat-square"> </a> <a href="https://github.com/privacy-scaling-explorations/zk-kit.solidity/actions?query=workflow%3Amain"> <img alt="GitHub Main Workflow" src="https://img.shields.io/github/actions/workflow/status/privacy-scaling-explorations/zk-kit.solidity/main.yml?branch=main&label=main&style=flat-square&logo=github"> </a> <a href="https://coveralls.io/github/privacy-scaling-explorations/zk-kit.solidity"> <img alt="Coveralls" src="https://img.shields.io/coveralls/github/privacy-scaling-explorations/zk-kit.solidity?label=coverage (sol)&style=flat-square&logo=coveralls"> </a> <a href="https://prettier.io/"> <img alt="Code style prettier" src="https://img.shields.io/badge/code%20style-prettier-f8bc45?style=flat-square&logo=prettier"> </a> <a href="http://commitizen.github.io/cz-cli/"> <img alt="Commitizen friendly" src="https://img.shields.io/badge/commitizen-friendly-586D76?style=flat-square"> </a> </p> <div align="center"> <h4> <a href="/CONTRIBUTING.md"> 👥 Contributing </a> <span> | </span> <a href="/CODE_OF_CONDUCT.md"> 🤝 Code of conduct </a> <span> | </span> <a href="https://github.com/privacy-scaling-explorations/zk-kit.solidity/issues/new/choose"> 🔎 Issues </a> <span> | </span> <a href="https://appliedzkp.org/discord"> 🗣️ Chat & Support </a> </h4> </div>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 Solidity code only. |
---|
🗂️ Repositories
- Javascript: https://github.com/privacy-scaling-explorations/zk-kit
- Solidity: https://github.com/privacy-scaling-explorations/zk-kit.solidity
- Circom: https://github.com/privacy-scaling-explorations/zk-kit.circom
- Noir: https://github.com/privacy-scaling-explorations/zk-kit.noir
📦 Packages
<table> <th>Package</th> <th>Version</th> <th>Downloads</th> <th>Audited</th> <tbody> <tr> <td> <a href="https://github.com/privacy-scaling-explorations/zk-kit.solidity/tree/main/packages/imt"> @zk-kit/imt.sol </a> </td> <td> <!-- NPM version --> <a href="https://npmjs.org/package/@zk-kit/imt.sol"> <img src="https://img.shields.io/npm/v/@zk-kit/imt.sol.svg?style=flat-square" alt="NPM version" /> </a> </td> <td> <!-- Downloads --> <a href="https://npmjs.org/package/@zk-kit/imt.sol"> <img src="https://img.shields.io/npm/dm/@zk-kit/imt.sol.svg?style=flat-square" alt="Downloads" /> </a> </td> <td> ❌ </td> </tr> <tr> <td> <a href="https://github.com/privacy-scaling-explorations/zk-kit.solidity/tree/main/packages/lean-imt"> @zk-kit/lean-imt.sol </a> </td> <td> <!-- NPM version --> <a href="https://npmjs.org/package/@zk-kit/lean-imt.sol"> <img src="https://img.shields.io/npm/v/@zk-kit/lean-imt.sol.svg?style=flat-square" alt="NPM version" /> </a> </td> <td> <!-- Downloads --> <a href="https://npmjs.org/package/@zk-kit/lean-imt.sol"> <img src="https://img.shields.io/npm/dm/@zk-kit/lean-imt.sol.svg?style=flat-square" alt="Downloads" /> </a> </td> <td> <a href="https://semaphore.pse.dev/Semaphore_4.0.0_Audit.pdf"> ✔️ </a> </td> </tr> <tr> <td> <a href="https://github.com/privacy-scaling-explorations/zk-kit.solidity/tree/main/packages/lazy-imt"> @zk-kit/lazy-imt.sol </a> </td> <td> <!-- NPM version --> <a href="https://npmjs.org/package/@zk-kit/lazy-imt.sol"> <img src="https://img.shields.io/npm/v/@zk-kit/lazy-imt.sol.svg?style=flat-square" alt="NPM version" /> </a> </td> <td> <!-- Downloads --> <a href="https://npmjs.org/package/@zk-kit/lazy-imt.sol"> <img src="https://img.shields.io/npm/dm/@zk-kit/lazy-imt.sol.svg?style=flat-square" alt="Downloads" /> </a> </td> <td> ❌ </td> </tr> <tr> <td> <a href="https://github.com/privacy-scaling-explorations/zk-kit.solidity/tree/main/packages/excubiae"> @zk-kit/excubiae </a> </td> <td> <!-- NPM version --> <a href="https://npmjs.org/package/@zk-kit/excubiae"> <img src="https://img.shields.io/npm/v/@zk-kit/excubiae.svg?style=flat-square" alt="NPM version" /> </a> </td> <td> <!-- Downloads --> <a href="https://npmjs.org/package/@zk-kit/excubiae"> <img src="https://img.shields.io/npm/dm/@zk-kit/excubiae.svg?style=flat-square" alt="Downloads" /> </a> </td> <td> ❌ </td> </tr> <tbody> </table>👥 Ways to contribute
- 🔧 Work on open issues
- 📦 Suggest new packages
- 🚀 Share ideas for new features
- 🐛 Create a report if you find any bugs in the code
🛠 Install
Clone this repository:
git clone https://github.com/privacy-scaling-explorations/zk-kit.solidity.git
and install the dependencies:
cd zk-kit.solidity && yarn
📜 Usage
Code formatting
Run Prettier to check formatting rules:
yarn format
or to automatically format the code:
yarn format:write
Linting
yarn lint
Will lint all the packages with solhint
Static Analysis
yarn slither
Will perform a static analysis of all the contracts with slither
to identify potential vulnerabilities.
You'll need to install slither beforehand.
Conventional commits
ZK-Kit uses conventional commits. A command line utility to commit using the correct syntax can be used by running:
yarn commit
It will also automatically check that the modified files comply with ESLint and Prettier rules.
Testing
Test the code:
yarn test
Build
Compile all contracts:
yarn compile
Releases
- Bump a new version of the package with:
yarn version:bump <package-name> <version>
# e.g. yarn version:bump imt.sol 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 imt.sol-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.