pub struct Address {
pub address_string: String,
pub public_key_hash: [u8; 20],
pub network: Network,
}Expand description
A Bitcoin P2PKH address.
Contains the 20-byte public key hash and the network it belongs to. Can be serialized to/from the Base58Check string format.
Fields§
§address_string: StringThe human-readable Base58Check address string.
public_key_hash: [u8; 20]The 20-byte RIPEMD-160(SHA-256(pubkey)) hash.
network: NetworkThe network this address belongs to.
Implementations§
Source§impl Address
impl Address
Sourcepub fn from_string(addr: &str) -> Result<Self, ScriptError>
pub fn from_string(addr: &str) -> Result<Self, ScriptError>
Sourcepub fn from_public_key_hash(hash: &[u8; 20], network: Network) -> Self
pub fn from_public_key_hash(hash: &[u8; 20], network: Network) -> Self
Sourcepub fn from_public_key_string(
pub_key_hex: &str,
mainnet: bool,
) -> Result<Self, ScriptError>
pub fn from_public_key_string( pub_key_hex: &str, mainnet: bool, ) -> Result<Self, ScriptError>
Trait Implementations§
impl Eq for Address
impl StructuralPartialEq for Address
Auto Trait Implementations§
impl Freeze for Address
impl RefUnwindSafe for Address
impl Send for Address
impl Sync for Address
impl Unpin for Address
impl UnsafeUnpin for Address
impl UnwindSafe for Address
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