$ show Adamant-im/pool
ADAMANT Forging Pool is a blockchain service that calculates and distributes delegate voter rewards on the ADAMANT network. It consists of a Node.js/Express backend that processes forged blocks, computes voter rewards, handles scheduled payouts, and maintains MongoDB storage for blocks, voters, and transactions. The system features a Svelte/Vite web dashboard for monitoring pool status and voter rewards, plus a control CLI (`adm-pool`) for managing encrypted passphrases. Key security features include operator-encrypted passphrases, input validation to prevent NoSQL injection, and secret-free health monitoring. The architecture follows a modular design with clear separation between API handling, business logic, data storage, and external integrations.
The LLM identified 4 files worth highlighting for reuse:
Implements secure passphrase encryption using scrypt key derivation and AES-256-GCM with authentication. Provides deterministic encrypted blob detection via prefix, operator password-based decryption with public key verification, and tamper detection. Demonstrates strong cryptographic practices suitable for extraction as a reusable secrets management library.
Provides secure password prompting that masks input in terminals while properly handling non-TTY cases (piped input). Manages terminal raw mode, input buffering, interrupt signals (Ctrl-C), and backspace/delete handling. Represents a robust, reusable pattern for secure CLI credential extraction applicable to any command-line tool.
Contains critical validation functions like `isAdmAddress` that validate ADM address format and prevent NoSQL injection by rejecting non-string values before they reach database queries. Includes additional utilities for date/number formatting and epoch conversion. Demonstrates important defensive programming practices for blockchain applications where untrusted node responses must be validated.
Manages passphrase state machine with plain/encrypted modes and locked/unlocked states using Node.js EventEmitter. Ensures decrypted passphrase exists only in memory when unlocked, emits events on state changes, and provides secure access to credentials for signing operations. Represents a clean, reusable pattern for applications requiring encrypted credential handling with operator authentication.