HashSender
The HashSender
circuit is designed to process and validate transfers from a sender, creating hashed versions of the amount transferred, the balance of the sender before and after the transfer, a nonce for transaction uniqueness, and a combined identifier hash.
Input Signals
The circuit accepts the following inputs:
sender: The sender of the transaction.
senderBalanceBeforeTransfer: The balance of the sender before the transaction.
amount: The amount to be transferred.
nonce: A unique identifier for each transaction.
Output Signals
The circuit outputs the following signals:
senderBalanceBeforeTransferHash: The hash of the sender's balance before the transfer occurs.
senderBalanceAfterTransferHash: The hash of the sender's balance after the transfer has occurred.
amountHash: The hash of the amount that is transferred.
nonceVerification: The nonce input passed straight through for verification.
idHash: The hash of a combination of sender, sender balance before transfer, amount, and nonce.
Components
The circuit incorporates the following components:
comp1: A comparator ensuring that the
amount
is greater than or equal to zero.
comp2: A comparator checking if the
senderBalanceBeforeTransfer
is greater than or equal to theamount
.
hashAmount: A
Poseidon
hashing function to create a hash of theamount
.
hashBeforeBalance: A
Poseidon
hashing function to create a hash of the sender's balance before the transfer.
hashAfterBalance: A
Poseidon
hashing function to create a hash of the sender's balance after the transfer.
hashId: A
Poseidon
hashing function to create a hash of a combination of sender, sender balance before transfer, amount, and nonce.
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 HashSender
template.
The HashSender
circuit is primarily used for hashing important aspects of a transaction from a sender, which includes the amount transferred, the sender's balance before and after the transfer, a nonce for each transaction, and a combined identifier hash. This allows for secure, reliable transaction verification and integrity checks within your application.
Last updated