Zeus-BIP32
BIP32 hierarchical deterministic key derivation for Zeus.
A slim, security-oriented fork of coins-bip32. It derives secp256k1 extended keys from a seed and walks a derivation path. Private keys and chain codes live in secure-types so they can be locked and zeroized.
Higher-level wallet types (username + password → seed, child bookkeeping, Ethereum addresses) live in zeus-wallet.
What it does
- Build a master key from a seed (
root_from_seed, HMAC-SHA512 with the BIP32"Bitcoin seed"key) - Derive hardened and normal children along a path (
SecureXPriv::derive_path) - Parse and format BIP32 paths (
m/44'/60'/0'/0/0,hor'for hardened) - Keep
XKeyInfo(depth, parent fingerprint, index, chain code) next to the secret - Optional
serdeforSecureXPriv,XKeyInfo, andDerivationPath
Default Ethereum path constants:
m/44'/60'/0'/0/0 DEFAULT_DERIVATION_PATH
m/44'/60'/0'/0/ DEFAULT_DERIVATION_PATH_PREFIX
Hardened indices use BIP32_HARDEN (0x8000_0000). Zeus derives HD children as base_path.extended(index + BIP32_HARDEN).
Usage
use FromStr;
use ;
// In Zeus this seed comes from Argon2id(username, password) via zeus-wallet::derive_seed.
let seed = ;
let = root_from_seed?;
let master = new;
// m/44'/60'/0'/0/0/{index}'
let path = from_str?.extended;
let child = master.derive_path?;
assert_eq!;
assert!;
// Unlock only for the call, the buffer is not copied out.
child.key.unlock;
# Ok::
Seed must be at least 16 bytes (BIP32). Prefer 64 bytes.
Features
serde— serializeDerivationPathas itsm/…string; serialize key material viasecure-types
License
MIT OR Apache-2.0. Derived from coins.