Trait crypto_addr::WIF

source ·
pub trait WIF {
    // Required method
    fn wif(&self, opts: WIFFormat) -> Result<String, Error>;
}
Expand description

Encode a private key using WIF format

Usage

WIFs are generated using WIF::wif

use crypto_addr::{WIF, WIFFormat};

let sigkey = b"\xeb\x904)e2\x8a\xe1\xe0\x8e\xfd\xeb+x\xbc2\xd0&/\x04-\xe8\xab\xcd]0\xd6\
               \x07t\x9c\xb3\xaa";
let wif_string = sigkey.wif(WIFFormat::Dogecoin).expect("Could not serialize sigkey data");
assert_eq!(wif_string, "QWWXnSvkQ948FxJfGj4hBtkWjTsrHZYjVpMRMBwqogP9NWvJUzFm");

Required Methods§

source

fn wif(&self, opts: WIFFormat) -> Result<String, Error>

Encode private key bytes as a WIF using blockchain parameters given by opts

Implementors§

source§

impl<T: AsRef<[u8]>> WIF for T

WIF is implemented for all types which expose a sequence of bytes via AsRef<[u8]>. In this case, the bytes are interpreted as the raw private key in big-endian format.