pub struct Address {
pub payload: Payload,
pub network: Network,
}Expand description
A Bitcoin address
Fields§
§payload: PayloadThe type of the address
network: NetworkThe network on which this address is usable
Implementations§
Source§impl Address
impl Address
Sourcepub fn p2pkh(pk: &PublicKey, network: Network) -> Address
pub fn p2pkh(pk: &PublicKey, network: Network) -> Address
Creates a pay to (compressed) public key hash address from a public key This is the preferred non-witness type address
Sourcepub fn p2sh(script: &Script, network: Network) -> Address
pub fn p2sh(script: &Script, network: Network) -> Address
Creates a pay to script hash P2SH address from a script This address type was introduced with BIP16 and is the popular type to implement multi-sig these days.
Sourcepub fn cp2pkh(
color_id: &ColorIdentifier,
pk: &PublicKey,
network: Network,
) -> Address
pub fn cp2pkh( color_id: &ColorIdentifier, pk: &PublicKey, network: Network, ) -> Address
Creates a pay to (compressed) public key hash address from a public key This is the preferred non-witness type address
Sourcepub fn cp2sh(
color_id: &ColorIdentifier,
script: &Script,
network: Network,
) -> Address
pub fn cp2sh( color_id: &ColorIdentifier, script: &Script, network: Network, ) -> Address
Creates a pay to script hash P2SH address from a script This address type was introduced with BIP16 and is the popular type to implement multi-sig these days.
Sourcepub fn address_type(&self) -> Option<AddressType>
pub fn address_type(&self) -> Option<AddressType>
Get the address type of the address. None if unknown or non-standard.
Sourcepub fn is_standard(&self) -> bool
pub fn is_standard(&self) -> bool
Check whether or not the address is following Bitcoin standardness rules.
Segwit addresses with unassigned witness versions or non-standard program sizes are considered non-standard.
Sourcepub fn from_script(script: &Script, network: Network) -> Option<Address>
pub fn from_script(script: &Script, network: Network) -> Option<Address>
Get an Address from an output script (scriptPubkey).
Sourcepub fn script_pubkey(&self) -> Script
pub fn script_pubkey(&self) -> Script
Generates a script pubkey spending to this address