qp-rusty-crystals-hdwallet

Crates.ioqp-rusty-crystals-hdwallet
lib.rsqp-rusty-crystals-hdwallet
version1.0.0
created_at2025-09-06 01:50:36.169201+00
updated_at2025-11-06 06:04:20.28218+00
descriptionPure Quantus RUST implementation of HD wallet functionality with post-quantum cryptography
homepagehttps://www.quantus.com
repositoryhttps://github.com/Quantus-Network/qp-rusty-crystals
max_upload_size
id1826635
size538,015
Quantus Network CI (quantus-network-ci)

documentation

README

qp-rusty-crystals-hdwallet

Hierarchical Deterministic (HD) wallet implementation for post-quantum ML-DSA keys, compatible with BIP-32, BIP-39, and BIP-44 standards.

Features

  • BIP-39 Mnemonic - Generate and restore from mnemonic phrases
  • BIP-32 HD Derivation - Hierarchical deterministic key derivation
  • BIP-44 Compatible - Standard derivation paths
  • Post-Quantum - Uses ML-DSA (Dilithium) signatures
  • Hardened First 3 Levels - Require hardened purpose', coin_type', account'; later levels optional

Standard expected derivation path

We use 44 for purpose, 189189 for coin type (Quantus), and account index for account Example: "m/44'/189189'/{account_index}'/0/0"

Usage

Add to your Cargo.toml:

[dependencies]
qp-rusty-crystals-hdwallet = "0.0.2"
qp-rusty-crystals-dilithium = "0.0.2"

Basic Example

use qp_rusty_crystals_hdwallet::{generate_mnemonic, HDLattice};

// Generate a new mnemonic
let mnemonic = generate_mnemonic(24)?;
println!("Mnemonic: {}", mnemonic);

// Create HD wallet from mnemonic
let hd_wallet = HDLattice::from_mnemonic(&mnemonic, None)?;

// Generate master keys
let master_keys = hd_wallet.generate_keys();

// Derive child keys using BIP-44 path
let child_keys = hd_wallet.generate_derived_keys("44'/189189'/0'/0'/0'")?;

// Sign with derived keys
let message = b"Hello, quantum-safe wallet!";
let signature = child_keys.sign(message);

Derivation Paths

Standard BIP-44 derivation paths are supported:

m / purpose' / coin_type' / account' / change / address_index

Example paths:

  • m/44'/189189'/0'/0'/0' - First address of first account
  • m/44'/189189'/1'/0'/0' - First address of second account
  • m/44'/189189'/0'/1'/0' - First change address

Note: For security, the first three indices must be hardened (purpose', coin_type', account'). Subsequent indices (change, address_index) may be unhardened.

Why Hardened Keys Only?

Non-hardened key derivation relies on elliptic curve properties not present in lattice-based cryptography. For security, this implementation requires hardened derivation for the first three indices and permits flexibility for deeper levels.

Testing

cargo test

License

GPL-3.0 - See LICENSE for details.

Commit count: 66

cargo fmt