# ayushdevadiga1/fedledger architecture

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

- Interactive diagram: https://gitdiagram.com/ayushdevadiga1/fedledger
- Repository: https://github.com/ayushdevadiga1/fedledger

## Overview

FedLedger coordinates three organisations’ private-data model training: clients send model weights to a Flower server, which performs weighted aggregation, computes accuracy, and logs a hash of the aggregate on Ethereum. The audit bridge also retrieves records and verifies candidate weights; the documented Streamlit dashboard has training, audit, and verification panels, but all are scaffold stubs. The dataset partitioner and contract/deployment capabilities are included from README evidence. Excerpts show server-to-client workflow and audit calls; several documented subsystem internals and dashboard data wiring are not shown, so those links are omitted.

Main entry points: [`fl_server/blockchain_logger.py`](https://github.com/ayushdevadiga1/fedledger/blob/main/fl_server/blockchain_logger.py) (Blockchain logger), [`fl_server/server.py`](https://github.com/ayushdevadiga1/fedledger/blob/main/fl_server/server.py) (FL server strategy), [`fl_nodes/node.py`](https://github.com/ayushdevadiga1/fedledger/blob/main/fl_nodes/node.py) (FL client node), [`app/main.py`](https://github.com/ayushdevadiga1/fedledger/blob/main/app/main.py) (Streamlit entry point)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Private Data"]
  node_partitioner["Partition generator"]
  node_partitions[("Private partitions")]
end

subgraph group_learning["Federated Learning"]
  node_client["FL client node<br/>[node.py]"]
  node_server["FL server strategy<br/>[server.py]"]
  node_fedavg["FedAvg and hashing<br/>[fedavg.py]"]
end

subgraph group_audit["Blockchain Audit"]
  node_bridge["Blockchain logger"]
  node_contract["Append-only audit contract<br/>[FLAuditLog.sol]"]
  node_deployer["Contract deployment<br/>[deploy.js]"]
  node_ethereum[("Ethereum node")]
end

subgraph group_dashboard["Dashboard"]
  node_dashboard["Streamlit entry point<br/>[main.py]"]
  node_training["Training panel<br/>[training_view.py]"]
  node_auditview["Audit panel<br/>[audit_view.py]"]
  node_verify["Verification panel<br/>[verify_view.py]"]
end

node_operator(("Organisation operator"))

node_operator -->|"generates partitions"| node_partitioner
node_partitioner -->|"saves partitions"| node_partitions
node_operator -->|"starts node"| node_client
node_partitions -->|"loads private data"| node_client
node_client -->|"sends weights"| node_server
node_server -->|"distributes parameters"| node_client
node_server -->|"aggregates weights"| node_fedavg
node_server -->|"logs round"| node_bridge
node_bridge -->|"computes weight hash"| node_fedavg
node_bridge -->|"submits transactions"| node_ethereum
node_ethereum -.->|"executes calls"| node_contract
node_operator -->|"deploys contract"| node_deployer
node_deployer -->|"deploys"| node_contract
node_dashboard -->|"renders panel"| node_training
node_dashboard -->|"renders panel"| node_auditview
node_dashboard -->|"renders panel"| node_verify
node_auditview -.->|"reads audit records"| node_bridge
node_verify -.->|"verifies weights"| node_bridge

click node_partitioner "https://github.com/ayushdevadiga1/fedledger/blob/main/data/generate_partitions.py"
click node_partitions "https://github.com/ayushdevadiga1/fedledger/tree/main/data/node1"
click node_client "https://github.com/ayushdevadiga1/fedledger/blob/main/fl_nodes/node.py"
click node_server "https://github.com/ayushdevadiga1/fedledger/blob/main/fl_server/server.py"
click node_fedavg "https://github.com/ayushdevadiga1/fedledger/blob/main/fl_server/fedavg.py"
click node_bridge "https://github.com/ayushdevadiga1/fedledger/blob/main/fl_server/blockchain_logger.py"
click node_contract "https://github.com/ayushdevadiga1/fedledger/blob/main/blockchain/contracts/FLAuditLog.sol"
click node_deployer "https://github.com/ayushdevadiga1/fedledger/blob/main/blockchain/scripts/deploy.js"
click node_dashboard "https://github.com/ayushdevadiga1/fedledger/blob/main/app/main.py"
click node_training "https://github.com/ayushdevadiga1/fedledger/blob/main/app/training_view.py"
click node_auditview "https://github.com/ayushdevadiga1/fedledger/blob/main/app/audit_view.py"
click node_verify "https://github.com/ayushdevadiga1/fedledger/blob/main/app/verify_view.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_partitioner,node_partitions toneBlue
class node_client,node_server,node_fedavg toneAmber
class node_bridge,node_contract,node_deployer,node_ethereum toneMint
class node_dashboard,node_training,node_auditview,node_verify toneRose
class node_operator toneIndigo
```

## Components

### Private Data

- [Partition generator](https://github.com/ayushdevadiga1/fedledger/blob/main/data/generate_partitions.py): `data/generate_partitions.py`
- [Private partitions](https://github.com/ayushdevadiga1/fedledger/tree/main/data/node1): `data/node1`

### Federated Learning

- [FL client node](https://github.com/ayushdevadiga1/fedledger/blob/main/fl_nodes/node.py): `fl_nodes/node.py`
- [FL server strategy](https://github.com/ayushdevadiga1/fedledger/blob/main/fl_server/server.py): `fl_server/server.py`
- [FedAvg and hashing](https://github.com/ayushdevadiga1/fedledger/blob/main/fl_server/fedavg.py): `fl_server/fedavg.py`

### Blockchain Audit

- [Blockchain logger](https://github.com/ayushdevadiga1/fedledger/blob/main/fl_server/blockchain_logger.py): `fl_server/blockchain_logger.py`
- [Append-only audit contract](https://github.com/ayushdevadiga1/fedledger/blob/main/blockchain/contracts/FLAuditLog.sol): `blockchain/contracts/FLAuditLog.sol`
- [Contract deployment](https://github.com/ayushdevadiga1/fedledger/blob/main/blockchain/scripts/deploy.js): `blockchain/scripts/deploy.js`
- **Ethereum node**

### Dashboard

- [Streamlit entry point](https://github.com/ayushdevadiga1/fedledger/blob/main/app/main.py): `app/main.py`
- [Training panel](https://github.com/ayushdevadiga1/fedledger/blob/main/app/training_view.py): `app/training_view.py`
- [Audit panel](https://github.com/ayushdevadiga1/fedledger/blob/main/app/audit_view.py): `app/audit_view.py`
- [Verification panel](https://github.com/ayushdevadiga1/fedledger/blob/main/app/verify_view.py): `app/verify_view.py`

### Other components

- **Organisation operator**

## Connections

- Organisation operator → Partition generator: generates partitions (evidence: `README.md`)
- Partition generator → Private partitions: saves partitions (evidence: `data/generate_partitions.py`)
- Organisation operator → FL client node: starts node (evidence: `README.md`)
- Private partitions → FL client node: loads private data (evidence: `fl_nodes/node.py`)
- FL client node → FL server strategy: sends weights (evidence: `fl_nodes/node.py`)
- FL server strategy → FL client node: distributes parameters (evidence: `fl_server/server.py`)
- FL server strategy → FedAvg and hashing: aggregates weights (evidence: `fl_server/server.py`)
- FL server strategy → Blockchain logger: logs round (evidence: `fl_server/server.py`)
- Blockchain logger → FedAvg and hashing: computes weight hash (evidence: `fl_server/blockchain_logger.py`)
- Blockchain logger → Ethereum node: submits transactions (evidence: `fl_server/blockchain_logger.py`)
- Ethereum node → Append-only audit contract: executes calls
- Organisation operator → Contract deployment: deploys contract (evidence: `README.md`)
- Contract deployment → Append-only audit contract: deploys (evidence: `blockchain/scripts/deploy.js`)
- Streamlit entry point → Training panel: renders panel (evidence: `app/main.py`)
- Streamlit entry point → Audit panel: renders panel (evidence: `app/main.py`)
- Streamlit entry point → Verification panel: renders panel (evidence: `app/main.py`)
- Audit panel → Blockchain logger: reads audit records (evidence: `app/audit_view.py`)
- Verification panel → Blockchain logger: verifies weights (evidence: `app/verify_view.py`)
