# amithathreya/iot_data_sharing architecture

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

- Interactive diagram: https://gitdiagram.com/amithathreya/iot_data_sharing
- Repository: https://github.com/amithathreya/iot_data_sharing

## Overview

This repository combines a post-quantum-secured IoT sensor pipeline with federated learning and blockchain audit. In the sensor workflow, Raspberry Pi publishers read or synthesize measurements, sign envelopes, and send them to RabbitMQ; consumers verify signatures and may stream metrics to Grafana or record hashes on Besu. A separate federated-learning workflow trains Raspberry Pi clients and aggregates rounds on a Flower server, which also audits model hashes on Besu. The graph includes listed but unsampled runtime modules; their connections are omitted where source evidence was unavailable.

Main entry points: [`wsl/pqc_project/dht11_consumer_grafana.py`](https://github.com/amithathreya/iot_data_sharing/blob/master/wsl/pqc_project/dht11_consumer_grafana.py) (Grafana Consumer), [`raspberry files/pqc_project/client_xfl_2.py`](https://github.com/amithathreya/iot_data_sharing/blob/master/raspberry%20files/pqc_project/client_xfl_2.py) (Layerwise Client), [`wsl/pqc_project/dht11_consumer.py`](https://github.com/amithathreya/iot_data_sharing/blob/master/wsl/pqc_project/dht11_consumer.py) (Verified Consumer), [`wsl/pqc_project/blockchain/SensorRegistry.sol`](https://github.com/amithathreya/iot_data_sharing/blob/master/wsl/pqc_project/blockchain/SensorRegistry.sol) (Sensor Registry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_sensing["Sensing and Publishing"]
  node_publisher["Signed Publisher<br/>[publisher.py]"]
  node_grafana_publisher["Live Publisher"]
  node_continuous_sensor["Continuous Reader"]
  node_dht_publisher["DHT Publisher<br/>[dht11_publisher.py]"]
  node_sensor_log[("Sensor Log")]
end

subgraph group_ingestion["Message Processing"]
  node_consumer["Verified Consumer<br/>[dht11_consumer.py]"]
  node_grafana_consumer["Grafana Consumer"]
  node_general_consumer["General Consumer<br/>[consumer.py]"]
  node_alert_exporter["Alert Exporter<br/>[alert_exporter.py]"]
end

subgraph group_learning["Federated Learning"]
  node_client["Layerwise Client<br/>[client_xfl_2.py]"]
  node_basic_client["Basic FL Client<br/>[client_xfl.py]"]
  node_fl_server["FL Server<br/>[server_xfl.py]"]
end

subgraph group_ledger["Blockchain Audit"]
  node_registry["Sensor Registry<br/>[SensorRegistry.sol]"]
  node_deployer["Contract Deployer<br/>[deploy.py]"]
  node_aggregator["Blockchain Aggregator<br/>[aggregator.py]"]
  node_contract_info["Contract Metadata<br/>[contract.json]"]
end

node_sensor(("DHT11 Sensor"))
node_random_sensor(("Simulated Sensor"))
node_rabbitmq["RabbitMQ"]
node_grafana["Grafana"]
node_besu["Besu Network<br/>[docker-compose.yml]"]
node_fl_server_address["Flower Server"]

node_sensor -->|"reads measurements"| node_grafana_publisher
node_random_sensor -->|"supplies readings"| node_publisher
node_grafana_publisher -->|"publishes signed data"| node_rabbitmq
node_publisher -->|"publishes signed data"| node_rabbitmq
node_grafana_publisher -->|"streams metrics"| node_grafana
node_consumer -->|"consumes messages"| node_rabbitmq
node_grafana_consumer -->|"consumes messages"| node_rabbitmq
node_grafana_consumer -->|"pushes metrics"| node_grafana
node_consumer -->|"records hashes"| node_registry
node_grafana_consumer -->|"records hashes"| node_registry
node_consumer -->|"submits transactions"| node_besu
node_grafana_consumer -->|"submits transactions"| node_besu
node_deployer -->|"deploys contract"| node_registry
node_deployer -->|"deploys contract"| node_besu
node_deployer -->|"writes metadata"| node_contract_info
node_consumer -->|"loads metadata"| node_contract_info
node_grafana_consumer -->|"loads metadata"| node_contract_info
node_client -->|"reads measurements"| node_sensor
node_client -->|"appends readings"| node_sensor_log
node_client -->|"loads training data"| node_sensor_log
node_client -->|"publishes alerts"| node_rabbitmq
node_client -->|"connects for training"| node_fl_server_address
node_basic_client -->|"connects for training"| node_fl_server_address
node_fl_server -->|"audits model rounds"| node_besu
node_fl_server -->|"records model hashes"| node_registry
node_fl_server -->|"loads metadata"| node_contract_info

click node_publisher "https://github.com/amithathreya/iot_data_sharing/blob/master/raspberry%20files/pqc_project/publisher.py"
click node_grafana_publisher "https://github.com/amithathreya/iot_data_sharing/blob/master/raspberry%20files/pqc_project/publisher_grafana.py"
click node_continuous_sensor "https://github.com/amithathreya/iot_data_sharing/blob/master/raspberry%20files/pqc_project/dht11_continious.py"
click node_dht_publisher "https://github.com/amithathreya/iot_data_sharing/blob/master/raspberry%20files/pqc_project/dht11_publisher.py"
click node_consumer "https://github.com/amithathreya/iot_data_sharing/blob/master/wsl/pqc_project/dht11_consumer.py"
click node_grafana_consumer "https://github.com/amithathreya/iot_data_sharing/blob/master/wsl/pqc_project/dht11_consumer_grafana.py"
click node_general_consumer "https://github.com/amithathreya/iot_data_sharing/blob/master/wsl/pqc_project/consumer.py"
click node_alert_exporter "https://github.com/amithathreya/iot_data_sharing/blob/master/wsl/pqc_project/alert_exporter.py"
click node_client "https://github.com/amithathreya/iot_data_sharing/blob/master/raspberry%20files/pqc_project/client_xfl_2.py"
click node_basic_client "https://github.com/amithathreya/iot_data_sharing/blob/master/raspberry%20files/pqc_project/client_xfl.py"
click node_fl_server "https://github.com/amithathreya/iot_data_sharing/blob/master/wsl/pqc_project/server_xfl.py"
click node_besu "https://github.com/amithathreya/iot_data_sharing/blob/master/wsl/besu-network/docker-compose.yml"
click node_registry "https://github.com/amithathreya/iot_data_sharing/blob/master/wsl/pqc_project/blockchain/SensorRegistry.sol"
click node_deployer "https://github.com/amithathreya/iot_data_sharing/blob/master/wsl/pqc_project/blockchain/deploy.py"
click node_aggregator "https://github.com/amithathreya/iot_data_sharing/blob/master/wsl/pqc_project/blockchain/aggregator.py"
click node_contract_info "https://github.com/amithathreya/iot_data_sharing/blob/master/wsl/pqc_project/blockchain/contract.json"

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_publisher,node_grafana_publisher,node_continuous_sensor,node_dht_publisher,node_sensor_log toneBlue
class node_consumer,node_grafana_consumer,node_general_consumer,node_alert_exporter toneAmber
class node_client,node_basic_client,node_fl_server,node_fl_server_address toneMint
class node_registry,node_deployer,node_aggregator,node_contract_info toneRose
class node_sensor,node_random_sensor,node_rabbitmq,node_grafana toneIndigo
class node_besu toneTeal
```

## Components

### Sensing and Publishing

- [Signed Publisher](https://github.com/amithathreya/iot_data_sharing/blob/master/raspberry%20files/pqc_project/publisher.py): `raspberry files/pqc_project/publisher.py`
- [Live Publisher](https://github.com/amithathreya/iot_data_sharing/blob/master/raspberry%20files/pqc_project/publisher_grafana.py): `raspberry files/pqc_project/publisher_grafana.py`
- [Continuous Reader](https://github.com/amithathreya/iot_data_sharing/blob/master/raspberry%20files/pqc_project/dht11_continious.py): `raspberry files/pqc_project/dht11_continious.py`
- [DHT Publisher](https://github.com/amithathreya/iot_data_sharing/blob/master/raspberry%20files/pqc_project/dht11_publisher.py): `raspberry files/pqc_project/dht11_publisher.py`
- **Sensor Log**

### Message Processing

- [Verified Consumer](https://github.com/amithathreya/iot_data_sharing/blob/master/wsl/pqc_project/dht11_consumer.py): `wsl/pqc_project/dht11_consumer.py`
- [Grafana Consumer](https://github.com/amithathreya/iot_data_sharing/blob/master/wsl/pqc_project/dht11_consumer_grafana.py): `wsl/pqc_project/dht11_consumer_grafana.py`
- [General Consumer](https://github.com/amithathreya/iot_data_sharing/blob/master/wsl/pqc_project/consumer.py): `wsl/pqc_project/consumer.py`
- [Alert Exporter](https://github.com/amithathreya/iot_data_sharing/blob/master/wsl/pqc_project/alert_exporter.py): `wsl/pqc_project/alert_exporter.py`

### Federated Learning

- [Layerwise Client](https://github.com/amithathreya/iot_data_sharing/blob/master/raspberry%20files/pqc_project/client_xfl_2.py): `raspberry files/pqc_project/client_xfl_2.py`
- [Basic FL Client](https://github.com/amithathreya/iot_data_sharing/blob/master/raspberry%20files/pqc_project/client_xfl.py): `raspberry files/pqc_project/client_xfl.py`
- [FL Server](https://github.com/amithathreya/iot_data_sharing/blob/master/wsl/pqc_project/server_xfl.py): `wsl/pqc_project/server_xfl.py`

### Blockchain Audit

- [Sensor Registry](https://github.com/amithathreya/iot_data_sharing/blob/master/wsl/pqc_project/blockchain/SensorRegistry.sol): `wsl/pqc_project/blockchain/SensorRegistry.sol`
- [Contract Deployer](https://github.com/amithathreya/iot_data_sharing/blob/master/wsl/pqc_project/blockchain/deploy.py): `wsl/pqc_project/blockchain/deploy.py`
- [Blockchain Aggregator](https://github.com/amithathreya/iot_data_sharing/blob/master/wsl/pqc_project/blockchain/aggregator.py): `wsl/pqc_project/blockchain/aggregator.py`
- [Contract Metadata](https://github.com/amithathreya/iot_data_sharing/blob/master/wsl/pqc_project/blockchain/contract.json): `wsl/pqc_project/blockchain/contract.json`

### Other components

- **DHT11 Sensor**
- **Simulated Sensor**
- **RabbitMQ**
- **Grafana**
- [Besu Network](https://github.com/amithathreya/iot_data_sharing/blob/master/wsl/besu-network/docker-compose.yml): `wsl/besu-network/docker-compose.yml`
- **Flower Server**

## Connections

- DHT11 Sensor → Live Publisher: reads measurements (evidence: `raspberry files/pqc_project/publisher_grafana.py`)
- Simulated Sensor → Signed Publisher: supplies readings (evidence: `raspberry files/pqc_project/publisher.py`)
- Live Publisher → RabbitMQ: publishes signed data (evidence: `raspberry files/pqc_project/publisher_grafana.py`)
- Signed Publisher → RabbitMQ: publishes signed data (evidence: `raspberry files/pqc_project/publisher.py`)
- Live Publisher → Grafana: streams metrics (evidence: `raspberry files/pqc_project/publisher_grafana.py`)
- Verified Consumer → RabbitMQ: consumes messages (evidence: `wsl/pqc_project/dht11_consumer.py`)
- Grafana Consumer → RabbitMQ: consumes messages (evidence: `wsl/pqc_project/dht11_consumer_grafana.py`)
- Grafana Consumer → Grafana: pushes metrics (evidence: `wsl/pqc_project/dht11_consumer_grafana.py`)
- Verified Consumer → Sensor Registry: records hashes (evidence: `wsl/pqc_project/dht11_consumer.py`)
- Grafana Consumer → Sensor Registry: records hashes (evidence: `wsl/pqc_project/dht11_consumer_grafana.py`)
- Verified Consumer → Besu Network: submits transactions (evidence: `wsl/pqc_project/dht11_consumer.py`)
- Grafana Consumer → Besu Network: submits transactions (evidence: `wsl/pqc_project/dht11_consumer_grafana.py`)
- Contract Deployer → Sensor Registry: deploys contract (evidence: `wsl/pqc_project/blockchain/deploy.py`)
- Contract Deployer → Besu Network: deploys contract (evidence: `wsl/pqc_project/blockchain/deploy.py`)
- Contract Deployer → Contract Metadata: writes metadata (evidence: `wsl/pqc_project/blockchain/deploy.py`)
- Verified Consumer → Contract Metadata: loads metadata (evidence: `wsl/pqc_project/dht11_consumer.py`)
- Grafana Consumer → Contract Metadata: loads metadata (evidence: `wsl/pqc_project/dht11_consumer_grafana.py`)
- Layerwise Client → DHT11 Sensor: reads measurements (evidence: `raspberry files/pqc_project/client_xfl_2.py`)
- Layerwise Client → Sensor Log: appends readings (evidence: `raspberry files/pqc_project/client_xfl_2.py`)
- Layerwise Client → Sensor Log: loads training data (evidence: `raspberry files/pqc_project/client_xfl_2.py`)
- Layerwise Client → RabbitMQ: publishes alerts (evidence: `raspberry files/pqc_project/client_xfl_2.py`)
- Layerwise Client → Flower Server: connects for training (evidence: `raspberry files/pqc_project/client_xfl_2.py`)
- Basic FL Client → Flower Server: connects for training (evidence: `raspberry files/pqc_project/client_xfl.py`)
- FL Server → Besu Network: audits model rounds (evidence: `wsl/pqc_project/server_xfl.py`)
- FL Server → Sensor Registry: records model hashes (evidence: `wsl/pqc_project/server_xfl.py`)
- FL Server → Contract Metadata: loads metadata (evidence: `wsl/pqc_project/server_xfl.py`)
