pub fn new<C: Signing>(
        secp: &Secp256k1<C>,
        value: u64,
        blinding_factor: Tweak,
        generator: Generator,
    ) -> Self {
        let mut commitment = ffi::PedersenCommitment::default();

        let ret = unsafe {
            ffi::secp256k1_pedersen_commit(
                *secp.ctx(),
                &mut commitment,
                blinding_factor.as_ptr(),
                value,
                generator.as_inner(),
            )
        };
        assert_eq!(
            ret, 1,
            "failed to create pedersen commitment, likely a bad blinding factor"
        );

        PedersenCommitment(commitment)
    }
/// Create a new [`PedersenCommitment`] that commits to the given value with
/// a certain blinding factor and generator.
/// Use the [PedersenCommitment::new_unblinded] for creating a commitment
/// using zero blinding factor.
Create a new [`PedersenCommitment`] that commits to the given value with
a certain blinding factor and generator.
Use the [PedersenCommitment::new_unblinded] for creating a commitment
using zero blinding factor.
Create a new [ ` PedersenCommitment ` ] that commits to the given value with a certain blinding factor and generator . Use the [ PedersenCommitment :: new_unblinded ] for creating a commitment using zero blinding factor .
pub fn new<C: Signing>(
        secp: &Secp256k1<C>,
        value: u64,
        blinding_factor: Tweak,
        generator: Generator,
    ) -> Self {
        let mut commitment = ffi::PedersenCommitment::default();
        let ret = unsafe {
            ffi::secp256k1_pedersen_commit(
                *secp.ctx(),
                &mut commitment,
                blinding_factor.as_ptr(),
                value,
                generator.as_inner(),
            )
        };
        assert_eq!(
            ret, 1,
            "failed to create pedersen commitment, likely a bad blinding factor"
        );
        PedersenCommitment(commitment)
    }
pub fn new < C : Signing > ( secp : & Secp256k1 < C > , value : u64 , blinding_factor : Tweak , generator : Generator , ) -> Self { let mut commitment = ffi :: PedersenCommitment :: default ( ) ; let ret = unsafe { ffi :: secp256k1_pedersen_commit ( * secp . ctx ( ) , & mut commitment , blinding_factor . as_ptr ( ) , value , generator . as_inner ( ) , ) } ; assert_eq ! ( ret 1 " " ) ; PedersenCommitment ( commitment ) }
Create a new [`PedersenCommitment`] that commits to the given value with
a certain blinding factor and generator.
Create a new [ ` PedersenCommitment ` ] that commits to the given value with a certain blinding factor and generator .
secp
&Secp256k1<C>
value
u64
blinding_factor
Tweak
generator
Generator
secp
&Secp256k1<C>
value
u64
blinding_factor
Tweak
generator
Generator