rustywallet 0.1.2

Cryptocurrency wallet utilities for Rust - keys, addresses, mnemonics, HD wallets, and signing
Documentation

rustywallet

Crates.io Documentation License: MIT Build Status

A comprehensive Rust library ecosystem for cryptocurrency wallet utilities. This umbrella crate provides a unified API for all wallet-related operations including key management, address generation, mnemonic handling, hierarchical deterministic wallets, message signing, and blockchain utilities.

Overview

The rustywallet ecosystem consists of modular crates that work together to provide complete cryptocurrency wallet functionality:

  • Cryptographic primitives - Secure key generation and management
  • Address generation - Support for Bitcoin, Ethereum, and other cryptocurrencies
  • Mnemonic phrases - BIP39 compliant seed phrase generation and validation
  • HD wallets - BIP32/BIP44 hierarchical deterministic wallet derivation
  • Message signing - ECDSA signature creation and verification
  • Blockchain utilities - Address validation, bloom filters, and more

Crates

Crate Version Description
rustywallet-keys Crates.io Private and public key management (secp256k1)
rustywallet-address Crates.io Bitcoin and Ethereum address generation
rustywallet-mnemonic Crates.io BIP39 mnemonic phrase support
rustywallet-hd Crates.io BIP32/BIP44 hierarchical deterministic wallets
rustywallet-signer Crates.io ECDSA message signing and verification
rustywallet-checker Crates.io Address validation and format checking
rustywallet-bloom Crates.io Bloom filter implementation for efficient lookups

Installation

Add this to your Cargo.toml:

[dependencies]
rustywallet = "0.1.0"

Quick Start

The unified API provides easy access to all wallet functionality:

use rustywallet::prelude::*;

// Generate a random private key
let key = PrivateKey::random();
let pubkey = key.public_key();

// Generate Bitcoin address
let address = Address::from_public_key(&pubkey, AddressType::P2PKH, Network::Bitcoin);

println!("Private key: {}", key.to_hex());
println!("Address: {}", address);

Complete Wallet Workflow

use rustywallet::prelude::*;

// 1. Generate mnemonic phrase
let mnemonic = Mnemonic::generate(WordCount::Words12);
println!("Mnemonic: {}", mnemonic.phrase());

// 2. Create HD wallet from mnemonic
let seed = mnemonic.to_seed("");
let master = ExtendedPrivateKey::from_seed(&seed, Network::Bitcoin)?;

// 3. Derive account key (BIP44: m/44'/0'/0'/0/0)
let path = DerivationPath::parse("m/44'/0'/0'/0/0")?;
let account_key = master.derive_path(&path)?;

// 4. Generate address
let private_key = account_key.private_key();
let public_key = private_key.public_key();
let address = Address::from_public_key(&public_key, AddressType::P2PKH, Network::Bitcoin);

// 5. Sign a message
let message = "Hello, Bitcoin!";
let signature = Signer::sign_message(&private_key, message)?;

println!("Address: {}", address);
println!("Signature: {}", signature.to_hex());

Feature Flags

All features are enabled by default. You can selectively enable only the functionality you need:

[dependencies]
rustywallet = { version = "0.1.0", default-features = false, features = ["keys", "address"] }
Feature Description Dependencies
keys Private/public key management -
address Address generation and validation keys
mnemonic BIP39 mnemonic phrase support -
hd HD wallet derivation (BIP32/BIP44) keys, mnemonic
signer Message signing and verification keys
checker Address validation utilities address
bloom Bloom filter implementation -
full All features (default) all above

Individual Crate Usage

You can also use individual crates directly:

[dependencies]
rustywallet-keys = "0.1.0"
rustywallet-address = "0.1.0"

Examples

Key Generation

use rustywallet::keys::*;

let private_key = PrivateKey::random();
let public_key = private_key.public_key();
let compressed = public_key.serialize_compressed();

Mnemonic Handling

use rustywallet::mnemonic::*;

let mnemonic = Mnemonic::generate(WordCount::Words24);
let seed = mnemonic.to_seed("optional_passphrase");

Address Validation

use rustywallet::checker::*;

let is_valid = AddressChecker::validate("1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa");
let format = AddressChecker::detect_format("bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4");

License

Licensed under the MIT License. See LICENSE for details.