SwapClaim Descriptions

Each swap claim contains a SwapClaimBody and a zk-SNARK swap claim proof.

SwapClaim zk-SNARK Statements

The swap claim proof demonstrates the properties enumerated below for the private witnesses known by the prover:

  • Swap plaintext corresponding to the swap being claimed. This consists of:
    • Trading pair, which consists of two asset IDs
    • Fee value which consists of an amount interpreted as an and an asset ID
    • Input amount of the first asset interpreted as an
    • Input amount of the second asset interpreted as an
    • Rseed, interpreted as an
    • Diversified basepoint corresponding to the claim address
    • Transmission key corresponding to the claim address
    • Clue key corresponding to the claim address
  • Swap commitment
  • Merkle proof of inclusion for the swap commitment, consisting of a position pos and an authentication path consisting of 72 elements (3 siblings each per 24 levels)
  • Nullifier deriving key
  • Output amount of the first asset interpreted as an
  • Output amount of the second asset interpreted as an
  • Note blinding factor used to blind the first output note commitment
  • Note blinding factor used to blind the second output note commitment

And the corresponding public inputs:

  • Merkle anchor of the state commitment tree
  • Nullifier corresponding to the swap
  • Fee to claim the outputs which consists of an amount interpreted as an and an asset ID
  • The batch swap output data, which consists of:
    • trading pair, which consists of two asset IDs
    • 128-bit fixed point values (represented in circuit as four 64-bit (Boolean constraint) limbs) for the batched inputs , outputs , and the unfilled quantities
    • block height
    • starting height of the epoch
  • Note commitment of the first output note
  • Note commitment of the second output note

Swap Commitment Integrity

The zk-SNARK certifies that the witnessed swap commitment was derived as:

.

using the above witnessed values and where ds is a constant domain separator:

ds = from_le_bytes(BLAKE2b-512(b"penumbra.swap")) mod q

Merkle auth path verification

The zk-SNARK certifies that the witnessed Merkle authentication path is a valid Merkle path of the swap commitment to the provided public anchor.

Nullifier Integrity

The zk-SNARK certifies that the nullifier was derived as:

using the witnessed values above and where ds is a constant domain separator:

ds = from_le_bytes(BLAKE2b-512(b"penumbra.nullifier")) mod q

as described in Nullifiers.

Fee Consistency Check

The zk-SNARK certifies that the public claim fee is equal to the value witnessed as part of the swap plaintext.

Height Consistency Check

The zk-SNARK certifies that the swap commitment’s height is equal to the height of the batch swap output data (the clearing price height).

We compute the intra-epoch block height from the position of the swap commitment and check the following identity:

where are provided on the batch swap output data as a public input.

Trading Pair Consistency Check

The zk-SNARK certifies that the trading pair included in the swap plaintext corresponds to the trading pair included on the batch swap output data, i.e.:

Output amounts integrity

The zk-SNARK certifies that the claimed output amounts were computed correctly following the pro-rata output calculation performed using the correct batch swap output data.

Output Note Commitment Integrity

The zk-SNARK certifies that the note commitments and were derived as:

using the above witnessed values and where ds is a constant domain separator:

ds = from_le_bytes(BLAKE2b-512(b"penumbra.notecommit")) mod q