# ursisterbtw/hash_hunter architecture

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

- Interactive diagram: https://gitdiagram.com/ursisterbtw/hash_hunter
- Repository: https://github.com/ursisterbtw/hash_hunter

## Overview

##### Project Type and Purpose
- This is an open-source, dual-language (Rust & Python) CLI tool for generating Ethereum vanity addresses.
- It includes a proof-of-concept core generator, helper utilities (scoring, notifications, linting), an orchestration layer, cloud deployment recipes, and CI/CD pipelines.

##### File Structure Analysis
- Top-level implementations:
- src/main.rs (Rust CLI entrypoint)
- src/main.py (Python CLI entrypoint)
- Core utility modules:
- wallet_scoring.py (rarity scoring)
- notifications.py (alerts, e.g., email/webhook)
- linter.py (pattern validation or code checks)
- orchestrator.py (task dispatching, multi-node support)
- Config & Deployment:
- cloud_methods/docker_swarm & /railway (Docker Swarm & Railway deployment scripts)
- Dockerfile, docker-compose.yml, .devcontainer (local container dev)
- wasm/ (WebAssembly spec & containerization)
- CI/CD & Testing:
- .github/workflows (Rust, Python, Docker build & test jobs)
- benchmark.rs, rust_tests.rs, test_python.py
- Project metadata:
- Cargo.toml, requirements.txt, README.md

##### Key README Insights
- Two parallel implementations maximize CPU utilization and support multi-threading/multi-processing.
- Features include pattern‐based search, checksum support, entropy & crack‐time estimation, file output on match.
- Encourages cloud deployment and contributions; MIT license.

##### Components
a. Core Components
1. Rust CLI Module (main.rs + salty_sailor crate)
2. Python CLI Module (main.py + Cython binding in main.pyx)
3. Pattern Matching Engine (shared concept; implemented independently in each)
4. Utility Services:
– Wallet Scoring Service
– Notification Service
– Lint/Validation Service
5. Orchestrator Service (task distribution, pooling, cloud coordination)
6. WASM Component (spec.rs, container for browser or FaaS)
b. Infrastructure & Deployment
1. Local Containers (.devcontainer, Dockerfile, docker-compose.yml)
2. Cloud Deployments (Docker Swarm, Railway scripts & configs)
3. CI/CD Pipelines (GitHub Actions)
c. External Systems
1. Docker Registry
2. Railway Cloud Platform
3. Docker Swarm Managers & Workers
4. (Optional) Notification Endpoints (Slack, Email, Webhook)

##### Relationships & Interactions
- CLI Module → invokes Pattern Matching Engine → calls Wallet Scoring → on match invokes Notification Service → writes wallet file to disk.
- Orchestrator Service ↔ CLI Module: spawns multiple CLI instances across containers or cloud nodes.
- Orchestrator Service → uses cloud_methods scripts to spin up Docker Swarm or Railway instances.
- WASM Component can be invoked by Orchestrator or embedded in FaaS for browser‐side proof‐of‐concept.
- CI/CD ← monitors repo commits, builds Docker images, runs Rust & Python tests/benchmarks.

##### Architectural Patterns & Principles
- Separation of Concerns: distinct modules for generation, scoring, notifications, orchestration.
- Polyglot Implementation: two parallel codepaths in Rust & Python for performance vs ergonomics.
- Modular Deployment: containerize each component, deploy on diverse environments.
- Extensibility Points: utility services and orchestrator can be replaced or extended (e.g., new notification channels).

