pub struct TaprootManager { /* private fields */ }Expand description
Taproot address manager
Manages Taproot addresses and transactions (BIP 341/342).
§Examples
use kaccy_bitcoin::{TaprootManager, TaprootConfig};
use bitcoin::Network;
let config = TaprootConfig {
network: Network::Testnet,
enable_script_path: true,
max_tree_depth: 128,
};
let manager = TaprootManager::new(config);
// Generate a Taproot key pair
let keypair = manager.generate_keypair()?;
// Create a key-path address (most private and efficient)
let address = manager.create_key_path_address(keypair.internal_key)?;
println!("Taproot address: {}", address.address);Implementations§
Source§impl TaprootManager
impl TaprootManager
Sourcepub fn new(config: TaprootConfig) -> Self
pub fn new(config: TaprootConfig) -> Self
Create a new Taproot manager
Sourcepub fn generate_keypair(&self) -> Result<TaprootKeyPair>
pub fn generate_keypair(&self) -> Result<TaprootKeyPair>
Generate a new Taproot key pair
Sourcepub fn create_key_path_address(
&self,
internal_key: XOnlyPublicKey,
) -> Result<TaprootAddress>
pub fn create_key_path_address( &self, internal_key: XOnlyPublicKey, ) -> Result<TaprootAddress>
Create a Taproot address from an internal key (key-path only)
Sourcepub fn create_script_path_address(
&self,
internal_key: XOnlyPublicKey,
scripts: Vec<ScriptBuf>,
) -> Result<TaprootAddress>
pub fn create_script_path_address( &self, internal_key: XOnlyPublicKey, scripts: Vec<ScriptBuf>, ) -> Result<TaprootAddress>
Create a Taproot address with script tree
Sourcepub fn validate_address(&self, address: &str) -> Result<bool>
pub fn validate_address(&self, address: &str) -> Result<bool>
Validate a Taproot address
Sourcepub fn is_taproot_address(&self, address: &Address) -> bool
pub fn is_taproot_address(&self, address: &Address) -> bool
Check if an address is a Taproot address
Sourcepub fn extract_internal_key(&self, address: &Address) -> Result<XOnlyPublicKey>
pub fn extract_internal_key(&self, address: &Address) -> Result<XOnlyPublicKey>
Extract internal key from address
Auto Trait Implementations§
impl Freeze for TaprootManager
impl RefUnwindSafe for TaprootManager
impl Send for TaprootManager
impl Sync for TaprootManager
impl Unpin for TaprootManager
impl UnwindSafe for TaprootManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more