pub fn new<C: Signing>(
        secp: &Secp256k1<C>,
        min_value: u64,
        commitment: PedersenCommitment,
        value: u64,
        commitment_blinding: Tweak,
        message: &[u8],
        additional_commitment: &[u8],
        sk: SecretKey,
        exp: i32,
        min_bits: u8,
        additional_generator: Generator,
    ) -> Result<RangeProof, Error> {
        let mut proof = [0u8; RANGEPROOF_MAX_LENGTH];
        let mut proof_length = RANGEPROOF_MAX_LENGTH;

        let ret = unsafe {
            ffi::secp256k1_rangeproof_sign(
                *secp.ctx(),
                proof.as_mut_ptr(),
                &mut proof_length,
                min_value,
                commitment.as_inner(),
                commitment_blinding.as_ptr(),
                sk.as_ptr(),
                exp,
                min_bits as i32,
                value,
                message.as_ptr(),
                message.len(),
                additional_commitment.as_ptr(),
                additional_commitment.len(),
                additional_generator.as_inner(),
            )
        };

        if ret == 0 {
            return Err(Error::CannotMakeRangeProof);
        }

        Ok(RangeProof {
            inner: ffi::RangeProof::new(&proof[..proof_length]),
        })
    }
/// Prove that `commitment` hides a value within a range, with the lower bound set to `min_value`.
Prove that `commitment` hides a value within a range, with the lower bound set to `min_value`.
Prove that ` commitment ` hides a value within a range with the lower bound set to ` min_value ` .
pub fn new<C: Signing>(
        secp: &Secp256k1<C>,
        min_value: u64,
        commitment: PedersenCommitment,
        value: u64,
        commitment_blinding: Tweak,
        message: &[u8],
        additional_commitment: &[u8],
        sk: SecretKey,
        exp: i32,
        min_bits: u8,
        additional_generator: Generator,
    ) -> Result<RangeProof, Error> {
        let mut proof = [0u8; RANGEPROOF_MAX_LENGTH];
        let mut proof_length = RANGEPROOF_MAX_LENGTH;
        let ret = unsafe {
            ffi::secp256k1_rangeproof_sign(
                *secp.ctx(),
                proof.as_mut_ptr(),
                &mut proof_length,
                min_value,
                commitment.as_inner(),
                commitment_blinding.as_ptr(),
                sk.as_ptr(),
                exp,
                min_bits as i32,
                value,
                message.as_ptr(),
                message.len(),
                additional_commitment.as_ptr(),
                additional_commitment.len(),
                additional_generator.as_inner(),
            )
        };
        if ret == 0 {
            return Err(Error::CannotMakeRangeProof);
        }
        Ok(RangeProof {
            inner: ffi::RangeProof::new(&proof[..proof_length]),
        })
    }
pub fn new < C : Signing > ( secp : & Secp256k1 < C > , min_value : u64 , commitment : PedersenCommitment , value : u64 , commitment_blinding : Tweak , message : & [ u8 ] , additional_commitment : & [ u8 ] , sk : SecretKey , exp : i32 , min_bits : u8 , additional_generator : Generator , ) -> Result < RangeProof , Error > { let mut proof = [ 0u8 ; RANGEPROOF_MAX_LENGTH ] ; let mut proof_length = RANGEPROOF_MAX_LENGTH ; let ret = unsafe { ffi :: secp256k1_rangeproof_sign ( * secp . ctx ( ) , proof . as_mut_ptr ( ) , & mut proof_length , min_value , commitment . as_inner ( ) , commitment_blinding . as_ptr ( ) , sk . as_ptr ( ) , exp , min_bits as i32 , value , message . as_ptr ( ) , message . len ( ) , additional_commitment . as_ptr ( ) , additional_commitment . len ( ) , additional_generator . as_inner ( ) , ) } ; if ret == 0 { return Err ( Error :: CannotMakeRangeProof ) ; } Ok ( RangeProof { inner : ffi :: RangeProof :: new ( & proof [ .. proof_length ] ) , } ) }
Prove that `commitment` hides a value within a range, with the lower bound set to `min_value`.
Prove that ` commitment ` hides a value within a range with the lower bound set to ` min_value ` .
secp
&Secp256k1<C>
min_value
u64
commitment
PedersenCommitment
value
u64
commitment_blinding
Tweak
message
&[u8]
additional_commitment
&[u8]
sk
SecretKey
exp
i32
min_bits
u8
additional_generator
Generator
secp
&Secp256k1<C>
min_value
u64
commitment
PedersenCommitment
value
u64
commitment_blinding
Tweak
message
&[u8]
additional_commitment
&[u8]
sk
SecretKey
exp
i32
min_bits
u8
additional_generator
Generator