#derivation #bip-32 #bip44 #blockchain #bip49

no-std derivation-path

Simple struct for dealing with BIP32/44/49 derivation paths

5 releases

0.2.0 Feb 16, 2022
0.1.3 Jul 1, 2020
0.1.2 Jul 1, 2020
0.1.1 Jun 17, 2020
0.1.0 Jun 16, 2020

#1866 in Magic Beans

Download history 34269/week @ 2023-12-07 32452/week @ 2023-12-14 22613/week @ 2023-12-21 21369/week @ 2023-12-28 35494/week @ 2024-01-04 30898/week @ 2024-01-11 37992/week @ 2024-01-18 32274/week @ 2024-01-25 41552/week @ 2024-02-01 26218/week @ 2024-02-08 28982/week @ 2024-02-15 33932/week @ 2024-02-22 31425/week @ 2024-02-29 36188/week @ 2024-03-07 35077/week @ 2024-03-14 29082/week @ 2024-03-21

138,112 downloads per month
Used in 917 crates (16 directly)

MIT/Apache

26KB
661 lines

derivation-path

A simple struct for dealing with derivation paths as defined by BIP32, BIP44 and BIP49 of the Bitcoin protocol. This crate provides interfaces for dealing with hardened vs normal child indexes, as well as display and parsing derivation paths from strings

Example

let path = DerivationPath::bip44(0, 1, 0, 1).unwrap();
assert_eq!(&path.to_string(), "m/44'/0'/1'/0/1");
assert_eq!(path.path()[2], ChildIndex::Hardened(1));

let path: DerivationPath = "m/49'/0'/0'/1/0".parse().unwrap();
assert_eq!(path.path()[4], ChildIndex::Normal(0));
assert_eq!(path.path_type(), DerivationPathType::BIP49);

License: MIT OR Apache-2.0


lib.rs:

A simple struct for dealing with derivation paths as defined by BIP32, BIP44 and BIP49 of the Bitcoin protocol. This crate provides interfaces for dealing with hardened vs normal child indexes, as well as display and parsing derivation paths from strings

Example

let path = DerivationPath::bip44(0, 1, 0, 1).unwrap();
assert_eq!(&path.to_string(), "m/44'/0'/1'/0/1");
assert_eq!(path.path()[2], ChildIndex::Hardened(1));

let path: DerivationPath = "m/49'/0'/0'/1/0".parse().unwrap();
assert_eq!(path.path()[4], ChildIndex::Normal(0));
assert_eq!(path.path_type(), DerivationPathType::BIP49);

No runtime deps

Features