HashReceiver
The HashReceiver
circuit is intended for handling and validating the transfer of amounts to a receiver. It creates hashed versions of the amount transferred and the balance of the receiver before and after the transfer.
Input Signals
The circuit takes the following inputs:
amount: The amount to be transferred to the receiver.
receiverBalanceBeforeTransfer: The receiver's balance before the transfer occurs.
Output Signals
The circuit outputs the following signals:
receiverBalanceBeforeTransferHash: The hash of the receiver's balance before the transfer occurs.
receiverBalanceAfterTransferHash: The hash of the receiver's balance after the transfer has occurred.
amountHash: The hash of the amount that is transferred.
Components
The circuit utilizes the following components:
comp1: A comparator to ensure that the
amount
is greater than or equal to zero.
hashAmount: A
Poseidon
hashing function to create a hash of theamount
.
hashBeforeBalance: A
Poseidon
hashing function to create a hash of the receiver's balance before the transfer.
hashAfterBalance: A
Poseidon
hashing function to create a hash of the receiver's balance after the transfer.
External Circuit Inclusions
The circuit includes poseidon
and comparators
circuits from the circomlib
library.
Main Component
The main component of this circuit file is the HashReceiver
template.
The HashReceiver
circuit is used primarily for creating hashed versions of the amount being transferred and the receiver's balance before and after the transfer. This can be used for transaction verification and integrity checks within your application.
Last updated