HashMinCommitment

The HashMinCommitment circuit is designed for generating hashed commitments and ensuring a certain amount is greater than or equal to a specified minimum amount.

Input Signals

This circuit accepts the following input signals:

  1. amount: This represents the amount under consideration.

  2. minAmount: The minimum amount threshold.

  3. oracle_owner: Identifier for the owner of the oracle.

  4. oracle_key: Key for data retrieval in the oracle.

  5. oracle_value: The associated value with the oracle_key.

  6. unlock_sender: Identifier for the sender in the unlock operation.

  7. unlock_receiver: Identifier for the receiver in the unlock operation.

signal input amount;
signal input minAmount;
signal input oracle_owner;
signal input oracle_key;
signal input oracle_value;
signal input unlock_sender;
signal input unlock_receiver;

Output Signals

This circuit outputs the following signals:

  1. amountHash: Hash of the input amount.

  2. minAmountHash: Hash of the minimum amount.

  3. idHash: A complex hash, generated from all the input signals.

Components

The circuit has several components:

  • comp1: A comparator that checks if the amount is greater than or equal to the minAmount.

  • hashAmount: A Poseidon hash function to hash the amount.

  • hashMinAmount: A Poseidon hash function to hash the minAmount.

  • hashId: A Poseidon hash function to hash all input signals to generate the idHash.

Inclusion of External Circuits

The circuit includes poseidon and comparators circuits from the circomlib library.

Main Component

The main component of this circuit file is the HashMinCommitment template.

The HashMinCommitment circuit is used primarily for creating hashed commitments for amounts while enforcing that the amount is greater than or equal to the minimum threshold. The hashed outputs can be used for comparison and verification processes in other parts of your application.

Last updated