pub struct Address {
pub payload: Payload,
pub network: Network,
}
Expand description
A Bitcoin address
Fields§
§payload: Payload
The type of the address
network: Network
The 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
Trait Implementations§
source§impl Ord for Address
impl Ord for Address
source§impl PartialEq for Address
impl PartialEq for Address
source§impl PartialOrd for Address
impl PartialOrd for Address
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more