78 lines
2.7 KiB
Markdown
78 lines
2.7 KiB
Markdown
# BFT-CRDT Oracle Network Demo
|
|
|
|
A live demonstration of a decentralized oracle network using Byzantine Fault Tolerant Conflict-free Replicated Data Types (BFT-CRDTs).
|
|
|
|
## What This Demo Shows
|
|
|
|
This demo simulates a network of 7 oracle nodes (5 honest, 2 Byzantine) that:
|
|
- Submit price data independently without coordination
|
|
- Handle network partitions gracefully
|
|
- Filter out Byzantine manipulation attempts
|
|
- Achieve consensus without a consensus protocol
|
|
|
|
## Running the Demo
|
|
|
|
From the root of the `bft-crdt-experiment` directory:
|
|
|
|
```bash
|
|
cargo run -p oracle-demo
|
|
```
|
|
|
|
## What You'll See
|
|
|
|
The demo runs for 30 seconds and shows:
|
|
|
|
1. **Real-time Price Submissions**: Each oracle submits ETH/USD prices every second
|
|
2. **Network Partitions**: Every 10 seconds, the network splits and heals
|
|
3. **Byzantine Behavior**: Two nodes attempt to manipulate prices (20% higher)
|
|
4. **Aggregated Results**: Despite attacks, the network maintains accurate pricing
|
|
|
|
## Key Observations
|
|
|
|
- 🟢 **Honest nodes** submit prices around $2500 with small variance
|
|
- 🔴 **Byzantine nodes** try to push prices to $3000
|
|
- The **aggregated price** remains accurate (~$2500) due to outlier detection
|
|
- Network partitions don't break the system - nodes sync when reconnected
|
|
|
|
## How It Works
|
|
|
|
1. **Independent Submissions**: Each oracle fetches prices and submits attestations
|
|
2. **CRDT Propagation**: Nodes share attestations without needing agreement
|
|
3. **Outlier Detection**: IQR (Interquartile Range) method filters manipulated prices
|
|
4. **Weighted Aggregation**: Final price weighted by confidence and reputation
|
|
|
|
## Example Output
|
|
|
|
```
|
|
📈 Current Network State:
|
|
------------------------
|
|
honest_1 sees: $2498.73 (confidence: 94%, sources: 6)
|
|
honest_2 sees: $2499.15 (confidence: 94%, sources: 6)
|
|
honest_3 sees: $2498.92 (confidence: 94%, sources: 6)
|
|
honest_4 sees: $2499.31 (confidence: 94%, sources: 6)
|
|
honest_5 sees: $2498.67 (confidence: 94%, sources: 6)
|
|
byzantine_6 sees: $2499.02 (confidence: 94%, sources: 6)
|
|
byzantine_7 sees: $2498.88 (confidence: 94%, sources: 6)
|
|
|
|
📊 Network Consensus:
|
|
Average: $2498.95
|
|
Range: $2498.67 - $2499.31
|
|
Max Deviation: 0.03%
|
|
```
|
|
|
|
## Why This Matters
|
|
|
|
Traditional oracle networks require expensive consensus rounds for each price update. This demo shows how BFT-CRDTs enable:
|
|
|
|
- **No Consensus Needed**: Oracles operate independently
|
|
- **Byzantine Tolerance**: Malicious nodes can't corrupt the data
|
|
- **High Frequency**: Updates every second vs every minute
|
|
- **Lower Costs**: No consensus overhead
|
|
|
|
## Learn More
|
|
|
|
See the [full documentation](../../docs/use-case-2-oracle-networks.md) for:
|
|
- Detailed architecture
|
|
- Smart contract integration
|
|
- Production deployment guide
|
|
- Security analysis |