# System Architecture Overview

The system architecture for this project is designed to enable **instant, secure, and cost-effective cross-border transfers** by integrating blockchain infrastructure (Lightspark), banking partners (ClearBank, MFB), and middleware services (PCX). It follows a layered approach to ensure scalability, security, and compliance.

### 1. User Interface Layer

* **Lightway Finance Web/Mobile Platform**:
  * Customer portal for registration, KYC/AML verification, and UMA assignment.
  * Transfer initiation and tracking dashboard.
  * Notifications (transaction status, confirmations, alerts).
* **Admin Dashboard**:
  * Node funding and balance monitoring.
  * Transaction tracking and reporting.
  * Liquidity alerts and channel health indicators.

### 2. Application Layer

* **Customer Management Service**: Handles account creation, UMA assignment, and user profile management.
* **Payment Orchestration Service**: Routes customer-initiated transactions through the integration layer.
* **Admin Control Service**: Provides secure access for Lightway operators to manage node settings and liquidity.

### 3. Security Layer

* **KYC/AML Compliance**: Identity verification at registration (integrated with Nigerian and UK regulatory systems).
* **Encryption & Tokenization**: Secure handling of customer data and transaction details.
* **Access Controls**: Role-based permissions for customers, admins, and technical operators.
* **Fraud Monitoring**: Automated detection of unusual transfer patterns.

### 4. Data Layer

* **Customer Data Repository**: Stores account, UMA, and compliance records.
* **Transaction Ledger**: Tracks transaction metadata (status, timestamps, settlement reference).
* **Audit Logs**: Immutable logs for regulatory and operational auditing.

### 5. Integration Layer (Powered by PCX)

* **Lightspark API Integration**:
  * Lightning Connect for routing payments over the Bitcoin Lightning Network.
  * UMA services for address resolution.
* **ClearBank Integration**: GBP deposits, payouts, and settlement handling.
* **MFB Network Integration**: NGN deposits, withdrawals, and account reconciliation.
* **Middleware Services**: Data transformation, error handling, retry mechanisms, and transaction monitoring.

### 6. Infrastructure Layer

* **Cloud Hosting Environment** (e.g., AWS/Azure/GCP): Hosting of application services, APIs, and admin dashboard.
* **Lightspark Grid**: Operates the Lightning node and ensures uptime and scalability.
* **Disaster Recovery & Redundancy**: Backup systems and failover mechanisms to guarantee 24/7 service availability.

### Simplified End-to-End Transaction Flow

* Customer registers → assigned a **UMA**.
* Customer initiates transfer via Lightway platform.
* Transaction request sent to **PCX Integration Layer**.
* PCX routes request to **Lightspark API** → processed over the Bitcoin Lightning Network.
* Funds received via **ClearBank (GBP)** or **MFB APIs (NGN)** depending on corridor.
* Confirmation sent back to customer with transaction details.
