#bitcoin #xpub #slip132

xyzpub

Convert xpubs and xprvs to different versions

4 releases (2 breaking)

0.3.0 Oct 11, 2022
0.2.2 Oct 11, 2022
0.2.1 Aug 29, 2021
0.2.0 Aug 28, 2021
0.1.0 Aug 28, 2021

#498 in #bitcoin

Download history 20/week @ 2024-07-25 7/week @ 2024-08-01 2/week @ 2024-08-29 17/week @ 2024-09-19 15/week @ 2024-09-26 9/week @ 2024-10-03

85 downloads per month
Used in 3 crates

MIT license

14KB
182 lines

xyzpub

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);

Useful resources


lib.rs:

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);

Dependencies

~7MB
~83K SLoC