How hiero-ledger/hiero-block-node works
• server – the main block node implementation (core service and API exposure)
• simulator – a local test environment to simulate block stream data
• common – a shared module for utilities, constants, and common types
• suites – e2e tests for verifying functionality
• tools – command line utilities for managing and processing block stream files
Main Components
a. Block Node Server:
– Contains the core application (e.g., BlockNodeApp, Server, configuration modules).
– Handles block consumption, stream mediation, persistence, verification, and health monitoring.
b. Simulator:
– A separate module to mimic block stream input.
– Interfaces with the server for testing and simulation.
c. Common Utilities:
– Contains shared classes (e.g., hashing utilities, file utilities, constants) that support both the server and simulator.
d. Messaging & Communication:
– Modules and packages related to messaging (consumer/producer and notifiers) which coordinate block notifications and events.
e. Persistence & Storage:
– Responsible for archiving blocks, reading and writing blocks (e.g., local file persistence, compression, storage path resolution).
f. Verification:
– Handles block and signature verification.
g. Operational & Deployment Artifacts:
– Dockerfiles, Helm charts, and configuration files that indicate containerized deployment.
h. Test Suites & Tools:
– Automated tests (suites) and command line tools (tools) for working with block stream files.
Mapping the Relationships
a. Data Flow:
– Blocks are received from external block stream sources (or simulated by the Simulator module).
– The Server module consumes these streams, processes block data, routes them through the verification, persistence, and notification components.
– The Messaging submodule likely facilitates asynchronous communication between producers/consumers.
b. Internal Interactions:
– The configuration and logging modules initialize and monitor the system.
– Persistence components work together to store block data reliably.
– Notifiers and metrics modules expose operational insights.
– Verification components check block integrity before further processing.
c. External & Deployment Layers:
– Docker and Helm charts indicate that the system is containerized.
– APIs exposed by the server connect to external clients or other microservices within the Hiero ecosystem.
Architectural Patterns & Design Principles
a. Modular Design:
– Each module (server, simulator, common, etc.) is clearly separated for distinct responsibilities.
b. Dependency Injection:
– Multiple “InjectionModule” files suggest use of dependency injection for flexible module configuration.
c. Layered Architecture:
– There’s a clear separation between core processing (block handling, persistence, verification), configuration/logging, and external interfaces (APIs, Docker deployments).
d. Testing:
– The suites folder contains thorough end-to-end and integration tests, reinforcing a design focused on resiliency.
Technologies, Frameworks, and Tools
a. Java 21 as the main programming language.
b. Gradle for project build and dependency management.
c. Docker and Helm charts for container orchestration and deployment.
d. gRPC (as seen in the “grpc” directories) for service communication.
e. Libraries that handle streaming, file compression and storage (e.g., ZstdCompression, NoOp implementations for different storage strategies).
Additional Elements to Emphasize
c. If possible, add annotations for important design decisions (like dependency injection or the separation between synchronous and asynchronous processing).