Struct secp256k1zkp::Secp256k1

source ·
pub struct Secp256k1 { /* private fields */ }
Expand description

The secp256k1 engine, used to execute all signature operations

Implementations

verify commitment

Creates a pedersen commitment from a value and a blinding factor

Convenience method to Create a pedersen commitment only from a value, with a zero blinding factor

Taking vectors of positive and negative commitments as well as an expected excess, verifies that it all sums to zero.

Computes the sum of multiple positive and negative pedersen commitments.

Computes the sum of multiple positive and negative blinding factors.

Convenience function for generating a random nonce for a range proof. We will need the nonce later if we want to rewind the range proof.

Produces a range proof for the provided value, using min and max bounds, relying on the blinding factor and commitment.

Verify a proof that a committed value is within a range.

Verify a range proof and rewind the proof to recover information sent by its author.

General information extracted from a range proof. Does not provide any information about the value or the message (see rewind).

Produces a bullet proof for the provided value, using min and max bounds, relying on the blinding factor and value. If a message is passed, it will be truncated or padded to exactly BULLET_PROOF_MSG_SIZE bytes

Produces a bullet proof for multi-party commitment

Verify with bullet proof that a committed value is positive

Verify with bullet proof that a committed value is positive

Rewind a bullet proof to get the value and Blinding factor back out

Creates a new Secp256k1 context

Creates a new Secp256k1 context with the specified capabilities

Creates a new Secp256k1 context with no capabilities (just de/serialization)

(Re)randomizes the Secp256k1 context for cheap sidechannel resistence; see comment in libsecp256k1 commit d2275795f by Gregory Maxwell

Generates a random keypair. Convenience function for key::SecretKey::new and key::PublicKey::from_secret_key; call those functions directly for batch key generation. Requires a signing-capable context.

Constructs a signature for msg using the secret key sk and RFC6979 nonce Requires a signing-capable context.

Constructs a signature for msg using the secret key sk and RFC6979 nonce Requires a signing-capable context.

Determines the public key for which sig is a valid signature for msg. Requires a verify-capable context.

Checks that sig is a valid ECDSA signature for msg using the public key pubkey. Returns Ok(true) on success. Note that this function cannot be used for Bitcoin consensus checking since there may exist signatures which OpenSSL would verify but not libsecp256k1, or vice-versa. Requires a verify-capable context.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Executes the destructor for this type. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.