# darmenz2/dizzass architecture

> Architecture diagram of the GitHub repository darmenz2/dizzass, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/darmenz2/dizzass
- Repository: https://github.com/darmenz2/dizzass

## Overview

dizzass is a cgminer-based Bitcoin mining project: its stated production direction is to retain the upstream miner and restore hardware support incrementally, rather than run a second mining core. The main workflow is pool work entering the miner, being distributed to a configured device driver, and results returning through the mining protocol. The README documents API and hardware-driver capabilities, but says T21 support, hardware startup, protections, and autotuning are incomplete. Recovery modules are separate from the normal production runtime; their internal connections are shown only where the supplied source index or excerpts support them.

Main entry points: [`cgminer.c`](https://github.com/darmenz2/dizzass/blob/main/cgminer.c) (cgminer runtime), [`src/frontend/cgminer.c`](https://github.com/darmenz2/dizzass/blob/main/src/frontend/cgminer.c) (Recovery frontend), [`src/backend/work-gen/work-gen.c`](https://github.com/darmenz2/dizzass/blob/main/src/backend/work-gen/work-gen.c) (Work generation), [`driver-avalon.c`](https://github.com/darmenz2/dizzass/blob/main/driver-avalon.c) (Device drivers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_core["Mining core"]
  node_miner["cgminer runtime<br/>[cgminer.c]"]
  node_work["Work handling<br/>[miner.h]"]
end

subgraph group_hardware["Hardware support"]
  node_drivers["Device drivers<br/>[driver-avalon.c]"]
  node_t1driver["Dragonmint SPI"]
  node_t1protocol["T1 protocol<br/>[dragonmint_t1.c]"]
  node_backend["Backend services<br/>[base.c]"]
  node_workgen["Work generation<br/>[work-gen.c]"]
  node_rxworker["RX worker<br/>[work-rx-worker.c]"]
  node_txworker["TX worker<br/>[work-tx-worker.c]"]
end

subgraph group_recovery["Recovery work"]
  node_recovery_frontend["Recovery frontend<br/>[cgminer.c]"]
  node_nonce["Nonce preparation<br/>[work_nonce.h]"]
  node_rebuild["Work rebuilding<br/>[work_rebuild.h]"]
  node_storage["Work storage<br/>[work_storage.h]"]
  node_rebuild_impl["Rebuild adapter"]
  node_storage_impl["Storage adapter"]
end

subgraph group_interface["Interfaces"]
  node_api["Mining API<br/>[api.c]"]
end

node_pool(("Mining pool"))
node_operator(("Operator"))

node_pool -->|"provides work"| node_miner
node_miner -->|"exchanges work"| node_pool
node_miner -->|"uses core"| node_work
node_miner -.->|"dispatches mining"| node_drivers
node_drivers -.->|"includes device driver"| node_t1driver
node_t1driver -->|"uses protocol"| node_t1protocol
node_backend -.->|"coordinates work"| node_workgen
node_workgen -->|"uses RX worker"| node_rxworker
node_workgen -->|"uses TX worker"| node_txworker
node_operator -->|"queries miner"| node_api
node_api -.->|"exposes status"| node_miner
node_recovery_frontend -->|"uses recovery API"| node_nonce
node_recovery_frontend -->|"uses recovery API"| node_rebuild
node_recovery_frontend -->|"uses recovery API"| node_storage
node_rebuild_impl -->|"calls rebuild"| node_rebuild
node_storage_impl -->|"calls clone API"| node_storage

click node_miner "https://github.com/darmenz2/dizzass/blob/main/cgminer.c"
click node_work "https://github.com/darmenz2/dizzass/blob/main/miner.h"
click node_drivers "https://github.com/darmenz2/dizzass/blob/main/driver-avalon.c"
click node_t1driver "https://github.com/darmenz2/dizzass/blob/main/driver-SPI-dragonmint-t1.c"
click node_t1protocol "https://github.com/darmenz2/dizzass/blob/main/dragonmint_t1.c"
click node_backend "https://github.com/darmenz2/dizzass/blob/main/src/backend/base.c"
click node_workgen "https://github.com/darmenz2/dizzass/blob/main/src/backend/work-gen/work-gen.c"
click node_rxworker "https://github.com/darmenz2/dizzass/blob/main/src/backend/work-gen/work-rx-worker.c"
click node_txworker "https://github.com/darmenz2/dizzass/blob/main/src/backend/work-gen/work-tx-worker.c"
click node_recovery_frontend "https://github.com/darmenz2/dizzass/blob/main/src/frontend/cgminer.c"
click node_nonce "https://github.com/darmenz2/dizzass/blob/main/include/xminer/recovery/work_nonce.h"
click node_rebuild "https://github.com/darmenz2/dizzass/blob/main/include/xminer/recovery/work_rebuild.h"
click node_storage "https://github.com/darmenz2/dizzass/blob/main/include/xminer/recovery/work_storage.h"
click node_rebuild_impl "https://github.com/darmenz2/dizzass/blob/main/reconstruction/support/work_rebuild_pipeline.c"
click node_storage_impl "https://github.com/darmenz2/dizzass/blob/main/reconstruction/support/work_storage_pipeline.c"
click node_api "https://github.com/darmenz2/dizzass/blob/main/api.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_miner,node_work toneBlue
class node_drivers,node_t1driver,node_t1protocol,node_backend,node_workgen,node_rxworker,node_txworker toneAmber
class node_recovery_frontend,node_nonce,node_rebuild,node_storage,node_rebuild_impl,node_storage_impl toneMint
class node_api toneRose
class node_pool,node_operator toneIndigo
```

## Components

### Mining core

- [cgminer runtime](https://github.com/darmenz2/dizzass/blob/main/cgminer.c): `cgminer.c`
- [Work handling](https://github.com/darmenz2/dizzass/blob/main/miner.h): `miner.h`

### Hardware support

- [Device drivers](https://github.com/darmenz2/dizzass/blob/main/driver-avalon.c): `driver-avalon.c`
- [Dragonmint SPI](https://github.com/darmenz2/dizzass/blob/main/driver-SPI-dragonmint-t1.c): `driver-SPI-dragonmint-t1.c`
- [T1 protocol](https://github.com/darmenz2/dizzass/blob/main/dragonmint_t1.c): `dragonmint_t1.c`
- [Backend services](https://github.com/darmenz2/dizzass/blob/main/src/backend/base.c): `src/backend/base.c`
- [Work generation](https://github.com/darmenz2/dizzass/blob/main/src/backend/work-gen/work-gen.c): `src/backend/work-gen/work-gen.c`
- [RX worker](https://github.com/darmenz2/dizzass/blob/main/src/backend/work-gen/work-rx-worker.c): `src/backend/work-gen/work-rx-worker.c`
- [TX worker](https://github.com/darmenz2/dizzass/blob/main/src/backend/work-gen/work-tx-worker.c): `src/backend/work-gen/work-tx-worker.c`

### Recovery work

- [Recovery frontend](https://github.com/darmenz2/dizzass/blob/main/src/frontend/cgminer.c): `src/frontend/cgminer.c`
- [Nonce preparation](https://github.com/darmenz2/dizzass/blob/main/include/xminer/recovery/work_nonce.h): `include/xminer/recovery/work_nonce.h`
- [Work rebuilding](https://github.com/darmenz2/dizzass/blob/main/include/xminer/recovery/work_rebuild.h): `include/xminer/recovery/work_rebuild.h`
- [Work storage](https://github.com/darmenz2/dizzass/blob/main/include/xminer/recovery/work_storage.h): `include/xminer/recovery/work_storage.h`
- [Rebuild adapter](https://github.com/darmenz2/dizzass/blob/main/reconstruction/support/work_rebuild_pipeline.c): `reconstruction/support/work_rebuild_pipeline.c`
- [Storage adapter](https://github.com/darmenz2/dizzass/blob/main/reconstruction/support/work_storage_pipeline.c): `reconstruction/support/work_storage_pipeline.c`

### Interfaces

- [Mining API](https://github.com/darmenz2/dizzass/blob/main/api.c): `api.c`

### Other components

- **Mining pool**
- **Operator**

## Connections

- Mining pool → cgminer runtime: provides work (evidence: `README`)
- cgminer runtime → Mining pool: exchanges work (evidence: `README`)
- cgminer runtime → Work handling: uses core (evidence: `README`)
- cgminer runtime → Device drivers: dispatches mining
- Device drivers → Dragonmint SPI: includes device driver
- Dragonmint SPI → T1 protocol: uses protocol (evidence: `driver-SPI-dragonmint-t1.c`)
- Backend services → Work generation: coordinates work
- Work generation → RX worker: uses RX worker (evidence: `src/backend/work-gen/work-rx-worker.c`)
- Work generation → TX worker: uses TX worker (evidence: `src/backend/work-gen/work-tx-worker.c`)
- Operator → Mining API: queries miner (evidence: `README`)
- Mining API → cgminer runtime: exposes status
- Recovery frontend → Nonce preparation: uses recovery API (evidence: `src/frontend/cgminer.c`)
- Recovery frontend → Work rebuilding: uses recovery API (evidence: `src/frontend/cgminer.c`)
- Recovery frontend → Work storage: uses recovery API (evidence: `src/frontend/cgminer.c`)
- Rebuild adapter → Work rebuilding: calls rebuild (evidence: `reconstruction/support/work_rebuild_pipeline.c`)
- Storage adapter → Work storage: calls clone API (evidence: `reconstruction/support/work_storage_pipeline.c`)
