Bip43

Enum Bip43 

Source
#[non_exhaustive]
pub enum Bip43 { Bip44, Bip84, Bip49, Bip86, Bip45, Bip48Nested, Bip48Native, Bip87, Bip43 { purpose: HardenedIndex, }, }
Expand description

Specific derivation scheme after BIP-43 standards

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Bip44

Account-based P2PKH derivation.

m / 44' / coin_type' / account'

§

Bip84

Account-based native P2WPKH derivation.

m / 84' / coin_type' / account'

§

Bip49

Account-based legacy P2WPH-in-P2SH derivation.

m / 49' / coin_type' / account'

§

Bip86

Account-based single-key P2TR derivation.

m / 86' / coin_type' / account'

§

Bip45

Cosigner-index-based multisig derivation.

`m / 45’ / cosigner_index

§

Bip48Nested

Account-based multisig derivation with sorted keys & P2WSH nested. scripts

m / 48' / coin_type' / account' / 1'

§

Bip48Native

Account-based multisig derivation with sorted keys & P2WSH native. scripts

m / 48' / coin_type' / account' / 2'

§

Bip87

Account- & descriptor-based derivation for multi-sig wallets.

m / 87' / coin_type' / account'

§

Bip43

Generic BIP43 derivation with custom (non-standard) purpose value.

m / purpose'

Fields

§purpose: HardenedIndex

Purpose value

Implementations§

Source§

impl Bip43

Source

pub const PKH: Bip43 = Bip43::Bip44

Constructs derivation standard corresponding to a single-sig P2PKH.

Source

pub const WPKH_SH: Bip43 = Bip43::Bip49

Constructs derivation standard corresponding to a single-sig P2WPKH-in-P2SH.

Source

pub const WPKH: Bip43 = Bip43::Bip84

Constructs derivation standard corresponding to a single-sig P2WPKH.

Source

pub const TR_SINGLE: Bip43 = Bip43::Bip86

Constructs derivation standard corresponding to a single-sig P2TR.

Source

pub const MULTI_SH_SORTED: Bip43 = Bip43::Bip45

Constructs derivation standard corresponding to a multi-sig P2SH BIP45.

Source

pub const MULTI_WSH_SH: Bip43 = Bip43::Bip48Nested

Constructs derivation standard corresponding to a multi-sig sorted P2WSH-in-P2SH.

Source

pub const MULTI_WSH: Bip43 = Bip43::Bip48Native

Constructs derivation standard corresponding to a multi-sig sorted P2WSH.

Source

pub const DESCRIPTOR: Bip43 = Bip43::Bip87

Constructs derivation standard corresponding to a multi-sig BIP87.

Trait Implementations§

Source§

impl Clone for Bip43

Source§

fn clone(&self) -> Bip43

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Bip43

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl DerivationStandard for Bip43

Source§

fn deduce(derivation: &DerivationPath) -> Option<Bip43>

Deduces derivation standard used by the provided derivation path, if possible.
Source§

fn purpose(&self) -> Option<HardenedIndex>

Get hardened index matching BIP-43 purpose value, if any.
Source§

fn account_depth(&self) -> Option<u8>

Depth of the account extended public key according to the given standard. Read more
Source§

fn coin_type_depth(&self) -> Option<u8>

Depth of the derivation path defining coin_type key, i.e. the used blockchain. Read more
Source§

fn is_account_last_hardened(&self) -> Option<bool>

Returns information whether the account xpub in this standard is the last hardened derivation path step, or there might be more hardened steps (like script_type in BIP-48). Read more
Source§

fn is_testnet( &self, path: &DerivationPath, ) -> Result<bool, Option<DerivationIndex>>

Checks which bitcoin network corresponds to a given derivation path according to the used standard requirements.
Source§

fn account_template_string(&self, testnet: bool) -> String

Returns string representation of the template derivation path for an account-level keys. Account key is represented by * wildcard fragment.
Source§

fn to_origin_derivation(&self, testnet: bool) -> DerivationPath<HardenedIndex>

Construct derivation path for the account xpub.
Source§

fn to_account_derivation( &self, account_index: HardenedIndex, testnet: bool, ) -> DerivationPath<HardenedIndex>

Construct derivation path up to the provided account index segment.
Source§

fn to_key_derivation( &self, account_index: HardenedIndex, testnet: bool, keychain: NormalIndex, index: NormalIndex, ) -> DerivationPath

Construct full derivation path including address index and case (main, change etc).
Source§

fn extract_coin_type( &self, path: &DerivationPath, ) -> Result<HardenedIndex, Option<NormalIndex>>

Extracts hardened index from a derivation path position defining coin type information (used blockchain), if present. Read more
Source§

fn extract_account_index( &self, path: &DerivationPath, ) -> Result<HardenedIndex, Option<NormalIndex>>

Extracts hardened index from a derivation path position defining account number, if present. Read more
Source§

impl Display for Bip43

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl FromStr for Bip43

Source§

type Err = ParseBip43Error

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl Hash for Bip43

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Bip43

Source§

fn eq(&self, other: &Bip43) -> 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 Copy for Bip43

Source§

impl Eq for Bip43

Source§

impl StructuralPartialEq for Bip43

Auto Trait Implementations§

§

impl Freeze for Bip43

§

impl RefUnwindSafe for Bip43

§

impl Send for Bip43

§

impl Sync for Bip43

§

impl Unpin for Bip43

§

impl UnwindSafe for Bip43

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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

Checks if this value is equivalent to the given key. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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<T> VerifyEq for T
where T: Eq,

Source§

fn verify_eq(&self, other: &T) -> bool

Verifies commit-equivalence of two instances of the same type.