Implementation Details
Transparent assets to anonymous assets (AR-to-ABAR)
A zero-knowledge proof is generated, as follows, to provide that the anonymous assets are correct.
- We assume that the verifier has already checked that .
Instance:
- AR amount
- AR asset code
- the commitment of ABAR
Witness:
- the blinding factor in the commitment
- the public key of the recipient
Statement:
- Check .
Anonymous assets to transparent assets (ABAR-to-AR)
We assume that the verifier has already checked that .
Instance:
- the nullifier
- the Merkle tree root
- AR amount
- AR asset code
- transaction body hash
- non-malleability tag
Witness:
- the blinding factor in the commitment
- the secret key of the owner
- Merkle tree path
- non-malleability randomizer
Statement:
- Let the reconstructed public key be , where is the generator for the signature scheme.
- Let the reconstructed commitment be .
- Observe the Merkle tree path and deduce the unique ID .
- Check that is in the tree with root , given the Merkle tree path , with the unique ID .
- Check .
- Check .
Confidential assets to anonymous assets (BAR-to-ABAR)
Note that its verification contains a zk-SNARK part and a non-zk-SNARK part. We first describe the zk-SNARK part, as follows.
Instance:
- the commitment of ABAR
- the commitment of the secrets in BAR
- the non-zk-SNARK part responses , , , and , where and
Witness:
- the secrets in BAR, , , , and
- the randomizer used in commitment
- the blinding factor in the commitment
- the public key of the recipient
Statement:
- Check that is a commitment of .
- Check that .
- Check in field simulation.
The non-zk-SNARK part, which interacts with the Ristretto point that encodes the amount and the one that encodes the asset type , the randomizers and , and the responses , , , and .
The non-zk-SNARK part works as follows.
- Initialize a cryptographic sponge with group description.
- Put into the sponge.
- Put the commitment of ABAR into the sponge.
- Put the commitment of the secrets in BAR into the sponge.
- Put into the sponge.
- Squeeze a random challenge, which should be equal to , from the sponge.
- Put into the sponge.
- Squeeze a random challenge, which should be equal to , from the sponge.
- Check .
- Check .
Anonymous assets to confidential assets (ABAR-to-BAR)
Similar to the BAR-to-ABAR protocol, it consists of a zk-SNARK part and a non-zk-SNARK part. We first describe the zk-SNARK part, as follows.
Instance:
- the nullifier of ABAR
- the Merkle tree root
- the commitment of the secrets in BAR
- the non-zk-SNARK part responses , , , and where and
- transaction body hash
- non-malleability tag
Witness:
- the secrets in BAR, , , , and
- the randomizer used in commitment
- the blinding factor in the commitment
- the secret key of the owner
- Merkle tree path
- non-malleability randomizer
Statement:
- Let the reconstructed public key be where is the generator for the signature scheme.
- Let the reconstructed commitment be .
- Observe the Merkle tree path and deduce the unique ID .
- Check that is in the tree with root , given the Merkle tree path , with the unique ID .
- Check that is a commitment of .
- Check in field simulation.
- Check .
- Check .
The non-zk-SNARK part, which interacts with the Ristretto point that encodes the amount and the one that encodes the asset type , the randomizers and , and the responses , , , and .
The non-zk-SNARK part works as follows.
- Initialize a cryptographic sponge with group description.
- Put into the sponge.
- Put the nullifier into the sponge.
- Put the commitment of the secrets in BAR into the sponge.
- Put into the sponge.
- Squeeze a random challenge, which should be equal to , from the sponge.
- Put into the sponge.
- Squeeze a random challenge, which should be equal to , from the sponge.
- Check .
- Check .
Anonymous transfer
We now define the statement for different combinations of the number of inputs and outputs. Consider that we have ABAR inputs and ABAR outputs.
Instance:
- nullifiers
- the Merkle tree root
- ABAR commitments
- the fee
- transaction body hash
- non-malleability tag
Witness:
- the blinding factors in the input commitments
- the blinding factors in the output commitments
- the amounts in the input commitments
- the asset types in the input commitments
- the amounts in the output commitments
- the asset types in the output commitments
- the secret keys of the input commitments' owners
- the Merkle tree paths for all the input commitments
- the public keys of the output commitments' recipients
- non-malleability randomizer
Statement:
- Let the reconstructed public keys be where is the generator for the signature scheme, for .
- Let the reconstructed input commitments be , for .
- Let the reconstructed output commitments be , for .
- Observe the Merkle tree path and deduce its corresponding unique ID , for .
- Check that is in the tree with root , given the Merkle tree path , with the unique ID , for .
- Check .
- Check if is a correct mixing of after paying the fee over the asset for transaction fees.
- Check amounts of the output commitments are within bit, for .
- Construct an array .
- Pad this array with so that its length for some nonnegative integer .
- .
- For : .
- Check .
Asset mixing gadget
The asset mixing gadget is defined for different combinations of the number of inputs and outputs, and is hardcoded with the asset type used to pay for transaction fees.
Gadget input:
- input pairs of amount and asset type:
- output pairs of amount and asset type:
- The fee
Statement:
Compute the sum for each input. For :
- , where if and otherwise.
Compute the sum for each output. For :
- , where if and otherwise.
Require at least one of the is the fee type.
For each accumulated input pair for :
For each accumulated output pair for :
- If is not the fee type, require .
- Else, if is the fee type, require
If is not the fee type, then there must exist some such that .
If is the fee type, and if there is no such that , then we require .
Require that all the output asset types appear among the input asset types. For each output asset type , , require .