Struct bdk::descriptor::template::Bip44Public[][src]

pub struct Bip44Public<K: DerivableKey<Legacy>>(pub K, pub Fingerprint, pub KeychainKind);
Expand description

BIP44 public template. Expands to pkh(key/{0,1}/*)

This assumes that the key used has already been derived with m/44'/0'/0'.

This template requires the parent fingerprint to populate correctly the metadata of PSBTs.

See Bip44 for a template that does the full derivation, but requires private data for the key.

Example

use bdk::template::Bip44Public;

let key = bitcoin::util::bip32::ExtendedPubKey::from_str("tpubDDDzQ31JkZB7VxUr9bjvBivDdqoFLrDPyLWtLapArAi51ftfmCb2DPxwLQzX65iNcXz1DGaVvyvo6JQ6rTU73r2gqdEo8uov9QKRb7nKCSU")?;
let fingerprint = bitcoin::util::bip32::Fingerprint::from_str("c55b303f")?;
let wallet = Wallet::new_offline(
    Bip44Public(key.clone(), fingerprint, KeychainKind::External),
    Some(Bip44Public(key, fingerprint, KeychainKind::Internal)),
    Network::Testnet,
    MemoryDatabase::default()
)?;

assert_eq!(wallet.get_address(New)?.to_string(), "miNG7dJTzJqNbFS19svRdTCisC65dsubtR");
assert_eq!(wallet.public_descriptor(KeychainKind::External)?.unwrap().to_string(), "pkh([c55b303f/44'/0'/0']tpubDDDzQ31JkZB7VxUr9bjvBivDdqoFLrDPyLWtLapArAi51ftfmCb2DPxwLQzX65iNcXz1DGaVvyvo6JQ6rTU73r2gqdEo8uov9QKRb7nKCSU/0/*)#xgaaevjx");

Trait Implementations

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Convert to wallet descriptor

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

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

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.