Skip to main content

Module sui::rangeproofs

Constants

const ENotSupported: u64 = 0;
const EInvalidProof: u64 = 1;
const EInvalidRange: u64 = 2;
const EInvalidBatchSize: u64 = 3;
const EUnsupportedVersion: u64 = 4;
const EInvalidDst: u64 = 5;
const MAX_DST_LENGTH: u64 = 64;

Function verify_bulletproofs_with_dst_ristretto255

Verify a range proof over the Ristretto255 curve that all committed values are in the range [0, 2^bits).
Currently, the only supported version is 0 which corresponds to the original Bulletproofs construction (https://eprint.iacr.org/2017/1066.pdf).
In the future, we may add support for newer versions of Bulletproofs, such as Bulletproofs+ or Bulletproofs++.

The format of the proof follows the specifications from https://github.com/dalek-cryptography/bulletproofs/blob/be67b6d5f5ad1c1f54d5511b52e6d645a1313d07/src/range_proof/mod.rs#L59-L76.

The bits parameter is the bit length of the range and must be one of 8, 16, 32, or 64.

The commitments are Pedersen commitments to the values used in the proof.
The number of commitments must be a power of two, but if needed, the input to the prover can be padded with trivial commitments to zero.
The number of commitments times bits can be at most 512.

The dst is a domain separation tag that is bound into the proof transcript. Provers and verifiers must agree on the same dst for verification to succeed. It can be at most 64 bytes.

Enabled only on devnet and testnet.

public fun verify_bulletproofs_with_dst_ristretto255(proof: &vector<u8>, bits: u8, commitments: &vector<sui::group_ops::Element<sui::ristretto255::G>>, dst: &vector<u8>, version: u8): bool

Function verify_bulletproofs_ristretto255

Disabled. This entry point always aborts; use verify_bulletproofs_with_dst_ristretto255 instead.

public fun verify_bulletproofs_ristretto255(_proof: &vector<u8>, _bits: u8, _commitments: &vector<sui::group_ops::Element<sui::ristretto255::G>>, _version: u8): bool

Function verify_bulletproofs_with_dst_ristretto255_internal

fun verify_bulletproofs_with_dst_ristretto255_internal(proof: &vector<u8>, bits: u8, commitments: &vector<vector<u8>>, dst: &vector<u8>): bool