A command-line interface for interacting with a mockchain network using a modular Rust architecture.
- Features
- Installation
- Quick Start
- Usage
- Architecture
- Project Documentation
- Development
- Security
- Contributing
- License
- ✅ 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
- Rust and Cargo (1.54.0+)
- Running mockchain service at
http://[::1]:50051
# Clone repository
git clone https://github.com/0xsouravm/mockchain-wallet-rs.git
cd mockchain-wallet-rs
# Build release version
cargo build --release
# Run the executable
./target/release/mockallet
# Install Directly
cargo install mockallet
# Create a new wallet
./mockallet new alice
# Request funds from faucet
./mockallet faucet alice
# Check balance
./mockallet balance alice
# Create another wallet
./mockallet new bob
# Send transaction
./mockallet send alice bob 100
mockallet new <wallet_name>
Creates a new wallet with a randomly generated key pair.
mockallet list
Displays all wallets in your local storage.
mockallet balance <wallet_name>
Retrieves the current balance for a wallet.
mockallet send <from_wallet> <to_wallet> <amount>
Sends funds from one wallet to another. The recipient can be specified either by wallet name or by public key address.
mockallet faucet <wallet_name>
Requests funds from the mockchain's faucet service.
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
Generate and view the API documentation:
cargo doc --open
# Development build
cargo build
# Release build
cargo build --release
To add a new command:
- Add a new variant to the
Command
enum incommands.rs
- Add the command handler in the
run()
function inmain.rs
- Implement the necessary functionality in appropriate modules
- 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
.wallets
directory on your machine
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.
This project is licensed under the MIT License - see the LICENSE file for details.