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 SecretKeys 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;
Modules§
- constants
- Constants related to the API and the underlying curve.
- ecdh
- Support for shared secret computations.
- ecdsa
- Structs and functionality related to the ECDSA signature algorithm.
- ellswift
- This module provides an implementation of ElligatorSwift as well as a version of x-only ECDH using it (including compatibility with BIP324).
- global
- Module implementing a singleton pattern for a global
Secp256k1context. - hashes
Deprecated hashes - Deprecated reexport of the
bitcoin-hashescrate. - rand
- Utilities for random number generation
- scalar
- Provides
Scalarand related types. - schnorr
- Support for schnorr signatures.
- serde
- Serde
Macros§
- impl_
array_ newtype - Implement methods and traits for types that contain an inner array.
Structs§
- AllPreallocated
- Represents the set of all capabilities (preallocated memory).
- Commitment
Secrets std - Represents all secret data involved in making a
PedersenCommitmentwhere one of the generators is blinded. - Ecdsa
Adaptor Signature - Represents an adaptor signature and dleq proof.
- Generator
- Represents a generator on the secp256k1 curve.
- Invalid
Parity Value - Error returned when conversion from an integer to
Parityfails. - Keypair
- Opaque data structure that holds a keypair consisting of a secret and a public key.
- Message
- A (hashed) message input to an ECDSA signature.
- Opening
std - The result of rewinding a range proof.
- Pedersen
Commitment std - Represents a commitment to a single u64 value.
- Public
Key - Public key - used to verify ECDSA signatures and to do Taproot tweaks.
- Range
Proof std - Represents a range proof.
- Scalar
- Positive 256-bit integer guaranteed to be less than the secp256k1 curve order.
- Secp256k1
- The secp256k1 engine, used to execute all signature operations.
- Secret
Key - Secret key - a 256-bit key used to create ECDSA and Taproot signatures.
- Sign
Only Preallocated - Represents the set of capabilities needed for signing (preallocated memory).
- Surjection
Proof std - Represents a surjection proof.
- Tag
- Represents a tag.
- Tweak
- Represents a blinding factor/Tweak on secp256k1 curve
- Verify
Only Preallocated - Represents the set of capabilities needed for verification (preallocated memory).
- Whitelist
Signature - A whitelist ring signature.
- XOnly
Public Key - An x-only public key, used for verification of Taproot signatures and serialized according to BIP-340.
Enums§
- All
- Represents the set of all capabilities.
- Error
- An ECDSA error
- Parity
- Represents the parity passed between FFI function calls.
- Sign
Only - Represents the set of capabilities needed for signing.
- Upstream
Error - The main error type for this library.
- Verify
Only - Represents the set of capabilities needed for verification.
Constants§
- ZERO_
TWEAK - The zero Tweak
Statics§
- SECP256
K1 - A global static context to avoid repeatedly creating contexts.
Traits§
- Context
- 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.
- Preallocated
Context - Trait marking that a particular context object internally points to
memory that must outlive
'a - Signing
- Marker trait for indicating that an instance of
Secp256k1can be used for signing. - Thirty
TwoByte Hash Deprecated - Trait 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
Messages without any error paths. - Verification
- Marker trait for indicating that an instance of
Secp256k1can be used for verification.
Functions§
- compute_
adaptive_ blinding_ factor std - Compute a blinding factor such that the sum of all blinding factors in both sets is equal.
- generate_
keypair - Generates a random keypair using the global
SECP256K1context. - verify_
commitments_ sum_ to_ equal std - Verifies that the sum of the committed values within the commitments of both sets is equal.