# priyanshu-sagar/seedphrasechecker architecture

> Architecture diagram of the GitHub repository priyanshu-sagar/seedphrasechecker, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/priyanshu-sagar/seedphrasechecker
- Repository: https://github.com/priyanshu-sagar/seedphrasechecker

## Overview

##### Main Components
- Node.js CLI Application: This is the core runtime that triggers the seed phrase checking process.
- Seed Phrase Validation Module: Incorporated in the main script (checkSeedPhrases.js) to verify that seed phrases conform to BIP-39.
- Wallet Balance Retrieval Module: This interacts with the external Ethereum network via the Infura API to fetch token balances.
- Infura API Integration: An external service component; include a note that the API key is loaded securely from a .env file.
- Mnemonic Generation Module: Represented by mnemonicGenerator.js, this component is responsible for generating and saving random mnemonic phrases (e.g., to phrase.txt).
- API Key Verification Module: Shown by verifyInfuraKey.js, it ensures that the provided Infura API key is valid via network connectivity tests.
- Logging Module: Results are captured in a CSV format (results.csv) with headers for wallet phrase, wallet address, and each token balance.
- Configuration/Setup: Include package.json and build config files as supporting artifacts that manage dependencies and possibly build processes.

##### Relationships and Interactions
- The primary flow starts in checkSeedPhrases.js, which first processes input seed phrases.
- It calls the Seed Phrase Validation Module; if the phrase is valid then the Wallet Balance Retrieval Module is triggered.
- The Wallet Balance Retrieval Module communicates with the Ethereum blockchain through Infura using the API key from the .env file.
- If a wallet has a non-zero balance, the process halts and displays the seed phrase, wallet address, and token balances.
- The Mnemonic Generation Module (mnemonicGenerator.js) operates as a utility that can be run to generate seed phrases, writing them to a text file.
- The API Key Verification Module (verifyInfuraKey.js) is used to ensure that the connection settings with Infura are correct before processing.
- Results Flow: Before terminating, the application logs batch processed outputs into results.csv.

##### Highlighted Architectural Patterns and Principles
- Modular Structure: Each script (validation, API key check, mnemonic generation) is clearly separated, ensuring single responsibility.
- External Integration: Use of Infura for blockchain connectivity emphasizes a decoupled approach; note the secure handling of API keys.

##### Relevant Technologies & Libraries
- Node.js environment and npm for dependency management.
- BIP-39 libraries for seed phrase validation.
- Infura integration, which connects the application to the Ethereum blockchain.
- CSV file handling for result storage.

##### Final Touches
- Directional dependencies are clear, showing how each module is activated and how data (such as seed phrases and token balances) flows through the system.

Happy diagramming!

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Main Process
    A["Node.js CLI Application: checkSeedPhrases.js"]:::cli
    B["Seed Phrase Input"]:::module
    C["BIP-39 Validation Module"]:::module
    D["Wallet Balance Retrieval Module"]:::module
    E["Infura API Integration (uses .env for API key)"]:::external
    F["Ethereum Network"]:::external
    G["Console Output (Color-Coded: pink for ETH/BUSD, green for USDT/SHIB)"]:::output
    H["Results Logging (results.csv)"]:::logging

    %% Auxiliary Utilities
    I["Mnemonic Generator: mnemonicGenerator.js"]:::utility
    J["API Key Verification Module: verifyInfuraKey.js"]:::utility

    %% Configuration
    K["Configuration/Setup: package.json & build/config.gypi"]:::config

    %% Process Flow Connections
    A -->|"reads seed phrases"| B
    B -->|"triggers"| C
    C -->|"if valid, initiates"| D
    D -->|"queries using Infura API key"| E
    E -->|"connects to"| F
    D -->|"on non-zero balance logs to"| H
    D -->|"outputs balance details to"| G

    %% Auxiliary connections back to main system
    A -->|"utilizes"| I
    A -->|"verifies API key with"| J
    A -->|"bootstrapped by"| K

    %% Click Events
    click A "https://github.com/priyanshu-sagar/seedphrasechecker/blob/main/checkSeedPhrases.js"
    click I "https://github.com/priyanshu-sagar/seedphrasechecker/blob/main/mnemonicGenerator.js"
    click J "https://github.com/priyanshu-sagar/seedphrasechecker/blob/main/verifyInfuraKey.js"
    click H "https://github.com/priyanshu-sagar/seedphrasechecker/blob/main/result.csv"
    click K "https://github.com/priyanshu-sagar/seedphrasechecker/blob/main/package.json"

    %% Style Definitions
    classDef cli fill:#FAD7A0,stroke:#D35400,stroke-width:2px;
    classDef module fill:#AED6F1,stroke:#2874A6,stroke-width:2px;
    classDef external fill:#F9E79F,stroke:#B7950B,stroke-width:2px, stroke-dasharray: 5,5;
    classDef output fill:#A9DFBF,stroke:#229954,stroke-width:2px;
    classDef logging fill:#F9E79F,stroke:#AF601A,stroke-width:2px;
    classDef utility fill:#D5F5E3,stroke:#27AE60,stroke-width:2px;
    classDef config fill:#D6EAF8,stroke:#2E86C1,stroke-width:2px;
```
