Aqua SDK
A library for use in a code base for notarization and verification
2 min read
This Page contains sdk details of version 4 of the Aqua Protocol.To Use version 3 which is stable visit quickstart The Aqua SDK is a Rust library that provides the core functionality for creating, signing, witnessing, and verifying Aqua Protocol chains. It supports Aqua Protocol v4 and includes WebAssembly (WASM) bindings for cross-platform compatibility.
Features
- Create Aqua Chains: Build revision chains with objects, templates, signatures, witnesses, and links
- Template System: Define and validate structured data using JSON Schema
- Multiple Signature Methods: Support for RSA, Ethereum EIP-191, and DID:JWS signatures
- Blockchain Witnessing: Anchor revisions to Ethereum (mainnet, Sepolia, Holesky), Nostr, or TSA
- Chain Verification: Cryptographically verify complete revision chains
- Cross-Platform: WASM support enables use in web browsers, Node.js, and native applications
Installation
Add the SDK to your Rust project:
cargo.toml
toml
1[dependencies]2aqua-rs-sdk = { git = "https://github.com/inblockio/aqua-verifier-rs" }Quick Example
main.rs
rust
1 use aqua_rs_sdk::primitives::Method;2 use aqua_rs_sdk::schema::file_data::FileData;3 use aqua_rs_sdk::Aquafier;4 use std::path::PathBuf;5 6 #[tokio::main]7 async fn main() -> Result<(), Box<dyn std::error::Error>> {8 println!("Creating Aqua chain...");9 10 // Read file content11 let filename = "test.txt".to_string();12 let file_content = tokio::fs::read(&filename).await?;13 14 // Create file data15 let file_data = FileData::new(16 filename.clone(),17 file_content,18 PathBuf::from(format!("./{}", filename)),19 );20 21 // Initialize Aquafier22 let aquafier = Aquafier::new(None, None);23 24 // Create genesis revision (notarize the file)25 let result = aquafier.create_genesis_revision(file_data, Method::Scalar);26 27 match result {28 Ok(tree) => {29 println!("✓ Aqua chain created successfully!");30 println!("{}", serde_json::to_string_pretty(&tree)?);31 32 println!("\nYou can now:");33 println!("- Add a signature revision");34 println!("- Witness on blockchain");35 println!("- Verify the chain");36 37 // Sign the revision38 // let signature = sign_revision(&object_revision, &signing_key)?;39 40 // Witness on blockchain41 // let witness = witness_revision(&signature, EthereumNetwork::Sepolia)?;42 43 // Verify the complete chain44 // let is_valid = verify_chain(&aqua_chain)?;45 46 }47 Err(e) => {48 eprintln!("Error: {:#?}", e);49 }50 }51 52 Ok(())53 }54 55 Use Cases
- Application Integration: Embed Aqua Protocol directly into your Rust applications
- Custom Tools: Build specialized tools for specific workflows
- Smart Contracts: Integrate with blockchain applications using WASM
- Web Applications: Use WASM bindings to run in browsers
- Server Applications: Build backend services with native Rust performance
Repository
GitHub: github.com/inblockio/aqua-verifier-rs
Documentation
For detailed API documentation, examples, and guides:
Version
Current Version: 4.0.0 (Beta)
The SDK implements Aqua Protocol v4 with the template system and enhanced revision types. For production-stable implementations, consider the JavaScript SDK (v3).
