rustywallet-hd
BIP32/BIP44 Hierarchical Deterministic wallet for cryptocurrency key derivation.
Features
- Create master keys from 64-byte seeds
- Derive child keys using BIP32 derivation
- Support BIP44 standard paths
- Export/import extended keys (xprv/xpub, tprv/tpub)
- Normal and hardened derivation
- Public key derivation from xpub (non-hardened only)
- Secure memory handling (zeroize on drop)
Installation
[]
= "0.1"
Usage
use *;
// Create master key from seed (64 bytes, typically from mnemonic)
let seed = ;
let master = from_seed.unwrap;
// Derive BIP44 Bitcoin path: m/44'/0'/0'/0/0
let path = bip44_bitcoin;
let child = master.derive_path.unwrap;
// Get keys
let private_key = child.private_key.unwrap;
let public_key = child.public_key;
// Export as xprv/xpub
let xprv = child.to_xprv;
let xpub = child.extended_public_key.to_xpub;
BIP44 Paths
m / purpose' / coin_type' / account' / change / address_index
Bitcoin: m/44'/0'/0'/0/0
Ethereum: m/44'/60'/0'/0/0
Helper methods:
// Bitcoin path
let btc_path = bip44_bitcoin;
// Ethereum path
let eth_path = bip44_ethereum;
Integration with rustywallet-mnemonic
use *;
use *;
// Generate mnemonic
let mnemonic = generate;
// Get seed
let seed = mnemonic.to_seed;
// Create HD wallet
let master = from_seed.unwrap;
// Derive keys
let path = bip44_bitcoin;
let child = master.derive_path.unwrap;
Security
- Private keys and chain codes are zeroized on drop
- Debug output masks sensitive data
- Hardened derivation prevents public key derivation
License
MIT