# alexagents/mycelium-core architecture

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

- Interactive diagram: https://gitdiagram.com/alexagents/mycelium-core
- Repository: https://github.com/alexagents/mycelium-core

## Overview

MYCELIUM CORE is a desktop sandbox for preparing, running, and auditing electronic elections on a local Ethereum network. The main workflow starts in the PyQt interface, passes through the AppController facade, and uses voting services and local-chain infrastructure; the README describes the smart contract as the source of truth. Admin, voting, audit, and session-log capabilities remain distinct. Connections reflect the README architecture or relationships named in the source index; unsampled implementation details are not assumed.

Main entry points: [`mycelium-core/src/core/app_controller.py`](https://github.com/alexagents/mycelium-core/blob/main/mycelium-core/src/core/app_controller.py) (AppController facade), [`mycelium-core/src/core/voting_service.py`](https://github.com/alexagents/mycelium-core/blob/main/mycelium-core/src/core/voting_service.py) (Voting service), [`mycelium-core/src/ui/main_window.py`](https://github.com/alexagents/mycelium-core/blob/main/mycelium-core/src/ui/main_window.py) (Main window), [`mycelium-core/main.py`](https://github.com/alexagents/mycelium-core/blob/main/mycelium-core/main.py) (Application startup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Desktop interface"]
  node_window["Main window<br/>[main_window.py]"]
  node_admin["Admin tab<br/>[admin_tab.py]"]
  node_vote["Vote tab<br/>[vote_tab.py]"]
  node_audit_ui["Audit tab<br/>[audit_tab.py]"]
  node_logs["Logs tab<br/>[logs_tab.py]"]
  node_workers["Background workers"]
end

subgraph group_domain["Election operations"]
  node_controller["AppController facade<br/>[app_controller.py]"]
  node_voting["Voting service<br/>[voting_service.py]"]
  node_audit["Audit service<br/>[audit_service.py]"]
  node_precheck["Vote precheck<br/>[precheck.py]"]
  node_error_parser["Error parser<br/>[error_parser.py]"]
  node_models["Election models<br/>[models.py]"]
  node_results["Election results<br/>[app_controller.py]"]
end

subgraph group_chain["Local chain"]
  node_geth["Geth manager<br/>[geth_manager.py]"]
  node_provider["Web3 provider<br/>[web3_provider.py]"]
  node_nonce["Nonce manager<br/>[nonce_manager.py]"]
  node_compiler["Contract compiler"]
end

subgraph group_support["Runtime support"]
  node_entry["Application startup<br/>[main.py]"]
  node_config["Configuration<br/>[config.py]"]
  node_crypto["Crypto utilities<br/>[crypto.py]"]
  node_qr["Receipt QR<br/>[qr.py]"]
  node_logger[("Session logging<br/>[logger.py]")]
  node_paths["Runtime paths<br/>[paths.py]"]
  node_i18n["Translations<br/>[i18n.py]"]
  node_theme["Theme manager<br/>[theme_manager.py]"]
end

node_operator(("Operator"))
node_ethereum(("Local Ethereum node"))
node_contract{{"VotingCore contract"}}

node_operator -->|"uses"| node_window
node_entry -->|"creates"| node_controller
node_entry -->|"opens"| node_window
node_entry -->|"loads"| node_config
node_entry -->|"initializes"| node_i18n
node_entry -->|"applies"| node_theme
node_window -->|"shows"| node_admin
node_window -->|"shows"| node_vote
node_window -->|"shows"| node_audit_ui
node_window -->|"shows"| node_logs
node_window -->|"delegates"| node_controller
node_admin -->|"dispatches"| node_workers
node_vote -->|"dispatches"| node_workers
node_audit_ui -->|"runs"| node_workers
node_controller -->|"delegates"| node_voting
node_controller -->|"runs"| node_audit
node_controller -->|"manages"| node_geth
node_controller -->|"connects"| node_provider
node_controller -->|"checks"| node_precheck
node_controller -->|"parses"| node_error_parser
node_controller -->|"exports"| node_results
node_voting -->|"uses"| node_provider
node_voting -->|"allocates nonces"| node_nonce
node_voting -->|"creates receipts"| node_models
node_voting -->|"generates receipts"| node_qr
node_audit -->|"reads"| node_models
node_audit -->|"uses"| node_voting
node_geth -.->|"starts node"| node_ethereum
node_provider -.->|"connects RPC"| node_ethereum
node_voting -->|"transacts with"| node_contract
node_compiler -.->|"compiles"| node_contract
node_controller -->|"reads settings"| node_config
node_voting -->|"uses"| node_crypto
node_controller -->|"archives session"| node_logger
node_logger -->|"writes logs"| node_paths
node_config -->|"uses locations"| node_paths
node_i18n -->|"loads translations"| node_paths
node_theme -->|"loads theme"| node_paths

click node_entry "https://github.com/alexagents/mycelium-core/blob/main/mycelium-core/main.py"
click node_window "https://github.com/alexagents/mycelium-core/blob/main/mycelium-core/src/ui/main_window.py"
click node_admin "https://github.com/alexagents/mycelium-core/blob/main/mycelium-core/src/ui/tabs/admin_tab.py"
click node_vote "https://github.com/alexagents/mycelium-core/blob/main/mycelium-core/src/ui/tabs/vote_tab.py"
click node_audit_ui "https://github.com/alexagents/mycelium-core/blob/main/mycelium-core/src/ui/tabs/audit_tab.py"
click node_logs "https://github.com/alexagents/mycelium-core/blob/main/mycelium-core/src/ui/tabs/logs_tab.py"
click node_workers "https://github.com/alexagents/mycelium-core/tree/main/mycelium-core/src/ui/workers"
click node_controller "https://github.com/alexagents/mycelium-core/blob/main/mycelium-core/src/core/app_controller.py"
click node_voting "https://github.com/alexagents/mycelium-core/blob/main/mycelium-core/src/core/voting_service.py"
click node_audit "https://github.com/alexagents/mycelium-core/blob/main/mycelium-core/src/core/audit_service.py"
click node_precheck "https://github.com/alexagents/mycelium-core/blob/main/mycelium-core/src/core/precheck.py"
click node_error_parser "https://github.com/alexagents/mycelium-core/blob/main/mycelium-core/src/core/error_parser.py"
click node_models "https://github.com/alexagents/mycelium-core/blob/main/mycelium-core/src/core/models.py"
click node_geth "https://github.com/alexagents/mycelium-core/blob/main/mycelium-core/src/core/geth_manager.py"
click node_provider "https://github.com/alexagents/mycelium-core/blob/main/mycelium-core/src/core/web3_provider.py"
click node_nonce "https://github.com/alexagents/mycelium-core/blob/main/mycelium-core/src/core/nonce_manager.py"
click node_compiler "https://github.com/alexagents/mycelium-core/blob/main/mycelium-core/src/core/compiler_service.py"
click node_config "https://github.com/alexagents/mycelium-core/blob/main/mycelium-core/src/utils/config.py"
click node_crypto "https://github.com/alexagents/mycelium-core/blob/main/mycelium-core/src/utils/crypto.py"
click node_qr "https://github.com/alexagents/mycelium-core/blob/main/mycelium-core/src/utils/qr.py"
click node_logger "https://github.com/alexagents/mycelium-core/blob/main/mycelium-core/src/utils/logger.py"
click node_paths "https://github.com/alexagents/mycelium-core/blob/main/mycelium-core/src/utils/paths.py"
click node_i18n "https://github.com/alexagents/mycelium-core/blob/main/mycelium-core/src/utils/i18n.py"
click node_theme "https://github.com/alexagents/mycelium-core/blob/main/mycelium-core/src/utils/theme_manager.py"
click node_results "https://github.com/alexagents/mycelium-core/blob/main/mycelium-core/src/core/app_controller.py"

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_window,node_admin,node_vote,node_audit_ui,node_logs,node_workers toneBlue
class node_controller,node_voting,node_audit,node_precheck,node_error_parser,node_models,node_results toneAmber
class node_geth,node_provider,node_nonce,node_compiler toneMint
class node_entry,node_config,node_crypto,node_qr,node_logger,node_paths,node_i18n,node_theme toneRose
class node_operator,node_ethereum,node_contract toneIndigo
```

## Components

### Desktop interface

- [Main window](https://github.com/alexagents/mycelium-core/blob/main/mycelium-core/src/ui/main_window.py): `mycelium-core/src/ui/main_window.py`
- [Admin tab](https://github.com/alexagents/mycelium-core/blob/main/mycelium-core/src/ui/tabs/admin_tab.py): `mycelium-core/src/ui/tabs/admin_tab.py`
- [Vote tab](https://github.com/alexagents/mycelium-core/blob/main/mycelium-core/src/ui/tabs/vote_tab.py): `mycelium-core/src/ui/tabs/vote_tab.py`
- [Audit tab](https://github.com/alexagents/mycelium-core/blob/main/mycelium-core/src/ui/tabs/audit_tab.py): `mycelium-core/src/ui/tabs/audit_tab.py`
- [Logs tab](https://github.com/alexagents/mycelium-core/blob/main/mycelium-core/src/ui/tabs/logs_tab.py): `mycelium-core/src/ui/tabs/logs_tab.py`
- [Background workers](https://github.com/alexagents/mycelium-core/tree/main/mycelium-core/src/ui/workers): `mycelium-core/src/ui/workers`

### Election operations

- [AppController facade](https://github.com/alexagents/mycelium-core/blob/main/mycelium-core/src/core/app_controller.py): `mycelium-core/src/core/app_controller.py`
- [Voting service](https://github.com/alexagents/mycelium-core/blob/main/mycelium-core/src/core/voting_service.py): `mycelium-core/src/core/voting_service.py`
- [Audit service](https://github.com/alexagents/mycelium-core/blob/main/mycelium-core/src/core/audit_service.py): `mycelium-core/src/core/audit_service.py`
- [Vote precheck](https://github.com/alexagents/mycelium-core/blob/main/mycelium-core/src/core/precheck.py): `mycelium-core/src/core/precheck.py`
- [Error parser](https://github.com/alexagents/mycelium-core/blob/main/mycelium-core/src/core/error_parser.py): `mycelium-core/src/core/error_parser.py`
- [Election models](https://github.com/alexagents/mycelium-core/blob/main/mycelium-core/src/core/models.py): `mycelium-core/src/core/models.py`
- [Election results](https://github.com/alexagents/mycelium-core/blob/main/mycelium-core/src/core/app_controller.py): `mycelium-core/src/core/app_controller.py`

### Local chain

- [Geth manager](https://github.com/alexagents/mycelium-core/blob/main/mycelium-core/src/core/geth_manager.py): `mycelium-core/src/core/geth_manager.py`
- [Web3 provider](https://github.com/alexagents/mycelium-core/blob/main/mycelium-core/src/core/web3_provider.py): `mycelium-core/src/core/web3_provider.py`
- [Nonce manager](https://github.com/alexagents/mycelium-core/blob/main/mycelium-core/src/core/nonce_manager.py): `mycelium-core/src/core/nonce_manager.py`
- [Contract compiler](https://github.com/alexagents/mycelium-core/blob/main/mycelium-core/src/core/compiler_service.py): `mycelium-core/src/core/compiler_service.py`

### Runtime support

- [Application startup](https://github.com/alexagents/mycelium-core/blob/main/mycelium-core/main.py): `mycelium-core/main.py`
- [Configuration](https://github.com/alexagents/mycelium-core/blob/main/mycelium-core/src/utils/config.py): `mycelium-core/src/utils/config.py`
- [Crypto utilities](https://github.com/alexagents/mycelium-core/blob/main/mycelium-core/src/utils/crypto.py): `mycelium-core/src/utils/crypto.py`
- [Receipt QR](https://github.com/alexagents/mycelium-core/blob/main/mycelium-core/src/utils/qr.py): `mycelium-core/src/utils/qr.py`
- [Session logging](https://github.com/alexagents/mycelium-core/blob/main/mycelium-core/src/utils/logger.py): `mycelium-core/src/utils/logger.py`
- [Runtime paths](https://github.com/alexagents/mycelium-core/blob/main/mycelium-core/src/utils/paths.py): `mycelium-core/src/utils/paths.py`
- [Translations](https://github.com/alexagents/mycelium-core/blob/main/mycelium-core/src/utils/i18n.py): `mycelium-core/src/utils/i18n.py`
- [Theme manager](https://github.com/alexagents/mycelium-core/blob/main/mycelium-core/src/utils/theme_manager.py): `mycelium-core/src/utils/theme_manager.py`

### Other components

- **Operator**
- **Local Ethereum node**
- **VotingCore contract**

## Connections

- Operator → Main window: uses
- Application startup → AppController facade: creates (evidence: `mycelium-core/main.py`)
- Application startup → Main window: opens (evidence: `mycelium-core/main.py`)
- Application startup → Configuration: loads (evidence: `mycelium-core/main.py`)
- Application startup → Translations: initializes (evidence: `mycelium-core/main.py`)
- Application startup → Theme manager: applies (evidence: `mycelium-core/main.py`)
- Main window → Admin tab: shows (evidence: `mycelium-core/src/ui/main_window.py`)
- Main window → Vote tab: shows (evidence: `mycelium-core/src/ui/main_window.py`)
- Main window → Audit tab: shows (evidence: `mycelium-core/src/ui/main_window.py`)
- Main window → Logs tab: shows (evidence: `mycelium-core/src/ui/main_window.py`)
- Main window → AppController facade: delegates (evidence: `mycelium-core/src/ui/main_window.py`)
- Admin tab → Background workers: dispatches (evidence: `mycelium-core/src/ui/tabs/admin_tab.py`)
- Vote tab → Background workers: dispatches (evidence: `mycelium-core/src/ui/tabs/vote_tab.py`)
- Audit tab → Background workers: runs (evidence: `mycelium-core/src/ui/tabs/audit_tab.py`)
- AppController facade → Voting service: delegates (evidence: `mycelium-core/src/core/app_controller.py`)
- AppController facade → Audit service: runs (evidence: `mycelium-core/src/core/app_controller.py`)
- AppController facade → Geth manager: manages (evidence: `mycelium-core/src/core/app_controller.py`)
- AppController facade → Web3 provider: connects (evidence: `mycelium-core/src/core/app_controller.py`)
- AppController facade → Vote precheck: checks (evidence: `mycelium-core/src/core/app_controller.py`)
- AppController facade → Error parser: parses (evidence: `mycelium-core/src/core/app_controller.py`)
- AppController facade → Election results: exports (evidence: `mycelium-core/src/core/app_controller.py`)
- Voting service → Web3 provider: uses (evidence: `mycelium-core/src/core/voting_service.py`)
- Voting service → Nonce manager: allocates nonces (evidence: `mycelium-core/src/core/voting_service.py`)
- Voting service → Election models: creates receipts (evidence: `mycelium-core/src/core/voting_service.py`)
- Voting service → Receipt QR: generates receipts (evidence: `mycelium-core/src/core/voting_service.py`)
- Audit service → Election models: reads (evidence: `mycelium-core/src/core/audit_service.py`)
- Audit service → Voting service: uses (evidence: `mycelium-core/src/core/audit_service.py`)
- Geth manager → Local Ethereum node: starts node
- Web3 provider → Local Ethereum node: connects RPC
- Voting service → VotingCore contract: transacts with
- Contract compiler → VotingCore contract: compiles
- AppController facade → Configuration: reads settings (evidence: `mycelium-core/src/core/app_controller.py`)
- Voting service → Crypto utilities: uses (evidence: `mycelium-core/src/core/voting_service.py`)
- AppController facade → Session logging: archives session (evidence: `mycelium-core/src/core/app_controller.py`)
- Session logging → Runtime paths: writes logs (evidence: `mycelium-core/src/utils/logger.py`)
- Configuration → Runtime paths: uses locations (evidence: `mycelium-core/src/utils/config.py`)
- Translations → Runtime paths: loads translations (evidence: `mycelium-core/src/utils/i18n.py`)
- Theme manager → Runtime paths: loads theme (evidence: `mycelium-core/src/utils/theme_manager.py`)
