Mockchain Wallet CLI
A command-line interface for interacting with a mockchain network using a modular Rust architecture.
Table of Contents
- Features
- Installation
- Quick Start
- Usage
- Architecture
- Project Documentation
- Development
- Security
- Contributing
- License
Features
- ✅ Create and manage multiple wallets
- ✅ Check wallet balances
- ✅ Send transactions between wallets
- ✅ Request funds from mockchain faucet
- ✅ Secure local key storage
- ✅ Modular, maintainable codebase
- ✅ Comprehensive error handling
Installation
Prerequisites
- Rust and Cargo (1.54.0+)
- Running mockchain service at
http://[::1]:50051
From Source
# Clone repository
# Build release version
# Run the executable
From Crates.io
# Install Directly
Quick Start
# Create a new wallet
# Request funds from faucet
# Check balance
# Create another wallet
# Send transaction
Usage
Create a Wallet
Creates a new wallet with a randomly generated key pair.
List Wallets
Displays all wallets in your local storage.
Check Balance
Retrieves the current balance for a wallet.
Send Transaction
Sends funds from one wallet to another. The recipient can be specified either by wallet name or by public key address.
Request from Faucet
Requests funds from the mockchain's faucet service.
Architecture
This application follows a modular architecture for improved maintainability:
src/
├── main.rs # Entry point with error handling
├── commands.rs # Command definitions using StructOpt
├── models.rs # Data structures
├── wallet.rs # Mockchain interactions
├── storage.rs # Wallet storage management
├── errors.rs # Error handling system
└── proto.rs # gRPC protocol initialisation
Key architectural decisions:
- Separation of concerns between data, storage, and network operations
- Custom error types with context-rich error messages
- Domain-driven design with clear boundaries between modules
- gRPC communication with the mockchain service
Project Documentation
Generate and view the API documentation:
Development
Building
# Development build
# Release build
Adding New Features
To add a new command:
- Add a new variant to the
Commandenum incommands.rs - Add the command handler in the
run()function inmain.rs - Implement the necessary functionality in appropriate modules
Security
- Private keys are stored locally in
.wallets/wallets.json - Keys use secp256k1 cryptography (same as Bitcoin)
- Transactions are signed with ECDSA signatures
- Private keys never leave your local machine
⚠️ Warning: Secure access to the .wallets directory on your machine
Contributing
Contributions are welcome! Here are some areas where help would be appreciated:
- Improving the security with which the wallet keypairs are stored
- Including BIP39 mnemonics for wallet creation and recovery
- Adding password confirmation before sending transactions
Please feel free to submit a Pull Request.
Please follow the Rust code style guidelines and include appropriate tests.
License
This project is licensed under the MIT License - see the LICENSE file for details.