Daemon Node Management

Purpose

Daemon Node Management addresses the critical need to reliably run and maintain blockchain node daemons for various supported blockchains within the platform. These daemons serve as the foundational layer that maintains blockchain synchronization, exposes RPC interfaces, and publishes real-time blockchain events. This subtopic ensures that each blockchain node service starts correctly, handles termination gracefully, and provides health status signals for Kubernetes to monitor synchronization and readiness.

Functionality

The core workflows revolve around the lifecycle management of blockchain daemon processes via shell scripts, tailored for each blockchain's node client. These scripts perform the following key functions:

Example Workflow for Starting and Stopping a Daemon (Litecoin)

start_coin() {
  litecoind \
    -rpcuser=user \
    -rpcpassword=password \
    -rpcallowip=0.0.0.0/0 \
    -rpcbind=0.0.0.0 \
    -rpcport=8332 \
    -datadir=/data \
    -printtoconsole=1 \
    -server=1 \
    -nolisten=1 \
    -txindex=1 \
    -disablewallet=1 \
    -zmqpubhashtx=tcp://127.0.0.1:28332 \
    -zmqpubhashblock=tcp://127.0.0.1:28332 &
  PID="$!"
}

stop_coin() {
  kill $PID
  while kill -0 $PID 2>/dev/null; do sleep 1; done
}

trap 'stop_coin' TERM INT

start_coin
wait $PID

This script launches the daemon in the background, captures its PID, and waits for termination signals to trigger a clean shutdown.

Integration and Relationship

Daemon Node Management integrates tightly with the parent topic of Multi-Blockchain Coinstacks by providing the blockchain-specific node processes that the higher-level services depend on:

This subtopic complements other subtopics like Indexer Services and API Servers by ensuring the blockchain node daemons are robustly managed and always available as the source of truth for blockchain state.

Diagram

flowchart TD
    Start[Container Start] --> InitScripts[Run Daemon init.sh Script]
    InitScripts --> StartDaemon[Launch Blockchain Daemon Process]
    StartDaemon --> WaitPID[Wait for Daemon Process]
    WaitPID -->|SIGTERM / SIGINT Received| StopDaemon[Invoke Stop Function]
    StopDaemon --> GracefulShutdown[Gracefully Terminate Daemon]
    GracefulShutdown --> Exit[Exit Container]

This flowchart visualizes the lifecycle management process inside each daemon container, highlighting startup, signal trapping, and graceful shutdown.


By encapsulating daemon lifecycle management in dedicated scripts with chain-specific configurations, the system achieves modularity, consistency, and resilience across diverse blockchain node implementations.