# Architecture and Technical Framework

The Lumora network operates on a decentralized architecture designed for efficiency, security, and scalability. Below is the detailed breakdown of the core components, algorithms, and equations.

***

**Core Components**

* **Bandwidth Providers**: Share unused internet bandwidth via the Lumora browser extension or DApp. Contributions are encrypted and optimized to ensure no disruption to regular internet usage.
* **Decentralized Task Manager**: Dynamically assigns tasks to nodes based on proximity, availability, and capacity, ensuring efficient task distribution.
* **Task Executors (Nodes)**: Perform data scraping, processing, and encryption tasks using adaptive frameworks.
* **Blockchain Infrastructure**: Implements smart contracts for task validation, reward distribution, and fraud prevention, ensuring a transparent and immutable system.
* **Data Consumers**: Access aggregated and encrypted data through a decentralized marketplace and pay using Lumora tokens.

***

**Task Allocation Algorithm**

To ensure efficient task execution, a **weighted proximity-based task allocation algorithm** is used.

**Algorithm:**

1. **Input Variables:**
   * `B_i`: Bandwidth capacity of node `i`.
   * `P_i`: Proximity of node `i` to the data source.
   * `L_i`: Latency of node `i`.
   * `W_i`: Weighted score for node `i`.
2. **Weighted Score Calculation:**

   ```
   W_i = α * (B_i / B_max) + β * (1 / P_i) + γ * (1 / L_i)
   ```

   * `α`, `β`, `γ`: Tunable parameters for balancing bandwidth, proximity, and latency.
   * `B_max`: Maximum bandwidth available in the network.
3. **Task Assignment:**
   * The node with the highest `W_i` is selected for task execution.

***

**Proof-of-Bandwidth Validation**

The **Proof-of-Bandwidth (PoB)** protocol ensures fair validation of contributions and reward distribution.

**Equations:**

1. **Bandwidth Contribution:**

   ```
   C_i = Used Bandwidth by Node i / Total Bandwidth Used in the Network
   ```
2. **Reward Calculation:**

   ```
   R_i = C_i * R_total
   ```

   * `R_total`: Total reward tokens allocated for the current cycle.
3. **Validation:**
   * Contributions are logged on the blockchain and verified using smart contracts.

***

**Dynamic Load Balancing**

To optimize resource utilization, a **real-time load balancing algorithm** is implemented.

**Algorithm:**

1. **Input Variables:**
   * `N_i`: Current load on node `i`.
   * `C_max`: Maximum capacity of node `i`.
2. **Load Balancing Condition:**

   ```
   If N_i >= 0.8 * C_max, redirect tasks to the next available node.
   ```
3. **Task Redistribution:**
   * Tasks are dynamically reassigned to nodes with available capacity to prevent overloading.

***

**Data Encryption and Aggregation**

* **Encryption Protocol**: AES-256 encryption ensures data security.

  ```
  E_k(M) = AES-256(k, M)
  ```

  * `E_k(M)`: Encrypted message `M` using key `k`.
* **Aggregation Framework**:
  1. Normalize raw data into a structured format (e.g., JSON, CSV).
  2. Validate data integrity with:

     ```
     H(M) = SHA-256(M)
     ```

     * `H(M)`: Hash value of message `M`.

***

**Reward Distribution Mechanism**

The reward system is automated using blockchain smart contracts.

**Workflow:**

1. **Task Logging:**
   * Tasks are logged immutably on the blockchain.
2. **Reward Disbursement:**
   * Rewards are calculated using the Proof-of-Bandwidth equation and distributed automatically to participants.

***

**Layer-2 Scaling and Sharding**

1. **Layer-2 Integration**:
   * Utilizes Layer-2 solutions (e.g., Polygon) to reduce transaction fees and improve throughput.
2. **Sharding**:

   * Splits the network into smaller partitions (shards) for scalability.

   ```
   S_i = N / k
   ```

   * `S_i`: Number of nodes in shard `i`.
   * `N`: Total number of nodes.
   * `k`: Number of shards.

***

This architecture ensures that Lumora operates as a robust, scalable, and secure decentralized network, supporting optimal task allocation, secure data handling, and fair reward distribution.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.lumoratoken.ai/lumora/architecture-and-technical-framework.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
