Files
bft-crdt-experiment/crates/oracle-demo/src/main.rs
2025-06-12 15:49:04 -04:00

44 lines
1.2 KiB
Rust

use colored::*;
use std::time::Duration;
mod network;
mod oracle;
mod utils;
/// A simple demonstration of the BFT-CRDT Oracle Network
/// Run with: cargo run -p oracle-demo
// ============ Core Types ============
#[derive(Debug, Clone, Hash, Eq, PartialEq)]
struct OracleId(String);
#[derive(Debug, Clone, Hash, Eq, PartialEq)]
struct AssetPair(String);
#[derive(Debug, Clone)]
struct PriceAttestation {
id: String,
oracle_id: OracleId,
asset_pair: AssetPair,
price: f64,
confidence: u8,
timestamp: u64,
}
// ============ Main Function ============
fn main() {
println!("{}", "BFT-CRDT Oracle Network Demo".cyan().bold());
println!("{}", "============================\n".cyan());
let simulator = network::Simulator::new();
simulator.run(Duration::from_secs(30));
println!("\n{}", "✅ Demo completed!".green().bold());
println!("\n{}", "💡 Key Takeaways:".yellow().bold());
println!(" • Oracles submitted prices without coordination");
println!(" • Byzantine nodes couldn't corrupt the aggregate price");
println!(" • Network partitions were handled gracefully");
println!(" • No consensus protocol was needed!");
}