#derivation #bip32 #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

#434 in Magic Beans

Download history 9348/week @ 2022-11-30 9828/week @ 2022-12-07 10625/week @ 2022-12-14 6605/week @ 2022-12-21 5478/week @ 2022-12-28 9726/week @ 2023-01-04 9595/week @ 2023-01-11 11013/week @ 2023-01-18 11738/week @ 2023-01-25 13856/week @ 2023-02-01 12896/week @ 2023-02-08 13826/week @ 2023-02-15 27150/week @ 2023-02-22 11887/week @ 2023-03-01 12352/week @ 2023-03-08 10640/week @ 2023-03-15

64,617 downloads per month
Used in 593 crates (12 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

# use derivation_path::{ChildIndex, DerivationPath, DerivationPathType};
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

  • std