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.
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
- Install Circom2 (rust version)
- Build
$ yarn build
$ yarn test
$ test:circuits
$ test:verifier-js
$ test:verifier-contract
$ test:prover-js
Distributed under the MIT License.
Please, feel free to open issues, PRs or simply provide feedback!