#cash #bitcoin #bch #encode-decode

cash_addr

受 cashaddrjs 启发的 cash_addr 格式实现

1 个不稳定版本

0.1.0 2019年3月9日

#7#bch

Download history 61/week @ 2024-04-07 164/week @ 2024-04-14 83/week @ 2024-04-21 56/week @ 2024-04-28 85/week @ 2024-05-05 116/week @ 2024-05-12 95/week @ 2024-05-19 149/week @ 2024-05-26 108/week @ 2024-06-02 103/week @ 2024-06-09 169/week @ 2024-06-16 144/week @ 2024-06-23 132/week @ 2024-06-30 111/week @ 2024-07-07 125/week @ 2024-07-14 217/week @ 2024-07-21

591 每月下载次数
2 个 crate 中使用 (通过 bch_addr)

MIT 许可证

14KB
241

cash_addr

CircleCI codecov

cashaddrjs 启发的 cash_addr 格式实现。

cash_addr 规范

用法

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

依赖项

~245KB