##### Detailed Elements to Capture
- Both Rust and Python entrypoints as separate yet functionally equivalent components.
- Utility modules as shared services behind the engine.
- The orchestrator’s ability to scale horizontally via Docker Swarm or Railway.
- WASM component as a tertiary delivery mechanism.
- CI/CD pipelines and devcontainer workflows feeding into container builds and deployments.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Application Components
    subgraph "Application Components"
        RustCLI["Rust CLI Module"]:::app
        PythonCLI["Python CLI Module"]:::app
        PatternRust["Pattern Engine (Rust)"]:::app
        PatternPy["Pattern Engine (Python)"]:::app
        Scoring["Wallet Scoring Service"]:::app
        Notif["Notification Service"]:::app
        Lint["Lint/Validation Service"]:::app
        Orch["Orchestrator Service"]:::orch
        WASM["WASM Component"]:::app
    end

    %% Infrastructure & Deployment
    subgraph "Infrastructure & Deployment"
        LocalCont["Local Containers"]:::infra
        DevCont["Devcontainer Setup"]:::infra
        RootDock["Root Docker Config"]:::infra
        SwarmScripts["Docker Swarm Scripts"]:::infra
        RailwayScripts["Railway Scripts"]:::infra
        WASMCont["WASM Containerization"]:::infra
    end

    %% CI/CD & Testing
    subgraph "CI/CD & Testing"
        CICD["CI/CD Pipelines"]:::ci
        BenchRust["Rust Bench & Tests"]:::ci
        BenchPy["Python Tests"]:::ci
    end

    %% External Systems
    subgraph "External Systems"
        DockerReg["Docker Registry"]:::ext
        RailPlat["Railway Cloud Platform"]:::ext
        SwarmExt["Docker Swarm Cloud"]:::ext
        NotifExt["Notification Endpoints"]:::ext
    end

    %% Data Flow
    User["User"]:::ext -->|invokes| RustCLI
    User -->|invokes| PythonCLI

    RustCLI -->|runs| PatternRust
    PythonCLI -->|runs| PatternPy

    PatternRust -->|scores| Scoring
    PatternPy -->|scores| Scoring

    Scoring -->|notifies on match| Notif
    Notif -->|sends| NotifExt

    Notif -->|writes wallet file| WalletFile["Wallet File"]:::data

    PatternRust -->|validates| Lint
    PatternPy -->|validates| Lint

    RustCLI -->|spawn tasks| Orch
    PythonCLI -->|spawn tasks| Orch

    Orch -->|uses| SwarmScripts
    Orch -->|uses| RailwayScripts
    Orch -->|launches| LocalCont
    Orch -->|launches| WASM

    WASM -->|containerized by| WASMCont

    %% Control/Management Flow
    CICD -.->|builds images| DockerReg
    CICD -.->|deploys to| SwarmExt
    CICD -.->|deploys to| RailPlat
    CICD -->|runs tests| BenchRust
    CICD -->|runs tests| BenchPy

    %% Click Events
    click RustCLI "https://github.com/ursisterbtw/hash_hunter/blob/master/src/main.rs"
    click PatternRust "https://github.com/ursisterbtw/hash_hunter/blob/master/salty_sailor/src/main.rs"
    click PythonCLI "https://github.com/ursisterbtw/hash_hunter/blob/master/src/main.py"
    click PythonCLI "https://github.com/ursisterbtw/hash_hunter/blob/master/src/main.pyx"
    click Scoring "https://github.com/ursisterbtw/hash_hunter/blob/master/wallet_scoring.py"
    click Notif "https://github.com/ursisterbtw/hash_hunter/blob/master/notifications.py"
    click Lint "https://github.com/ursisterbtw/hash_hunter/blob/master/linter.py"
    click Orch "https://github.com/ursisterbtw/hash_hunter/blob/master/orchestrator.py"
    click WASM "https://github.com/ursisterbtw/hash_hunter/blob/master/wasm/spec.rs"
    click WASMCont "https://github.com/ursisterbtw/hash_hunter/tree/master/wasm/docker/Dockerfile"
    click WASMCont "https://github.com/ursisterbtw/hash_hunter/blob/master/wasm/docker-compose.yml"
    click DevCont "https://github.com/ursisterbtw/hash_hunter/tree/master/.devcontainer/Dockerfile"
    click DevCont "https://github.com/ursisterbtw/hash_hunter/blob/master/.devcontainer/docker-compose.yml"
    click RootDock "https://github.com/ursisterbtw/hash_hunter/tree/master/Dockerfile"
    click RootDock "https://github.com/ursisterbtw/hash_hunter/blob/master/docker-compose.yml"
    click SwarmScripts "https://github.com/ursisterbtw/hash_hunter/tree/master/cloud_methods/docker_swarm/"
    click RailwayScripts "https://github.com/ursisterbtw/hash_hunter/tree/master/cloud_methods/railway/"
    click CICD "https://github.com/ursisterbtw/hash_hunter/tree/master/.github/workflows/"
    click BenchRust "https://github.com/ursisterbtw/hash_hunter/blob/master/benchmark.rs"
    click BenchRust "https://github.com/ursisterbtw/hash_hunter/blob/master/rust_tests.rs"
    click BenchPy "https://github.com/ursisterbtw/hash_hunter/blob/master/test_python.py"

    %% Styles
    classDef app fill:#D0E8FF,stroke:#0366D6,stroke-width:1px
    classDef infra fill:#DFF2BF,stroke:#4F8A10,stroke-width:1px
    classDef orch fill:#FFE8CC,stroke:#B06C00,stroke-width:1px
    classDef ci fill:#FFE8E8,stroke:#D8000C,stroke-width:1px
    classDef ext fill:#F8D7DA,stroke:#721C24,stroke-width:1px
    classDef data fill:#FFFACD,stroke:#9A7D0A,stroke-width:1px
```
