Struct XOnlyPubKey

Source
pub struct XOnlyPubKey { /* private fields */ }
Expand description

Implementations§

Source§

impl XOnlyPubKey

Source

pub fn is_null(&self) -> bool

| Test whether this is the 0 key (the result | of default construction). This implies | !IsFullyValid(). |

Source

pub fn data(&self) -> *const u8

Source

pub fn size() -> usize

Source

pub fn begin(&self) -> *const u8

Source

pub fn end(&self) -> *const u8

Source

pub fn begin_mut(&mut self) -> *mut u8

Source

pub fn end_mut(&mut self) -> *mut u8

Source

pub fn get_key_ids(&self) -> Vec<KeyID>

| Returns a list of CKeyIDs for the CPubKeys | that could have been used to create this | | XOnlyPubKey. | | This is needed for key lookups since | keys are indexed by CKeyID. |

Source

pub fn is_fully_valid(&self) -> bool

| Determine if this pubkey is fully valid. | This is true for approximately 50% of | all possible 32-byte arrays. If false, | | VerifySchnorr and CreatePayToContract | will always fail. |

Source

pub fn verify_schnorr(&self, msg: &u256, sigbytes: &[u8]) -> bool

| Verify a Schnorr signature against | this public key. sigbytes must be exactly | 64 bytes. |

Source

pub fn compute_tap_tweak_hash(&self, merkle_root: *const u256) -> u256

| Compute the Taproot tweak as specified | in BIP341, with *this as internal key: | | - if merkle_root == nullptr: H_TapTweak(xonly_pubkey) | | - otherwise: H_TapTweak(xonly_pubkey || *merkle_root) | | ———– | @note | | the behavior of this function with merkle_root | != nullptr is consensus critical. |

Source

pub fn check_tap_tweak( &self, internal: &XOnlyPubKey, merkle_root: &u256, parity: bool, ) -> bool

| Verify that this is a Taproot tweaked | output point, against a specified internal | key, | | Merkle root, and parity. |

Source

pub fn create_tap_tweak( &self, merkle_root: *const u256, ) -> Option<(XOnlyPubKey, bool)>

| Construct a Taproot tweaked output | point with this point as internal key. |

Trait Implementations§

Source§

impl Default for XOnlyPubKey

Source§

fn default() -> XOnlyPubKey

Returns the “default value” for a type. Read more
Source§

impl From<&[u8]> for XOnlyPubKey

Source§

fn from(bytes: &[u8]) -> Self

| Construct an x-only pubkey from exactly | 32 bytes. |

Source§

impl From<&PubKey> for XOnlyPubKey

Source§

fn from(pubkey: &PubKey) -> Self

| Construct an x-only pubkey from a normal | pubkey. |

Source§

impl Index<i32> for XOnlyPubKey

Source§

type Output = u8

The returned type after indexing.
Source§

fn index(&self, pos: i32) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl Ord for XOnlyPubKey

Source§

fn cmp(&self, other: &XOnlyPubKey) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for XOnlyPubKey

Source§

fn eq(&self, other: &XOnlyPubKey) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for XOnlyPubKey

Source§

fn partial_cmp(&self, other: &XOnlyPubKey) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Eq for XOnlyPubKey

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T, U> CastInto<U> for T
where U: CastFrom<T>,

Source§

unsafe fn cast_into(self) -> U

Performs the conversion. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> StaticUpcast<T> for T

Source§

unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>

Convert type of a const pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V