QuDAG DAG
DAG consensus implementation with QR-Avalanche algorithm for the QuDAG protocol.
Features
- QR-Avalanche Consensus: Quantum-resistant Byzantine fault-tolerant consensus
- Parallel Processing: Concurrent message validation and ordering
- Conflict Resolution: Automatic detection and resolution of conflicts
- Tip Selection: Intelligent parent selection algorithms
- Performance Monitoring: Real-time consensus metrics
Quick Start
Add to your Cargo.toml:
[]
= "0.1"
Examples
Basic DAG Operations
use ;
use HashSet;
async
Consensus Integration
use ;
use HashSet;
// Create a DAG consensus instance
let mut dag = new;
// Add vertices to the DAG
let vertex_id = new;
let vertex = new;
dag.add_vertex?;
// Get consensus status
if let Some = dag.get_confidence
// Get current tips
let tips = dag.get_tips;
println!;
Tip Selection
use ;
let config = TipSelectionConfig ;
let tip_selector = new;
// Use tip selector for parent selection...
Architecture
Core Components
- DAG Structure: Directed acyclic graph for message ordering
- QR-Avalanche: Quantum-resistant consensus algorithm
- Vertex Processing: Parallel validation and state management
- Conflict Detection: Automatic fork detection and resolution
- Tip Selection: Algorithms for optimal parent selection
Consensus Flow
- Message Submission: New messages are submitted to the DAG
- Parent Validation: Verify parent messages exist and are valid
- Conflict Detection: Check for conflicting transactions
- Consensus Voting: Apply QR-Avalanche voting mechanism
- Finalization: Achieve consensus finality
Performance Features
- Asynchronous Processing: Non-blocking message handling
- Parallel Validation: Concurrent vertex processing
- Optimized Data Structures: Efficient graph traversal
- Memory Management: Automatic cleanup of old data
Configuration
use ;
use Duration;
let config = ConsensusConfig ;
let dag = with_config;
Error Handling
The crate provides comprehensive error types:
DagError: Main error type for DAG operationsVertexError: Vertex-specific validation errorsConsensusError: Consensus algorithm errors
Features
optimizations: Enable performance optimizations (validation cache, traversal index)validation-cache: Enable vertex validation cachingtraversal-index: Enable graph traversal indexing
Documentation
License
Licensed under either MIT or Apache-2.0 at your option.