You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/descriptor/derived.rs
+46-9Lines changed: 46 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,41 @@
10
10
// licenses.
11
11
12
12
//! Derived descriptor keys
13
+
//!
14
+
//! The [`DerivedDescriptorKey`] type is a wrapper over the standard [`DescriptorPublicKey`] which
15
+
//! guarantees that all the extended keys have a fixed derivation path, i.e. all the wildcards have
16
+
//! been replaced by actual derivation indexes.
17
+
//!
18
+
//! The [`AsDerived`] trait provides a quick way to derive descriptors to obtain a
19
+
//! `Descriptor<DerivedDescriptorKey>` type. This, in turn, can be used to derive public
20
+
//! keys for arbitrary derivation indexes.
21
+
//!
22
+
//! Combining this with [`Wallet::get_signers`], secret keys can also be derived.
23
+
//!
24
+
//! # Example
25
+
//!
26
+
//! ```
27
+
//! # use std::str::FromStr;
28
+
//! # use bitcoin::secp256k1::Secp256k1;
29
+
//! use bdk::descriptor::{AsDerived, DescriptorPublicKey};
30
+
//! use bdk::miniscript::{ToPublicKey, TranslatePk, MiniscriptKey};
31
+
//!
32
+
//! let secp = Secp256k1::gen_new();
33
+
//!
34
+
//! let key = DescriptorPublicKey::from_str("[aa600a45/84'/0'/0']tpubDCbDXFKoLTQp44wQuC12JgSn5g9CWGjZdpBHeTqyypZ4VvgYjTJmK9CkyR5bFvG9f4PutvwmvpYCLkFx2rpx25hiMs4sUgxJveW8ZzSAVAc/0/*")?;
35
+
//! let (descriptor, _, _) = bdk::descriptor!(wpkh(key))?;
0 commit comments