Node Sync System

Nimiq implements a two-phase synchronization architecture that separates epoch-level state synchronization from real-time block processing. This design enables efficient sync strategies tailored to different node capabilities.

All nodes follow a two-phase synchronization pattern: macro sync followed by live sync. During macro sync, nodes download and verify macro blocks (checkpoints/epochs) to reach the current network state efficiently. Once macro sync completes, nodes transition to live sync to receive and validate the latest micro blocks in real-time. This modular approach allows each node type to optimize for its specific use case.

Sync Comparison Table

History NodeFull NodeLight NodePico Node
VerificationEntire historyFull blocks and uses ZKPUses ZKPsNo ZKPs
Macro Sync MethodHistory Macro SyncLight Macro SyncLight Macro SyncPico Macro Sync*
Live Sync MethodBlock Live SyncState Live SyncBlock Live SyncBlock Live Sync
Consensus LevelFully verifiedVerifiedVerifiedTrust-based
FallbackN/AN/AN/A*Falls back to Light Macro Sync
Sync SpeedSlower, full chain from genesisEfficient, grows with chain lengthFast, includes proof verificationFaster, based on peer responses
Web ClientNot supportedNot supportedSupportedSupported

History Nodes

  • Complete blockchain history from genesis
  • Deep chain queries, historical analysis, and serving data to other nodes
  • Can act as validators and provide historical data to the network
  • Serve data to other nodes, generate and verify ZKPs, validate transactions and produce blocks (if validator)
  • Can serve as prover nodes (ZKP generation) and validators
  • Rely on other history nodes for initial sync

Full Nodes

  • Complete current state with pruned history - maintains full validation capability
  • Serve data to other nodes, generate and verify ZKPs, validate transactions and produce blocks (if validator)
  • Can serve as prover nodes (ZKP generation) and validators
  • Rely on full or history nodes for initial sync

Light Nodes

  • Latest election block with ZKP and subsequent micro block headers only
  • Transaction verification and sending with cryptographic security guarantees
  • Browser/mobile deployment, web client integration (WASM support)
  • Rely on full or history nodes for data availability and ZKP proofs

Pico Nodes

  • Sync with the latest election block only (no historical data or ZKP verification)
  • Ultra-fast startup with trust-based consensus and automatic fallback to secure sync
  • Development environments, testing, and trusted network scenarios
  • Rely on full or history nodes for data availability and fallback verification

Service Nodes

Prover Nodes: Generate zero-knowledge proofs for light and full node sync. Require significant computational resources.

Validator Nodes: Produce blocks and participate in consensus. Any node with a minimum of 100'000 NIM deposit that runs a full or history client can become a validator.

Architecture Components

Coordination Layer: Consensus and Syncer components manage sync lifecycle and peer relationships, enabling seamless transitions between sync phases.

Pluggable Strategies: MacroSync and LiveSync trait implementations allow optimization for different resource constraints.

Network Layer: Request/response and gossip protocols with async streams for efficient concurrent peer processing.

Queue Architecture: Automatic peer rotation, retry logic, and backpressure control ensure reliable data retrieval.

Further Reading

Understanding the System

Implementation Details

Sync Strategy Deep Dives

Macro Sync Strategies:

Live Sync Strategies:

Sync Lifecycle

When a node starts, it follows this coordination pattern:

  1. Peer Discovery through the network layer
  2. Macro Sync Strategy Sync based on node configuration
  3. Live Sync Transition to maintain real-time synchronization
  4. Consensus Detection through peer agreement analysis

The Consensus component orchestrates this process, while the Syncer manages strategy-specific implementations through pluggable trait interfaces.

Developer Focus

This documentation targets developers working on sync logic and node implementations.

For node operation, see the Node Setup Guide.

Built with the Nimiq Vitepress Theme
Copy page
Create issue