pub struct XOnlyPublicKey { /* private fields */ }Expand description
32-byte x-only public key (BIP340)
Implementations§
Source§impl XOnlyPublicKey
impl XOnlyPublicKey
Sourcepub fn from_compressed(data: &[u8; 33]) -> Result<(Self, Parity), TaprootError>
pub fn from_compressed(data: &[u8; 33]) -> Result<(Self, Parity), TaprootError>
Create from a compressed public key (33 bytes)
Sourcepub fn from_slice(data: &[u8]) -> Result<Self, TaprootError>
pub fn from_slice(data: &[u8]) -> Result<Self, TaprootError>
Create from 32-byte x-only representation
Sourcepub fn from_bytes(data: [u8; 32]) -> Result<Self, TaprootError>
pub fn from_bytes(data: [u8; 32]) -> Result<Self, TaprootError>
Create from byte array
Sourcepub fn tweak_add(
&self,
secp: &Secp256k1<All>,
tweak: &[u8; 32],
) -> Result<(Self, Parity), TaprootError>
pub fn tweak_add( &self, secp: &Secp256k1<All>, tweak: &[u8; 32], ) -> Result<(Self, Parity), TaprootError>
Tweak the public key by adding a scalar
Sourcepub fn inner(&self) -> &Secp256k1XOnlyPublicKey
pub fn inner(&self) -> &Secp256k1XOnlyPublicKey
Get the inner secp256k1 x-only public key
Sourcepub fn from_inner(inner: Secp256k1XOnlyPublicKey) -> Self
pub fn from_inner(inner: Secp256k1XOnlyPublicKey) -> Self
Create from secp256k1 x-only public key
Sourcepub fn to_public_key(&self) -> PublicKey
pub fn to_public_key(&self) -> PublicKey
Convert to full public key with even y-coordinate
Trait Implementations§
Source§impl Clone for XOnlyPublicKey
impl Clone for XOnlyPublicKey
Source§fn clone(&self) -> XOnlyPublicKey
fn clone(&self) -> XOnlyPublicKey
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for XOnlyPublicKey
impl Debug for XOnlyPublicKey
Source§impl Display for XOnlyPublicKey
impl Display for XOnlyPublicKey
Source§impl FromStr for XOnlyPublicKey
impl FromStr for XOnlyPublicKey
Source§impl Hash for XOnlyPublicKey
impl Hash for XOnlyPublicKey
Source§impl PartialEq for XOnlyPublicKey
impl PartialEq for XOnlyPublicKey
impl Copy for XOnlyPublicKey
impl Eq for XOnlyPublicKey
impl StructuralPartialEq for XOnlyPublicKey
Auto Trait Implementations§
impl Freeze for XOnlyPublicKey
impl RefUnwindSafe for XOnlyPublicKey
impl Send for XOnlyPublicKey
impl Sync for XOnlyPublicKey
impl Unpin for XOnlyPublicKey
impl UnwindSafe for XOnlyPublicKey
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more