## 3 Framework Design and Deployment
### Data and Data Preprocessing  
To support the proposed framework effectively, robust data preparation and privacy-preserving mechanisms are critical, especially given the sensitivity of data in IIoT applications. The CIFAR-10 dataset [40] was selected due to its structured organization of diverse image classes, making it ideal for simulating real-world IIoT scenarios. While multiple datasets were considered during the conceptualization phase, CIFAR-10 was ultimately chosen as the sole dataset for experimental evaluation due to its suitability for benchmarking and manageable size, allowing efficient experimentation and analysis within the scope of this study. To ensure robust data privacy and performance, preprocessing integrates Homomorphic Encryption (HE) to maintain data confidentiality during computations. HE enables secure operations directly on encrypted data, eliminating the risk of exposing sensitive information. Additionally, blockchain-based smart contracts enforce strict access control and data traceability, providing an immutable audit trail for all interactions. These mechanisms enhance the integrity and trustworthiness of the data pipeline, ensuring privacy while enabling accurate and secure FL model training. Specifically, a leveled HE scheme, such as CKKS or BFV [41], is implemented to support essential operations like addition and multiplication on encrypted sensor data. This approach enables manipulation of the data while ensuring the raw information remains inaccessible to unauthorized parties. Each data point \(x\) from sensors is encrypted into ciphertext \(E(x)\) via the encryption function \(E(x)=\text{Encrypt}(x,pk)\), where \(pk\) denotes the public key for encryption. This ciphertext is then used in all subsequent computations, which preserves the data's privacy as it flows through the FL model. To enhance data security and streamline management, we integrate blockchain-based smart contracts within the framework. These contracts manage data access and ensure only authorized entities can access and process the encrypted data, safeguarding sensitive information at every stage. Core functionalities of the smart contract include access control, whereby only users with valid cryptographic keys can retrieve or interact with the encrypted data, maintaining secure access across stakeholders. The contract also provides data provenance and auditing functionalities by logging every interaction, creating a transparent record of all data operations. This level of traceability strengthens data integrity and fosters trust within the collaborative learning environment. Moreover, for applications involving multiple stakeholders (such as in an FL setup), the smart contract automates data sharing agreements, ensuring that data exchange is controlled and unauthorized access is prevented. Once encrypted, data undergoes processing for machine learning model training. The HE scheme enables privacy-preserving computations, allowing machine learning algorithms to operate directly on encrypted data without decryption. For each encrypted data point \(E(x)\), mathematical operations, such as summation and multiplication, can be applied to the ciphertext itself. For instance, the encrypted sum of data points \(E(y)=E(x_{1})+E(x_{2})\) can be computed directly from the encrypted inputs \(E(x_{1})\) and \(E(x_{2})\). This capability is extended to more complex operations, such as gradient descent, which is essential for model optimization in machine learning. By performing these operations on encrypted data, the framework preserves the privacy of sensor data throughout the training process. Furthermore, after training, critical model outputs, such as the model weights, remain encrypted and can only be decrypted by authorized parties with access to the private decryption key. After the machine learning model completes training, authorized personnel decrypt the encrypted results to evaluate model performance.