Module sv::address [−][src]
Expand description
Address encoding and decoding
Examples
Extract the public key hash and address type from a base-58 address:
use sv::address::addr_decode;
use sv::network::Network;
let addr = "15wpV72HRpAFPMmosR3jvGq7axU7t6ghX5";
let (pubkeyhash, addr_type) = addr_decode(&addr, Network::Mainnet).unwrap();
Encode a public key hash into a base-58 address:
use sv::address::{addr_encode, AddressType};
use sv::network::Network;
use sv::util::hash160;
let pubkeyhash = hash160(&[0; 33]);
let addr = addr_encode(&pubkeyhash, AddressType::P2PKH, Network::Mainnet);
Enums
Address type which is either P2PKH or P2SH
Functions
Decodes a base-58 address to a public key hash
Converts a public key hash to its base-58 address