@zk-kit/circuits

1.0.0-beta • Public • Published

ZK-kit circuits

A comprehensive library of general-purpose zero-knowledge circuits.

NPM license NPM version Downloads

This package offers a collection of reusable circuits designed for integration into other projects or protocols, promoting code modularization within the zero-knowledge ecosystem.

[!IMPORTANT]
Installation of Circom and Nargo required for circuit tests.

Circuits

  • Circom:
    • PoseidonProof: proves the possession of Poseidon pre-images without revealing the pre-images themselves.
    • BinaryMerkleRoot: calculates the root of a binary Merkle tree using a provided proof-of-membership.
    • EddsaProof: proves the possession of a private key of an identity commitment without revealing the private key itself.
    • PoseidonDecrypt: decrypts a ciphertext using Poseidon hash function, considering an initial nonce and a key, and adjusts output length to a multiple of 3.
    • PoseidonDecryptWithoutCheck: decrypts a ciphertext using the Poseidon hash without validating the last ciphertext element or ensuring the last elements equal 0.
    • PoseidonDecryptIterations: decrypts a ciphertext in iterations, adjusting for a 3-element block size and validating nonce size, while revealing intermediate decryption states.
    • PoseidonPerm: performs Poseidon permutation on a given number of inputs, revealing all intermediate values and using specified rounds and constants for the operation.
  • Noir:
    • Sparse Merkle Tree PoseidonBN254: A reusable library of functions related to Sparse Merkle Trees based on the JS implementation of @zk-kit/smt. The library uses the Poseidon hash to implement the following functions:
      • verifying membership and non-membership proofs
      • adding a new entry to a SMT
      • updating an entry of an SMT
      • deleting an existing entry from an SMT

🛠 Install

Using NPM or Yarn (Circom circuits)

Install the @zk-kit/circuits package with npm:

npm i @zk-kit/circuits --save

or yarn:

yarn add @zk-kit/circuits

Using Nargo (Noir circuits)

In your Nargo.toml file, add the following dependency:

[dependencies]
smt_bn254 = { tag = "v0.1.0", git = "https://github.com/privacy-scaling-explorations/zk-kit/packages/circuits/noir", directory="crates/smt_bn254" }

Readme

Keywords

none

Package Sidebar

Install

npm i @zk-kit/circuits

Weekly Downloads

1,249

Version

1.0.0-beta

License

MIT

Unpacked Size

924 kB

Total Files

12

Last publish

Collaborators

  • sripwoud
  • njofce
  • akinovak
  • cedoor