How status-im/nimbus-eth2 works
Main Components
a) Core Components:
• Beacon Node (beacon_chain/beacon_node.nim)
• Validator Client (beacon_chain/validator_client/)
• Light Client (beacon_chain/light_client.nim)
• Database Layer (beacon_chain/beacon_chain_db*.nim)
b) Consensus Components:
• Fork Choice Implementation (beacon_chain/fork_choice/)
• State Transition Logic (beacon_chain/spec/state_transition*.nim)
• Block Processing (beacon_chain/gossip_processing/)
• Attestation Pool (beacon_chain/consensus_object_pools/attestation_pool.nim)
c) Network Layer:
• P2P Networking (beacon_chain/networking/)
• Discovery Protocol (eth2_discovery.nim)
• Gossip Protocol (gossip_processing/)
• REST API (beacon_chain/rpc/)
d) External Interfaces:
• Execution Layer Interface (beacon_chain/el/)
• Key Management System
• Metrics and Monitoring
Relationship Flows
a) Data Flow:
External Network <-> Network Layer <-> Consensus Layer <-> Database
• <-> State Processing
• <-> Fork Choice
b) Client Interactions:
Validator Client <-> Beacon Node <-> Execution Layer
Light Client <-> Beacon Node
Component Details
• Core Services (rectangles, blue)
• Network Components (hexagons, green)
• Processing Units (rounded rectangles, orange)
• External Interfaces (clouds, gray)
Specific Implementation Notes
a) Specialized subsystems:
• Slashing Protection (validators/slashing_protection/)
• Sync Committee Management (consensus_object_pools/sync_committee_msg_pool.nim)
• Block DAG Management (consensus_object_pools/block_dag.nim)
b) Configuration points:
• Network Preset Configurations
• Chain Specification Parameters
• Validator Management Options
Architectural Patterns
Following patterns:
• Event-driven architecture for consensus
• Pipeline processing for blocks and attestations
• Modular design with clear component separation
• Concurrent processing capabilities
System Boundaries
Clearly delineate:
• Internal vs. External Components
• Trust Boundaries
• Network Interfaces
• Storage Boundaries
Additional Elements
Annotations for:
• Version compatibility
• Fork support (Phase 0, Altair, Bellatrix, etc.)
• Scaling considerations
• Resource optimization points
External system interfaces
Use a hierarchical layout with:
• Top level: External interfaces
• Middle level: Core processing
• Bottom level: Storage and persistence
This design should reflect both the current implementation and extension points for future development, while maintaining clarity about the system's primary purpose as a resource-efficient consensus client.