| commit | 0f98477ee25ae008a06f695b77c93634e5407135 | [log] [tgz] |
|---|---|---|
| author | dharora <93426753+dharora@users.noreply.github.com> | Tue Dec 05 17:45:27 2023 -0800 |
| committer | Dhruv Sangamwar <dsangamwar@gmail.com> | Thu Dec 07 23:35:50 2023 -0800 |
| tree | 2efcdce6f570811fe5f2ce936edd3d9a249155d8 | |
| parent | 2c8b0dfe6dc6d33896063c4a5d5d54b67c119c4a [diff] |
Update main.rs
// Testing code for crypto module in main
let keypair = crypto::generate_keypair(2048);
println!("Public Key: {:?}", keypair.0);
// Handle the private key securely
// Printing here for testing only
println!("Private Key: [hidden]");
let data = "Hello, World!";
let hashed_data = crypto::hash_data(data);
println!("Hashed Data: {}", hashed_data);The ResilientDB Rust SDK is a powerful Rust library that facilitates seamless interaction with resource databases. It offers comprehensive APIs for managing transactions and blocks, simplifying integration with systems requiring robust data management capabilities.
Add this line to your Cargo.toml file to integrate the SDK into your Rust project:
[dependencies] resilientdb_rust_sdk = "0.1.0"
// Import the ResDB SDK use resilientdb_rust_sdk::ResDB; // Create a new ResDB instance let res_db = ResDB::new(); // Example: Create a new transaction object let transaction = res_db.create_object::<YourTransactionType>(); // Example: Get all transactions from a specified API endpoint let all_transactions = res_db.get_all_transactions::<YourTransactionType>("https://api.example.com").await;
// Example: Retrieve all blocks from a specified API endpoint let all_blocks = res_db.get_all_blocks::<T>("https://api.example.com/blocks").await; // Example: Group blocks with a specified batch size let grouped_blocks = res_db.get_blocks_grouped::<T>("https://api.example.com/blocks", &100).await;
Contributions are welcome! If you encounter any issues or have suggestions for improvements, please open an issue or submit a pull request.
This SDK is licensed under the Apache-2.0 License.