logo
Expand description

Descriptor policy

This module implements the logic to extract and represent the spending policies of a descriptor in a more human-readable format.

This is an EXPERIMENTAL feature, API and other major changes are expected.

Example

use bdk::descriptor::policy::BuildSatisfaction;
let secp = Secp256k1::new();
let desc = "wsh(and_v(v:pk(cV3oCth6zxZ1UVsHLnGothsWNsaoxRhC6aeNi5VbSdFpwUkgkEci),or_d(pk(cVMTy7uebJgvFaSBwcgvwk8qn8xSLc97dKow4MBetjrrahZoimm2),older(12960))))";

let (extended_desc, key_map) = ExtendedDescriptor::parse_descriptor(&secp, desc)?;
println!("{:?}", extended_desc);

let signers = Arc::new(key_map.into());
let policy = extended_desc.extract_policy(&signers, BuildSatisfaction::None, &secp)?;
println!("policy: {}", serde_json::to_string(&policy)?);

Structs

An extra condition that must be satisfied but that is out of control of the user

Raw public key or extended key fingerprint

Descriptor spending policy

Enums

Options to build the satisfaction field in the policy

Errors that can happen while extracting and manipulating policies

Represent if and how much a policy item is satisfied by the wallet’s descriptor

An item that needs to be satisfied

Type Definitions

Type for a map of sets of Condition items keyed by each set’s index

Type for a map of folded sets of Condition items keyed by a vector of the combined set’s indexes