#cash #bitcoin #bch #encode-decode

cash_addr

cash_addr format implementation inspired by cashaddrjs

1 unstable release

0.1.0 Mar 9, 2019

#9 in #bch

Download history 116/week @ 2024-07-28 301/week @ 2024-08-04 290/week @ 2024-08-11 299/week @ 2024-08-18 205/week @ 2024-08-25 290/week @ 2024-09-01 148/week @ 2024-09-08 332/week @ 2024-09-15 156/week @ 2024-09-22 215/week @ 2024-09-29 234/week @ 2024-10-06 418/week @ 2024-10-13 221/week @ 2024-10-20 122/week @ 2024-10-27 438/week @ 2024-11-03 573/week @ 2024-11-10

1,358 downloads per month
Used in 2 crates (via bch_addr)

MIT license

14KB
241 lines

cash_addr

CircleCI codecov

cash_addr format implementation inspired by cashaddrjs.

cash_addr specification

Usage

use cash_addr::{encode, decode, AddressType};

let data = [0xF5, 0xBF, 0x48, 0xB3, 0x97, 0xDA, 0xE7, 0x0B, 0xE8, 0x2B, 0x3C, 0xCA, 0x47, 0x93, 0xF8, 0xEB, 0x2B, 0x6C, 0xDA, 0xC9];
let prefix = "bitcoincash";
let addr_type = AddressType::P2PKH;

let address = encode(prefix, addr_type, &data).unwrap();
assert_eq!(address, "bitcoincash:qr6m7j9njldwwzlg9v7v53unlr4jkmx6eylep8ekg2");

let (prefix, addr_type, hash) = decode(&address).unwrap();
assert_eq!(prefix, "bitcoincash");
assert_eq!(addr_type, AddressType::P2PKH);
assert_eq!(hash, data);

Dependencies

~245KB