1. Receive Note
Before an asset is deposited into a Sacred pool, a unique Sacred Claim (secure note) in the form of a string of words and letters is generated. This claim is locally generated and only the depositor will have access to this Sacred Claim. The Claim is critical to withdraw the deposited assets and needs to be stored somewhere safe.
Code Summary - Generating the note - (ZK Proof)
Crafting the Note:
Generate two random values, nullifier and secret
Calculate the commitment (Pedersen Hash of (nullifier + secret))
Note contains:
Currency (from user input)
Amount (from user input)
Network (from user input)
Nullifier Secret
Only the commitment is sent to the contract when depositing. Note: the Secret value is never shared to the contract or any parties other than the user and their browser.
Generating the proof (done locally):
Get current state from contract (past deposits)
Assemble merkle tree (locally) from past deposits
Sanity checks (corrupted Merkle tree, spent note, non-existent, etc.)
Generate SNARK proof:
Public Inputs
Root
Nullifier (hash)
Recipient (address)
Relayer (address)
Fee
Refund
Private Inputs
Nullifier
Secret
Path indices (location in Merkle Tree)
Output is the Proof
Last updated