Module chain_path_derivation::bip44
source · Expand description
Bip44 derivation scheme
based on the [BIP-0044] scheme.
While nearly only the full bip44 address is indeed interesting, it is valuable to keep the different intermediate steps as they can be reused to define specific API objects.
For example, for example a wallet with support to multiple coin types
will be interested to keep the m/'44
path. For every account it is
interesting to keep the m/'44/'<coin_type>/'<account>
.
We have the 5 levels of Derivations: m / purpose' / coin_type' / account' / change / address_index
Examples
basic usage:
use chain_path_derivation::bip44;
let account = bip44::new().bip44().coin_type(BITCOIN).account(ACCOUNT_01);
assert_eq!(account.to_string(), "m/'44/'0/'0")
then it is possible to generate addresses from there:
let change = account.external();
let first_address = change.address(SoftDerivation::min_value().wrapping_add(0));
let second_address = change.address(SoftDerivation::min_value().wrapping_add(1));
assert_eq!(first_address.to_string(), "m/'44/'0/'0/0/0");
assert_eq!(second_address.to_string(), "m/'44/'0/'0/0/1");
Macros
Structs
- scheme for the Bip44 chain path derivation
Constants
- the BIP44 purpose (’44). This is the first item of the derivation path
- the Chimeric BIP44 purpose (’1852). This is the first item of the derivation path
Functions
- create a Bip44 chain path derivation