monero_wallet 1.0.0+2
monero_wallet: ^1.0.0+2 copied to clipboard
A Dart package that provides native Monero wallet functionality by leveragingDart FFI
Native Wallet Dart Package #
A Dart package that provides native wallet functionality by leveraging Dart FFI to integrate with a high-performance Rust backend. This package enables seamless cryptocurrency wallet operations like generating keys, signing transactions, and interacting with blockchain networks.
✨ Features #
- 🔐 Secure Key Management – Generate and manage cryptographic keys securely.
- 📤 Transaction Signing – Sign transactions using native cryptographic libraries.
- 🌐 Blockchain Integration – Interact with blockchain networks directly from Dart.
- 🚀 High Performance – Utilizes Rust for optimized performance and security.
- 🛠️ Cross-Platform – Works on Windows, macOS, Linux, Android, and iOS.
📦 Installation #
Add the package to your pubspec.yaml:
dependencies:
monero_wallet: ^1.0.0
Then run:
dart pub get
🛠️ Setup #
1. Rust Environment #
Ensure you have Rust installed:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
2. Build Native Library #
Navigate to the Rust directory and build the shared library:
cd rust_backend
cargo build --release
This will generate the shared library (.so, .dylib, or .dll depending on your OS).
3. Configure Dart FFI #
Place the compiled library where your Dart app can load it. Typically:
- macOS/Linux:
rust_backend/target/release/libmonero_wallet.so - Windows:
rust_backend/target/release/monero_wallet.dll
🚀 Usage #
Initialize the Wallet #
import 'package:monero_wallet/monero_wallet.dart';
void main() {
final wallet = NativeWallet();
wallet.initialize();
print('Wallet initialized!');
}
Generate a New Key Pair #
final keyPair = wallet.generateKeyPair();
print('Public Key: ${keyPair.publicKey}');
print('Private Key: ${keyPair.privateKey}');
Sign a Transaction #
final transaction = "sample transaction data";
final signature = wallet.signTransaction(transaction);
print('Transaction Signature: $signature');
📚 API Overview #
initialize() #
Initializes the native wallet library.
generateKeyPair() #
Generates a new cryptographic key pair.
signTransaction(String data) #
Signs the provided transaction data.
getBalance(String address) #
Fetches the balance of the given wallet address.
🏗️ Architecture #
- Dart Layer: Handles API exposure and integrates with the UI.
- Dart FFI: Bridges Dart and native Rust functions.
- Rust Backend: Executes performance-critical operations securely.
📱 Platform Support #
| Platform | Status |
|---|---|
| Android | ✅ Supported |
| iOS | ✅ Supported |
| Windows | ✅ Supported |
| macOS | ✅ Supported |
| Linux | ✅ Supported |
🛡️ Security Considerations #
- All cryptographic operations are handled by Rust, ensuring high performance and security.
- Sensitive data like private keys are never exposed to the Dart layer.
🔧 Development #
Run Tests #
dart test
Format Code #
dart format .
🤝 Contributing #
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a new branch (
git checkout -b feature-xyz). - Commit your changes (
git commit -m 'Add feature XYZ'). - Push to the branch (
git push origin feature-xyz). - Open a Pull Request.
📄 License #
Distributed under the Apache 2.0 License. See LICENSE for more information.
💬 Contact #
For issues or feature requests, please open an issue on GitHub.
Happy coding! 🚀