sismo-core / hydra-s2-zkps

Hydra-S2 ZK Proving scheme circuits, used for zkConnect

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool


Logo

Hydra-S2 ZKPS

Hydra-S2 Zero-Knowledge Proving Scheme

Made by Sismo

Hydra-S2 is an upgrade of the Hydra-S1 Zero-Knowledge Proving Scheme. The major update concerns the addition of the notion of a vault Identifier (vaultId) used in zkConnect.

Additionally, while Hydra-S1 only generates ZK Proofs from a Merkle tree storing groups of accounts with values (e.g group of ENS DAO voters where the account value is the number of votes), Hydra-S2 has a more modular approach. It is possible to only verify specific elements such as the Proof of Ownerships, the vaultId or only the inclusion of a specific account in a group for example.

Therefore, Hydra-S2 enables users to generate ZK proofs for the following statements:

  • Ownerships (optional): They own two accounts, a source account and a destination account. (the two are optional, it is possible to only verify the ownership of a single account, or neither of the two)
  • Account inclusion (optional): Their source account is part of a group (we can choose to not check the Merkle proof)
  • Account value (optional): Their source account holds a specific value
  • Vault Identifier Generation (optional): The vaultIdentifier is generated deterministically from the vault secret and vaultNamespace (an appId), and can be stored by apps to identify the owner of a specific vault for a specific application.
  • Proof Identifier Generation (optional): The proofIdentifier is generated deterministically from the source account and a requestIdentifier. Proof verifiers can store it to ensure that only one ZK proof per account per requestIdentifier is accepted. A request identifier is deterministically generated from an appId, a groupId, a groupTimestamp and a namespace.

You can see additional details in the Hydra-S2 documentation.

Circuits and Package

Hydra-S2 Proving Scheme was developed using circom and snarkjs. This repo contains the circuits.

It outputs an off-chain prover and verifiers (both on-chain and off-chain).

Theses implementations of prover and verifiers are in the @sismo-core/hydra-s2 npm package.

$ yarn add @sismo-core/hydra-s2

Installation

  • Install Circom2 (rust version)
  • Build
$ yarn build

Test

$ yarn test 
$ test:circuits
$ test:verifier-js
$ test:verifier-contract
$ test:prover-js

License

Distributed under the MIT License.

Contribute

Please, feel free to open issues, PRs or simply provide feedback!

Contact

Prefer Discord or Twitter


bottom

About

Hydra-S2 ZK Proving scheme circuits, used for zkConnect

License:MIT License


Languages

Language:TypeScript 69.6%Language:Solidity 14.7%Language:Circom 11.2%Language:Shell 3.0%Language:JavaScript 1.5%