Expand description
xyz-pub
Convert xpubs and xprvs to different versions.
Example
use xyzpub::{convert_version, Version};
let xpub = "xpub6BosfCnifzxcFwrSzQiqu2DBVTshkCXacvNsWGYJVVhhawA7d4R5WSWGFNbi8Aw6ZRc1brxMyWMzG3DSSSSoekkudhUd9yLb6qx39T9nMdj";
let expected_zpub = "zpub6qUQGY8YyN3ZxYEgf8J6KCQBqQAbdSWaT9RK54L5FWTTh8na8NkCkZpYHnWt7zEwNhqd6p9Utq562cSZsqGqFE87NNsUKnyZeJ5KvbhfC8E";
let result = convert_version(xpub, &Version::Zpub).unwrap();
assert_eq!(result, expected_zpub);
Enums
Constants
Version bytes tprv: bitcoin testnet private key for P2PKH or P2SH
Version bytes tpub: bitcoin testnet public key for P2PKH or P2SH
Version bytes uprv: bitcoin testnet private key for P2WPKH in P2SH
Version bytes Uprv: bitcoin testnet private key for multi-signature P2WSH in P2SH
Version bytes upub: bitcoin testnet public key for P2WPKH in P2SH
Version bytes Upub: bitcoin testnet public key for multi-signature P2WSH in P2SH
Version bytes vprv: bitcoin testnet private key for P2WPKH
Version bytes Vprv: bitcoin testnet private key for multi-signature P2WSH
Version bytes vpub: bitcoin testnet public key for P2WPKH
Version bytes Vpub: bitcoin testnet public key for multi-signature P2WSH
Version bytes xprv: bitcoin mainnet private key P2PKH or P2SH
Version bytes xpub: bitcoin mainnet public key P2PKH or P2SH
Version bytes yprv: bitcoin mainnet private key P2WPKH in P2SH
Version bytes Yprv: bitcoin mainnet private key for multi-signature P2WSH in P2SH
Version bytes ypub: bitcoin mainnet public key P2WPKH in P2SH
Version bytes Ypub: bitcoin mainnet public key for multi-signature P2WSH in P2SH
Version bytes zprv: bitcoin mainnet private key P2WPKH
Version bytes Zprv: bitcoin mainnet private key for multi-signature P2WSH
Version bytes zpub: bitcoin mainnet public key P2WPKH
Version bytes Zpub: bitcoin mainnet public key for multi-signature P2WSH
Functions
Replaces the first 4 bytes of a base58 string with the target’s version and returns the new string.
Also checks if the input is a correct address.
Replaces the first 4 bytes of a byte slice with the target’s version and returns a new byte vec.
Does not check if extended public/private key is valid and only replaces the version bytes.