Expand description
§rustywallet
A comprehensive Rust library for cryptocurrency wallet utilities.
This crate provides a unified API for working with cryptocurrency wallets, including key management, address generation, mnemonic phrases, HD wallets, and message signing.
§Features
- keys - Private and public key management (secp256k1)
- address - Bitcoin and Ethereum address generation
- mnemonic - BIP39 mnemonic phrase support
- hd - BIP32/BIP44 hierarchical deterministic wallets
- signer - ECDSA message signing and verification
All features are enabled by default. You can disable default features and enable only what you need:
[dependencies]
rustywallet = { version = "0.1", default-features = false, features = ["keys", "address"] }§Quick Start
use rustywallet::prelude::*;
// Generate a random private key
let key = PrivateKey::random();
let pubkey = key.public_key();
println!("Private key: {}", key.to_hex());
println!("Public key: {}", pubkey.to_hex(PublicKeyFormat::Compressed));§Full Wallet Workflow
ⓘ
use rustywallet::prelude::*;
// 1. Generate mnemonic
let mnemonic = Mnemonic::generate(WordCount::Words12);
println!("Mnemonic: {}", mnemonic.phrase());
// 2. Derive seed
let seed = mnemonic.to_seed("");
// 3. Create HD wallet
let master = ExtendedPrivateKey::from_seed(seed.as_bytes(), HdNetwork::Mainnet).unwrap();
// 4. Derive child key (BIP44: m/44'/0'/0'/0/0)
let path = DerivationPath::parse("m/44'/0'/0'/0/0").unwrap();
let child = master.derive_path(&path).unwrap();
let privkey = child.private_key().unwrap();
println!("Private key: {}", privkey.to_hex());
println!("Public key: {}", privkey.public_key().to_hex(PublicKeyFormat::Compressed));§Module Overview
Re-exports§
pub use rustywallet_keys as keys;pub use rustywallet_address as address;pub use rustywallet_mnemonic as mnemonic;pub use rustywallet_hd as hd;pub use rustywallet_signer as signer;
Modules§
- prelude
- Common imports for rustywallet