use prollytree::config::TreeConfig;
use prollytree::storage::InMemoryNodeStorage;
use prollytree::tree::{ProllyTree, Tree};
fn main() {
println!("🌳 Prolly Tree Proof Visualization Demo 🌳\n");
let storage = InMemoryNodeStorage::<32>::default();
let config = TreeConfig {
base: 131,
modulus: 1_000_000_009,
min_chunk_size: 3,
max_chunk_size: 6,
pattern: 0b111,
root_hash: None,
key_schema: None,
value_schema: None,
encode_types: vec![],
};
let mut tree = ProllyTree::new(storage, config);
println!("📊 Inserting data into the tree...");
for i in 0..25 {
tree.insert(vec![i], format!("value_{}", i).into_bytes());
}
println!("\n📋 Regular tree structure:");
tree.print();
println!("\n🔍 Proof Visualization Examples:\n");
let key1 = vec![10];
println!("🟢 Example 1: Proof for existing key {:?}", key1);
println!(" (Green nodes show the cryptographic proof path)");
let is_valid1 = tree.print_proof(&key1);
println!(" ✅ Proof validation result: {}\n", is_valid1);
let key2 = vec![20];
println!("🟢 Example 2: Proof for existing key {:?}", key2);
let is_valid2 = tree.print_proof(&key2);
println!(" ✅ Proof validation result: {}\n", is_valid2);
let key3 = vec![30];
println!("🔴 Example 3: Proof for non-existing key {:?}", key3);
println!(" (Shows proof path to where the key would be located)");
let is_valid3 = tree.print_proof(&key3);
println!(" ❌ Proof validation result: {}\n", is_valid3);
println!("🎯 Summary:");
println!(" • The proof visualization highlights the cryptographic path");
println!(" • Green nodes with hash information show the verification trail");
println!(" • Valid proofs confirm data integrity and membership");
println!(" • Invalid proofs demonstrate absence in a verifiable way");
println!("\n✨ This enables transparent verification of data in distributed systems!");
}