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)

  1. Crafting the Note:

    1. Generate two random values, nullifier and secret

    2. Calculate the commitment (Pedersen Hash of (nullifier + secret))

    3. 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.

  2. Generating the proof (done locally):

    1. Get current state from contract (past deposits)

    2. Assemble merkle tree (locally) from past deposits

    3. Sanity checks (corrupted Merkle tree, spent note, non-existent, etc.)

    4. Generate SNARK proof:

      1. Public Inputs

        1. Root

        2. Nullifier (hash)

        3. Recipient (address)

        4. Relayer (address)

        5. Fee

        6. Refund

      2. Private Inputs

        1. Nullifier

        2. Secret

        3. Path indices (location in Merkle Tree)

    5. Output is the Proof

Last updated