## 4 Design and Methodology  
### Proposed Framework  
In this paper, we propose our blockchain-federated learning credit card fraud detection system based on the integration of FL with blockchain technology, as illustrated in Figures 2 and 3.  
Integrating FL and blockchain techniques in our detection system ensures the preservation of privacy and data protection. Federated learning ensures the accurate training of our models by sending the initial model parameters from the global learning model (cloud server) to the local learning model in each fog node (bank) individually. Each fog node represents a different bank with its local learning model. Thus, updates will be sent and received between the local and global learning models until reaching the target with the minimum loss values. Blockchain is a distributed ledger (database) shared among a computer network's nodes, used to store datasets in blocks linked together via cryptographic hashes. Blockchain is a new technology that features decentralized storage, tamper resistance, and traceability [16; 17; 22; 23; 24].  
Figure 2: Proposed fraud detection framework.  
In addition, our framework employs three machine learning and deep neural network algorithms: Random Forest (RF), Convolutional Neural Networks (CNNs), and long short-term memory (LSTM). As demonstrated in our previous work [70], certain algorithms, such as SVM, NB, and LR, did not perform optimally in anomaly detection tasks like ours. Therefore, for this experiment, we constructed our credit card fraud detection (CCFD) system using algorithms known for their high capability and performance in accurately detecting fraud instances, namely RF, CNN, and LSTM. Leveraging their strong performance, these algorithms are poised to yield significant improvements when integrated with other techniques such as federated learning, blockchain, and fog computing. Consequently, we selected RF as the optimal classifier model among traditional machine learning algorithms, while CNN and LSTM were chosen as the deep neural network algorithms.  
A deep learning optimizer is a mathematical function used to improve the weights of the network based on the gradients and other information, depending on the formulation of the optimizer. Hence, we utilize these three optimizers: ADAM, SGD, and MSGD.  
Figure 3: Framework techniques.  
In our previous work [70], we evaluated classifier models using the baseline dataset, and oversampling and undersampling techniques. The dataset exhibits class imbalance, where the number of fraudulent transactions is significantly lower than that of legitimate transactions, leading to reduced prediction accuracy. Resampling the dataset before training the classifier models is crucial to ensure accurate fraud detection. Undersampling techniques, such as NearMiss, aim to address the skewed dataset by retaining transactions close to the minority class and discarding those further away. However, this approach reduces the dataset size, potentially negatively impacting accuracy.  
Moreover, we utilized the Synthetic Minority Oversampling Technique (SMOTE) to balance the dataset and alleviate class imbalance before model training. SMOTE augments the number of minority class instances, effectively addressing the imbalance. We have applied SMOTE in various experiments across different research papers, and its efficiency and effectiveness have been validated when compared to both the baseline dataset and the NearMiss Undersampling technique [70].  
We utilize performance metrics to evaluate our predictive classifier models, including accuracy, precision, recall, F1-score, computation time, and average loss.  
Our proposed framework distinguishes itself by integrating blockchain technology with federated learning, ensuring high privacy preservation and data protection. Additionally, we employ several deep learning optimization techniques to enhance algorithm performance. Collectively, these techniques set our proposed framework apart.