| Crates.io | rialo-cdk |
| lib.rs | rialo-cdk |
| version | 0.1.10 |
| created_at | 2025-10-28 12:38:12.723602+00 |
| updated_at | 2025-12-09 20:56:16.819291+00 |
| description | Rialo CDK - A comprehensive toolkit for building with the Rialo blockchain |
| homepage | |
| repository | https://github.com/SubzeroLabs/rialo |
| max_upload_size | |
| id | 1904706 |
| size | 617,192 |
The Rialo CDK is a comprehensive toolkit that provides the fundamental building blocks for interacting with the Rialo blockchain. It serves as the foundation for wallet management, transaction processing, RPC communication, and configuration handling.
Rialo CDK uses Cargo feature flags to allow customization of the library's functionality:
file-storage (default: enabled): Provides file-based wallet and configuration storage. Disable this in environments where filesystem access is unavailable.encryption (default: enabled): Includes encryption/decryption functionality for wallet security. Can be disabled for testing or specific security environments.hd-wallet (default: enabled): Enables hierarchical deterministic wallet functionality. Disable for a slimmer build without HD wallet support.mnemonic (default: enabled): Provides mnemonic phrase generation and recovery (depends on hd-wallet). Can be disabled for simpler applications.rpc-client (default: enabled): Includes the HTTP RPC client implementation. Disable to use custom RPC implementations without HTTP client dependencies.To use Rialo CDK with specific features, specify them in your Cargo.toml:
[dependencies]
rialo-cdk = { version = "0.1.0", default-features = false, features = ["file-storage", "encryption"] }
Add Rialo CDK to your project's dependencies:
[dependencies]
rialo-cdk = "0.1.0"
use rialo_cdk::wallet::{FileWalletProvider, WalletProvider};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Initialize wallet provider with default path
let wallet_dir = FileWalletProvider::default_path()?;
let provider = FileWalletProvider::new(wallet_dir);
// Create a new wallet with mnemonic
let wallet = provider.create_with_mnemonic("my_wallet", "password123").await?;
println!("Created wallet with address: {}", wallet.pubkey_string());
// Load wallet
let loaded_wallet = provider.load("my_wallet", "password123").await?;
// List all wallets
let wallets = provider.list().await?;
for wallet_name in wallets {
println!("Found wallet: {}", wallet_name);
}
Ok(())
}
use rialo_cdk::transaction::TransactionBuilder;
use rialo_cdk::rpc::HttpRpcClient;
async fn send_transaction(wallet: &Wallet, recipient: &str, amount: u64) -> Result<String> {
// Connect to a Rialo node
let rpc_client = HttpRpcClient::new("http://localhost:4104".to_string());
// Get current time in milliseconds for valid_from
let valid_from = std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.expect("Time went backwards")
.as_millis() as i64;
// Build transaction
let tx_builder = TransactionBuilder::new(wallet.pubkey_string(), valid_from);
let signed_tx = tx_builder
.add_transfer_instruction(&wallet.pubkey_string(), recipient, amount)
.sign(wallet)?;
// Submit transaction
let signature = rpc_client.send_transaction(&signed_tx).await?;
Ok(signature)
}
use rialo_cdk::config::{FileConfigProvider, ConfigProvider, Config};
async fn manage_config() -> Result<()> {
// Get config from default location
let config_path = FileConfigProvider::default_path()?;
let provider = FileConfigProvider::new(config_path);
// Load existing config or create default
let mut config = provider.load().await?;
// Update settings
config.set_network("devnet");
config.default_balance_unit = "RLO".to_string();
// Save changes
provider.save(&config).await?;
Ok(())
}
The wallet module provides a comprehensive set of tools for secure key management:
The transaction module handles the creation and signing of blockchain transactions:
The RPC module provides communication with Rialo blockchain nodes:
The configuration module manages user preferences and network settings:
This project is licensed under the Apache License, Version 2.0.