# Crate secp256k1_zkp

source ·## Expand description

## §Secp256k1-zkp

Rust bindings for libsecp256k1-zkp, a fork of Pieter Wuille’s secp256k1 library.

This library re-exports everything from `secp256k1`

and adds bindings for the following modules:

- generators
- range proofs
- pedersen commitments

As such, it can be used as a drop-in replacement for `secp256k1`

. All types are interoperable
(as long as you are dependening on the correct version) which means `SecretKey`

s and the `Context`

are interoperable.

## Re-exports§

`pub extern crate actual_rand as rand;`

`pub extern crate secp256k1_zkp_sys;`

`pub extern crate actual_serde as serde;`

`pub use secp256k1_zkp_sys as ffi;`

`pub use secp256k1::hashes;`

`hashes`

## Modules§

- Constants related to the API and the underlying curve.
- Support for shared secret computations.
- Structs and functionality related to the ECDSA signature algorithm.
- This module provides an implementation of ElligatorSwift as well as a version of x-only ECDH using it (including compatibility with BIP324).
- global
`global-context`

and`std`

Module implementing a singleton pattern for a global`Secp256k1`

context. - Rust hashes library.
- Utilities for random number generation
- Provides
`Scalar`

and related types. - Support for schnorr signatures.
- Serde

## Macros§

- Implement methods and traits for types that contain an inner array.

## Structs§

- Represents the set of all capabilities (preallocated memory).
- Represents all secret data involved in making a
`PedersenCommitment`

where one of the generators is blinded. - Represents an adaptor signature and dleq proof.
- Represents a generator on the secp256k1 curve.
- Error returned when conversion from an integer to
`Parity`

fails. - Opaque data structure that holds a keypair consisting of a secret and a public key.
- A (hashed) message input to an ECDSA signature.
- Opening
`std`

The result of rewinding a range proof. - Represents a commitment to a single u64 value.
- Public key - used to verify ECDSA signatures and to do Taproot tweaks.
- RangeProof
`std`

Represents a range proof. - Positive 256-bit integer guaranteed to be less than the secp256k1 curve order.
- The secp256k1 engine, used to execute all signature operations.
- Secret key - a 256-bit key used to create ECDSA and Taproot signatures.
- Represents the set of capabilities needed for signing (preallocated memory).
- Represents a surjection proof.
- Represents a tag.
- Represents a blinding factor/Tweak on secp256k1 curve
- Represents the set of capabilities needed for verification (preallocated memory).
- A whitelist ring signature.
- An x-only public key, used for verification of Taproot signatures and serialized according to BIP-340.

## Enums§

- Represents the set of all capabilities.
- An ECDSA error
- Represents the parity passed between FFI function calls.
- Represents the set of capabilities needed for signing.
- The main error type for this library.
- Represents the set of capabilities needed for verification.

## Constants§

- The zero Tweak

## Statics§

- A global static context to avoid repeatedly creating contexts.

## Traits§

- A trait for all kinds of contexts that lets you define the exact flags and a function to deallocate memory. It isn’t possible to implement this for types outside this crate.
- Trait marking that a particular context object internally points to memory that must outlive
`'a`

- Marker trait for indicating that an instance of
`Secp256k1`

can be used for signing. - ThirtyTwoByteHashDeprecatedTrait describing something that promises to be a 32-byte random number; in particular, it has negligible probability of being zero or overflowing the group order. Such objects may be converted to
`Message`

s without any error paths. - Marker trait for indicating that an instance of
`Secp256k1`

can be used for verification.

## Functions§

- Compute a blinding factor such that the sum of all blinding factors in both sets is equal.
- generate_keypair
`global-context`

and`rand`

Generates a random keypair using the global`SECP256K1`

context. - Verifies that the sum of the committed values within the commitments of both sets is equal.