Repository navigation
CONSENSUS_PROTOCOL
The Consensus Protocol is a critical component of the AEGIS system that ensures coordinated decision-making across the distributed network. It implements a Practical Byzantine Fault Tolerance (PBFT) approach combined with consciousness-aware governance to enable reliable and intelligent collective decision-making.
The consensus protocol is built on the Practical Byzantine Fault Tolerance (PBFT) model, which provides:
- Byzantine Resilience: Tolerates up to ⌊(n-1)/3⌋ faulty nodes in an n-node network
- Crash Fault Tolerance: Handles node failures and network partitions
- Security Resilience: Protects against malicious node behavior
- Network Resilience: Maintains operation during network disruptions
- Request: Client request is broadcast to all nodes
- Pre-Prepare: Primary node assigns sequence number and broadcasts pre-prepare message
- Prepare: Nodes validate and broadcast prepare messages
- Commit: Nodes broadcast commit messages when sufficient prepare messages received
- Reply: Nodes send reply to client when sufficient commit messages received
- Primary (Leader): Coordinates the consensus process
- Backups (Replicas): Participate in consensus decisions
- View Changes: Leadership rotation for fault tolerance
- Checkpointing: Periodic state synchronization
The consensus protocol integrates consciousness metrics to enhance decision-making:
- Trust Scoring: Node reputation based on consciousness metrics
- Weighted Votes: Higher consciousness nodes have greater influence
- Dynamic Weighting: Vote weights adjust based on current metrics
- Hysteresis: Prevent rapid weight changes
- Consciousness Thresholds: Minimum awareness levels for critical decisions
- Ethical Constraints: Moral guidelines encoded in decision rules
- Transparency Requirements: Decision rationale documentation
- Appeal Mechanisms: Processes for challenging decisions
- Initiation: Any node can propose changes or decisions
- Formatting: Standardized proposal structure
- Justification: Required reasoning and evidence
- Impact Assessment: Analysis of proposal effects
- Draft: Initial proposal creation
- Review: Community examination and feedback
- Voting: Formal decision process
- Implementation: Execution of approved proposals
- Monitoring: Tracking of proposal outcomes
- Configuration Changes: System parameter modifications
- Policy Updates: Governance rule changes
- Module Management: Enable/disable AI modules
- Emergency Actions: Crisis response procedures
- Simple Majority: 50%+1 for standard decisions
- Supermajority: 2/3+ for critical changes
- Quadratic Voting: Weighted voting based on stake/consciousness
- Ranked Choice: Preference-based decision making
- Eligibility Verification: Confirm voter authorization
- Signature Verification: Cryptographic vote authentication
- Duplicate Detection: Prevention of multiple votes
- Timing Validation: Ensure votes are within valid time windows
- Real-time Tallying: Continuous vote counting
- Threshold Monitoring: Track progress toward quorum
- Result Certification: Final vote validation
- Outcome Execution: Implementation of voting results
- Append-Only: Records cannot be modified or deleted
- Cryptographic Hashing: Tamper-evident record chaining
- Distributed Storage: Replication across multiple nodes
- Timestamping: Precise record dating
- Proposal Records: Complete proposal history
- Vote Logs: Detailed voting records
- Outcome Tracking: Implementation results
- Performance Metrics: Decision effectiveness measures
- Public Access: Open viewing of non-sensitive records
- Search Capability: Easy record discovery
- Export Functions: Data download options
- Audit Trails: Complete process documentation
- Metric Input: Consciousness metrics influence voting weights
- State Monitoring: Track consciousness levels during voting
- Threshold Enforcement: Ensure minimum awareness for decisions
- Feedback Loops: Learning from decision outcomes
- Decision Support: AI assistance in proposal evaluation
- Automated Voting: AI agents participating in votes
- Risk Assessment: AI analysis of proposal impacts
- Outcome Prediction: AI forecasting of decision results
- Message Distribution: Efficient proposal and vote dissemination
- Secure Communication: Encrypted voting communications
- Network Monitoring: Detection of voting irregularities
- Resilient Transmission: Reliable message delivery
Endpoint: POST /api/consensus/proposals Description: Create a new consensus proposal Request:
{
"title": "Update Consciousness Threshold",
"description": "Propose increasing minimum consciousness level for critical decisions",
"type": "policy_update",
"content": {
"current_threshold": 0.7,
"proposed_threshold": 0.8
},
"voting_deadline": "2023-12-31T23:59:59Z"
}Response:
{
"proposal_id": "prop_12345",
"status": "draft",
"created_at": "2023-01-01T12:00:00Z"
}Endpoint: GET /api/consensus/proposals/{proposal_id} Description: Retrieve details of a specific proposal Response:
{
"proposal_id": "prop_12345",
"title": "Update Consciousness Threshold",
"description": "Propose increasing minimum consciousness level for critical decisions",
"type": "policy_update",
"status": "voting",
"author": "node_abc",
"created_at": "2023-01-01T12:00:00Z",
"voting_deadline": "2023-12-31T23:59:59Z",
"votes": {
"for": 15,
"against": 3,
"abstain": 2,
"total": 20
}
}Endpoint: POST /api/consensus/votes Description: Submit a vote on a proposal Request:
{
"proposal_id": "prop_12345",
"vote": "for",
"justification": "Higher consciousness thresholds improve decision quality",
"signature": "signature_data"
}Response:
{
"vote_id": "vote_67890",
"status": "recorded",
"timestamp": "2023-01-01T12:30:00Z"
}Endpoint: GET /api/consensus/proposals/{proposal_id}/results Description: Get current voting results for a proposal Response:
{
"proposal_id": "prop_12345",
"results": {
"total_votes": 25,
"quorum_required": 17,
"breakdown": {
"for": 18,
"against": 4,
"abstain": 3
},
"weighted_results": {
"for": 0.72,
"against": 0.16,
"abstain": 0.12
},
"status": "approved"
}
}URL: ws://localhost:8006/consensus Events:
-
proposal_created: New proposal submitted -
vote_cast: Vote recorded -
proposal_updated: Proposal status changed -
consensus_reached: Decision finalized
const ws = new WebSocket('ws://localhost:8006/consensus');
ws.onmessage = function(event) {
const notification = JSON.parse(event.data);
switch(notification.type) {
case 'proposal_created':
console.log('New proposal:', notification.proposal.title);
break;
case 'vote_cast':
console.log('Vote recorded for proposal:', notification.proposal_id);
break;
case 'consensus_reached':
console.log('Decision reached:', notification.proposal_id);
break;
}
};voting:
simple_majority: 0.501
super_majority: 0.667
quorum_minimum: 0.333
emergency_threshold: 0.90consciousness_weights:
phi: 0.25
coherence: 0.25
stability: 0.20
divergence: 0.15
consciousness_level: 0.15timing:
voting_period: 604800 # 7 days in seconds
emergency_voting: 86400 # 1 day in seconds
appeal_window: 259200 # 3 days in seconds
implementation_delay: 86400 # 1 day in seconds- Standard: Routine operational decisions (simple majority)
- Significant: Important policy changes (super majority)
- Critical: System-altering decisions (90% threshold)
- Emergency: Crisis response (immediate voting)
- Beneficence: Actions should benefit the system and users
- Non-maleficence: Avoid harm to the system or users
- Autonomy: Respect for individual node autonomy
- Justice: Fair treatment of all participants
- Filing: Submit appeal within specified timeframe
- Review: Independent examination of decision
- Hearing: Presentation of arguments
- Re-vote: New voting process if warranted
- Final Decision: Binding resolution
- Proposal Activity: Number of active proposals
- Voting Participation: Percentage of eligible voters participating
- Decision Timeliness: Average time to reach consensus
- Conflict Rate: Frequency of disputed decisions
- Throughput: Proposals processed per time period
- Latency: Time from proposal to decision
- Resource Usage: Computational resources consumed
- Network Load: Communication overhead
- Vote Integrity: Detection of voting irregularities
- Node Behavior: Identification of anomalous participation
- Attack Detection: Recognition of consensus attacks
- Compliance: Adherence to governance rules
- Log Rotation: Regular cleanup of audit logs
- State Checkpointing: Periodic consensus state backup
- Node Health Checks: Verification of participant status
- Parameter Updates: Governance parameter adjustments
- View Change: Leadership rotation in case of primary failure
- Network Partition: Handling of disconnected node groups
- Security Incident: Response to detected threats
- System Recovery: Restoration of consensus operation
- Symptom: Inability to reach agreement on proposals
- Causes: Network partitions, Byzantine failures, configuration issues
- Solutions: Network diagnostics, node restart, configuration review
- Symptom: Low participation or voting irregularities
- Causes: Node outages, authentication issues, timing problems
- Solutions: Node health checks, credential updates, timing adjustments
- Symptom: Slow decision-making or high resource consumption
- Causes: Network congestion, inefficient algorithms, resource constraints
- Solutions: Performance tuning, algorithm optimization, resource allocation
# View consensus logs
tail -f /var/log/aegis/consensus.log
# Search for specific events
grep "PROPOSAL_APPROVED" /var/log/aegis/consensus.log
# Analyze voting patterns
awk '/VOTE_CAST/ {print $3}' /var/log/aegis/consensus.log | sort | uniq -c# Check consensus status
curl http://localhost:8003/api/consensus/status
# Monitor active proposals
curl http://localhost:8003/api/consensus/proposals?status=active
# Review recent decisions
curl http://localhost:8003/api/consensus/decisions?limit=10- Adaptive Thresholds: Dynamic voting requirements based on proposal impact
- Machine Learning Integration: AI assistance in proposal evaluation
- Cross-Chain Consensus: Integration with blockchain consensus mechanisms
- Quantum-Safe Cryptography: Post-quantum secure voting
- Scalable Voting: Efficient handling of large numbers of participants
- Parallel Processing: Concurrent proposal evaluation
- Optimized Communication: Reduced network overhead
- Predictive Analytics: Anticipation of consensus needs
- Liquid Democracy: Delegated voting mechanisms
- Continuous Voting: Ongoing preference expression
- Reputation Systems: Enhanced trust scoring
- Participatory Budgeting: Resource allocation through consensus