sismo-core / hydra-s3-zkps

Hydra-S3 ZK Proving scheme circuits, used for Sismo Connect

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool


Logo

Hydra-S3 ZKPS

Hydra-S3 Zero-Knowledge Proving Scheme

Made by Sismo

Hydra-S3 is an upgrade of the Hydra-S2 Zero-Knowledge Proving Scheme. The major update introduces the possibility of using a Vault account both as a source and a destination. Using a Vault account as a source allows for proving its inclusion in a group, while using it as a destination allows for demonstrating ownership. This capability is achieved by switching the account ownership verification method based on the account type. If the account is a Hydra account, we verify the ownership by validating the commitmentReceipt. On the other hand, if it's a Vault account, proving its ownership entails reconstructing the vaultIdentifier using the formula: vaultIdentifier = poseidon(vaultSecret, namespace).

Therefore, Hydra-S3 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-S3 documentation.

Circuits and Package

Hydra-S3 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-s3 npm package.

$ yarn add @sismo-core/hydra-s3

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-S3 ZK Proving scheme circuits, used for Sismo Connect

License:MIT License


Languages

Language:TypeScript 77.1%Language:Circom 10.7%Language:Solidity 8.9%Language:Shell 2.2%Language:JavaScript 1.1%