Source

HD Wallets

Hierarchical deterministic wallet implementation with BIP44 standard

BIP32
BIP44
BIP39
Ed25519
BIP44 Derivation
Standard hierarchical deterministic key derivation
HDWallet::derive_address(index)
Uses secp256k1 curve with Ed25519 for signing
AES-256-GCM Encryption
Encrypted storage with authenticated encryption
PBKDF2 + AES-256-GCM
100,000+ iterations for key stretching
BIP39 Mnemonics
Standard 12/24 word seed phrase generation
HDWallet::generate_mnemonic()
2048 word dictionary with checksum validation
Multi-Account Support
Multiple accounts from single seed phrase
Wallet::create_account(name)
Each account has separate derivation path
BIP44 Derivation Path
Standard hierarchical path: m/44'/0'/0'/0/index
m
Master private key
Generated from seed phrase
BIP32 root
m/44'
Purpose (hardened)
BIP44 standard
Fixed value 44
m/44'/0'
Coin type (hardened)
Y Protocol coin type
0 for development/testing
m/44'/0'/0'
Account (hardened)
Account 0
Multiple accounts per wallet
m/44'/0'/0'/0
Change (external)
Receiving addresses
0 = receive, 1 = change
m/44'/0'/0'/0/0
Address index
First address
0, 1, 2, 3...
HD Wallet Creation
Generate multiple addresses from single seed phrase
// Create HD wallet from mnemonic
use y_protocol_wallet::{HDWallet, Wallet};

let mnemonic = "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about";
let hd_wallet = HDWallet::from_mnemonic(mnemonic)?;

// Derive addresses using BIP44 path
let address_0 = hd_wallet.derive_address(0)?; // m/44'/0'/0'/0/0
let address_1 = hd_wallet.derive_address(1)?; // m/44'/0'/0'/0/1

println!("Address 0: {}", address_0.address);
println!("Address 1: {}", address_1.address);
Technical Specifications

Cryptographic Standards

  • • BIP32/BIP44 key derivation
  • • Ed25519 signature scheme
  • • SHA-256 for address generation
  • • AES-256-GCM encryption

Performance

  • • Address generation: ~1ms
  • • Transaction signing: ~0.1ms
  • • Wallet loading: <100ms
  • • Memory usage: <10MB
Test Coverage
65 tests covering all wallet functionality
HD wallet derivation
Address generation
Transaction signing
Encryption/decryption
BIP44 compliance