
- Introduced `gsio-client` crate for interacting with GSIO nodes, including ledger entry management and node discovery. - Introduced `gsio-wallet` crate for key management, transaction creation, and wallet functionality. - Updated workspace configuration to include new crates.
65 lines
1.7 KiB
Markdown
65 lines
1.7 KiB
Markdown
# GSIO Wallet
|
|
|
|
A wallet implementation for the GSIO network.
|
|
|
|
## Features
|
|
|
|
- Key management (generate, store, retrieve keys)
|
|
- Transaction creation and signing
|
|
- Balance tracking
|
|
- Transaction history
|
|
|
|
## Usage
|
|
|
|
```rust
|
|
use gsio_wallet::{Wallet, TransactionType};
|
|
|
|
// Create a new wallet
|
|
let mut wallet = Wallet::new();
|
|
|
|
// Generate a new keypair
|
|
let address = wallet.generate_keypair().unwrap();
|
|
println!("Generated address: {}", address);
|
|
|
|
// Create a transaction
|
|
let transaction = wallet.create_transaction(
|
|
&address,
|
|
"recipient_address",
|
|
100,
|
|
10,
|
|
TransactionType::Transfer,
|
|
None,
|
|
).unwrap();
|
|
|
|
// Sign the transaction
|
|
let mut signed_transaction = transaction.clone();
|
|
wallet.sign_transaction(&mut signed_transaction).unwrap();
|
|
|
|
// Submit the transaction (in an async context)
|
|
async {
|
|
let tx_id = wallet.submit_transaction(&signed_transaction).await.unwrap();
|
|
println!("Transaction submitted: {}", tx_id);
|
|
};
|
|
|
|
// Get account balance
|
|
let balance = wallet.get_balance(&address).unwrap();
|
|
println!("Balance: {}", balance);
|
|
|
|
// Get transaction history
|
|
let history = wallet.get_transaction_history(&address).unwrap();
|
|
println!("Transaction history: {:?}", history);
|
|
```
|
|
|
|
## Implementation Details
|
|
|
|
This is a stubbed implementation of a wallet for the GSIO network. The actual implementation would need to be integrated with the GSIO network to handle real transactions and balances.
|
|
|
|
The wallet uses Ed25519 for cryptographic operations, which provides strong security for digital signatures.
|
|
|
|
## Future Improvements
|
|
|
|
- Implement wallet persistence with encryption
|
|
- Add support for multiple accounts in a single wallet
|
|
- Implement transaction verification
|
|
- Add support for different transaction types
|
|
- Integrate with the GSIO network for real transactions |