pub fn calculate_script_hash(
address: &str,
network: Option<Network>,
) -> Result<String, DerivationError>
Expand description
Calculates a script hash for a given Bitcoin address and network type.
The script hash is calculated by taking the SHA256 hash of the scriptPubKey and then reversing the byte order, as required by the Electrum protocol.
§Arguments
address
- A Bitcoin address stringnetwork
- Optional network type. Default is Network::Bitcoin.
§Returns
Result<String, DerivationError>
- The script hash as a hex string or an error
§Errors
DerivationError::BitcoinError
- If the address cannot be parsed or network validation fails