Object.ShardedConsensus (object v0.1.2)
Advanced Byzantine fault-tolerant consensus with sharding for AAOS.
Implements state-of-the-art consensus protocols including:
- Practical Byzantine Fault Tolerance (pBFT) with optimizations
- Sharded consensus for scalability to millions of nodes
- Fast Byzantine Paxos with pipeline optimization
- HotStuff consensus with linear communication complexity
- Cross-shard transaction coordination via atomic commit
- Verifiable secret sharing for threshold cryptography
- Asynchronous consensus with eventual delivery guarantees
- Adaptive protocol switching based on network conditions
- Zero-knowledge consensus for privacy-preserving agreement
Summary
Functions
Returns a specification to start this module under a supervisor.
Creates zero-knowledge proofs for privacy-preserving consensus.
Performs Byzantine fault detection and node reputation scoring.
Executes a cross-shard transaction with atomic guarantees.
Generates threshold signatures for enhanced security.
Initializes a new shard with specified nodes.
Proposes a new consensus value to the specified shard.
Starts the sharded consensus service.
Switches the consensus protocol based on network conditions.
Types
@type consensus_message() :: %{ type: :pre_prepare | :prepare | :commit | :view_change | :new_view | :checkpoint, view: view_number(), sequence: sequence_number(), digest: binary(), payload: term(), sender: node_id(), timestamp: non_neg_integer(), signature: binary() }
@type node_id() :: binary()
@type sequence_number() :: non_neg_integer()
@type shard_id() :: non_neg_integer()
@type shard_state() :: %{ shard_id: shard_id(), nodes: [node_id()], primary: node_id(), view: view_number(), sequence: sequence_number(), phase: non_neg_integer(), prepared_messages: %{required(sequence_number()) => consensus_message()}, committed_messages: %{required(sequence_number()) => consensus_message()}, checkpoints: %{required(sequence_number()) => binary()}, view_change_votes: %{required(view_number()) => [node_id()]}, message_log: [consensus_message()], performance_metrics: map() }
@type state() :: %{ node_id: node_id(), shards: %{required(shard_id()) => shard_state()}, shard_mapping: %{required(term()) => shard_id()}, cross_shard_transactions: %{required(binary()) => cross_shard_transaction()}, consensus_protocols: %{ current: :pbft | :hotstuff | :fast_paxos | :async_consensus, performance_history: [map()], switching_thresholds: map() }, cryptographic_state: %{ threshold_keys: %{required(shard_id()) => map()}, verifiable_shares: %{required(shard_id()) => map()}, zero_knowledge_proofs: %{required(shard_id()) => [map()]} }, network_monitor: %{ latency_matrix: [[float()]], bandwidth_matrix: [[float()]], failure_detector: map(), partition_detector: map() }, system_metrics: %{ throughput: float(), latency: float(), byzantine_detection_rate: float(), cross_shard_success_rate: float() } }
@type threshold_signature() :: %{ signature_shares: %{required(node_id()) => binary()}, threshold: non_neg_integer(), combined_signature: binary() | nil, message_hash: binary() }
@type view_number() :: non_neg_integer()
Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
Creates zero-knowledge proofs for privacy-preserving consensus.
Performs Byzantine fault detection and node reputation scoring.
Executes a cross-shard transaction with atomic guarantees.
@spec generate_threshold_signature(shard_id(), binary()) :: {:ok, threshold_signature()} | {:error, term()}
Generates threshold signatures for enhanced security.
Initializes a new shard with specified nodes.
Proposes a new consensus value to the specified shard.
Starts the sharded consensus service.
Switches the consensus protocol based on network conditions.