Object.ByzantineFaultTolerance (object v0.1.2)
Byzantine fault tolerance mechanisms for the Object P2P network.
Implements various algorithms and strategies to handle malicious nodes including Sybil attack resistance, consensus protocols, reputation systems, and proof-of-work challenges.
Features
- PBFT-inspired consensus for critical operations
- Reputation-based trust system
- Proof-of-work for Sybil resistance
- Merkle tree verification for data integrity
- Threshold signatures for group decisions
- Audit trails and accountability
Summary
Functions
Issues a proof-of-work challenge to a node.
Returns a specification to start this module under a supervisor.
Gets the current reputation of a node.
Checks if a node is trustworthy based on reputation.
Submits a challenge response.
Initiates Byzantine consensus for a value.
Starts the Byzantine fault tolerance service.
Updates reputation based on interaction outcome.
Verifies data integrity using Merkle proofs.
Votes in a consensus round.
Types
@type challenge() :: %{ challenger: binary(), challenged: binary(), type: :proof_of_work | :data_availability | :computation, challenge_data: term(), issued_at: DateTime.t(), expires_at: DateTime.t() }
@type consensus_round() :: %{ id: binary(), proposer: binary(), value: term(), phase: :prepare | :commit | :complete | :aborted, votes: %{prepare: MapSet.t(), commit: MapSet.t()}, participants: MapSet.t(), started_at: DateTime.t(), timeout_at: DateTime.t() }
@type merkle_tree() :: %{ root: binary(), height: non_neg_integer(), nodes: %{required(non_neg_integer()) => [binary()]} }
@type node_reputation() :: %{ node_id: binary(), reputation: float(), interactions: non_neg_integer(), successful: non_neg_integer(), failed: non_neg_integer(), last_updated: DateTime.t(), proof_of_work: binary() | nil, violations: [violation()] }
@type state() :: %{ node_id: binary(), reputations: %{required(binary()) => node_reputation()}, consensus_rounds: %{required(binary()) => consensus_round()}, pending_challenges: %{required(binary()) => challenge()}, audit_log: [audit_entry()], merkle_tree: merkle_tree(), config: map() }
@type violation() :: %{ type: :double_spend | :invalid_signature | :protocol_violation | :dos_attack, timestamp: DateTime.t(), evidence: term() }
Functions
@spec challenge_node(binary(), :proof_of_work | :data_availability) :: {:ok, binary()} | {:error, term()}
Issues a proof-of-work challenge to a node.
Returns a specification to start this module under a supervisor.
See Supervisor
.
Gets the current reputation of a node.
Checks if a node is trustworthy based on reputation.
Submits a challenge response.
Initiates Byzantine consensus for a value.
Starts the Byzantine fault tolerance service.
Updates reputation based on interaction outcome.
Verifies data integrity using Merkle proofs.
Votes in a consensus round.