Expand description
DAG consensus implementation with QR-Avalanche algorithm.
This module provides the core DAG (Directed Acyclic Graph) implementation with quantum-resistant consensus using a modified Avalanche protocol.
§Key Types
QrDag- Main DAG consensus implementation (alias forDAGConsensus)Vertex/VertexId- DAG vertices and their identifiersConsensus/QRAvalanche- Consensus algorithms and implementationsGraph- High-performance graph data structure with cachingNode- Node representation with state managementTipSelection- Algorithms for choosing vertices to extend
§Example Usage
use qudag_dag::{QrDag, Vertex, VertexId, ConsensusConfig};
use std::collections::HashSet;
// Create a new DAG consensus instance
let mut dag = QrDag::new();
// Add a message to the DAG
let message = b"Hello, DAG!".to_vec();
dag.add_message(message.clone()).expect("Failed to add message");
// Check if the message exists
assert!(dag.contains_message(&message));
// Get current tips
let tips = dag.get_tips();
println!("Current tips: {:?}", tips);
// Create a vertex directly
let vertex_id = VertexId::new();
let vertex = Vertex::new(vertex_id, b"vertex data".to_vec(), HashSet::new());
dag.add_vertex(vertex).expect("Failed to add vertex");Re-exports§
pub use edge::Edge;pub use error::DagError;pub use graph::Graph;pub use graph::GraphMetrics;pub use graph::StorageConfig;pub use node::Node;pub use node::NodeState;pub use node::SerializableHash;pub use consensus::Confidence;pub use consensus::Consensus;pub use consensus::ConsensusError;pub use consensus::ConsensusMetrics;pub use consensus::ConsensusStatus;pub use consensus::QRAvalanche;pub use consensus::QRAvalancheConfig;pub use consensus::VotingRecord;pub use dag::Dag;pub use dag::DagError as DagModuleError;pub use dag::DagMessage;pub use tip_selection::AdvancedTipSelection;pub use tip_selection::ParentSelectionAlgorithm;pub use tip_selection::TipSelection;pub use tip_selection::TipSelectionConfig;pub use tip_selection::TipSelectionError;pub use tip_selection::VertexWeight;pub use vertex::Vertex;pub use vertex::VertexError;pub use vertex::VertexId;pub use vertex::VertexOps;
Modules§
- consensus
- Consensus algorithms and voting mechanisms for the DAG DAG consensus implementation with QR-Avalanche algorithm.
- dag
- Core DAG data structure and message processing
- edge
- Edge representation for DAG connections
- error
- Error types for DAG operations
- graph
- High-performance graph data structure with caching
- node
- Node representation with state management
- tip_
selection - Tip selection algorithms for choosing vertices to extend DAG tip selection implementation.
- vertex
- Vertex representation and operations for the DAG structure DAG vertex implementation.
Structs§
- Consensus
Config - Configuration for DAG consensus algorithm
- DAGConsensus
- Main DAG consensus implementation for test compatibility