# CS-FL: Cross-Zone Secure Federated Learning with Blockchain and a Credibility Mechanism
## 3 System Model
### Framework and Workflow  
The Zone-Chain network consists of a dual-layer architecture comprising the server layer and the edge layer, as shown in Figure 1. The server layer is formed by ZSs covering different zones, connected via wired networks. These ZSs include communication infrastructures and computing resources. The traditional FL central server is replaced by a blockchain network, with each ZS acting as a consensus node. The use of blockchain can introduce a blockchain ledger to record information and real-time indexes of ENs (as defined in Section 4). The edge layer consists of ENs holding local data, which communicate with ZSs via wireless networks. When an EN is within the service zone of a ZS, it can apply to participate in FL.  
A standard FL scenario is considered, consisting of a set of ENs, denoted as \(N=\{1,2,\ldots,n,\ldots,|N|\}\), and a set of ZSs, denoted as \(M=\{1,2,\ldots,m,\ldots,|M|\}\), where ENs are randomly distributed within a ZS's service coverage. Each EN \(n\) holds a local dataset \(D_{n}\) with size \(|D_{n}|\). Upon initial entry, EN \(n\) enrolls in Zone-Chain and obtains a unique digital identifier \(\mathrm{ID}_{n}=\mathrm{Hash}(\mathrm{name}_{n},\mathrm{CPU}_{n},\mathrm{ Data\ Digest}_{n})\) by hash operation on its name, CPU serial numbers and message digest [23] of \(D_{n}\). The function \(\mathrm{Hash}(\cdot)\) used in this work is SHA-256, a cryptographic hashing algorithm that produces a fixed-length 256-bit output regardless of the size of the input, ensuring a high degree of uniqueness and resistance to collision under practical conditions [24].  
In the \(i\)-th round of FL, EN \(n\) in selected set \(S_{i}\) performs local training with local datasets and global model of last round \(\bar{w}_{i-1}\) to compute local model \(w_{n,i}\), by solving the problem of minimizing the loss function \(f(\cdot)\):  
\[f(D_{n};\bar{w}_{i-1})=\frac{1}{|D_{n}|}{\sum_{j=1}^{|D_{n}|}}\mathrm{Loss}(\{ x_{j},y_{j}\};\bar{w}_{i-1}) \tag{1}\]  
where \(\{x_{j},y_{j}\}\in D_{n}\) represents each data-label pair in the local dataset. The equation \(\bigtriangledown g_{n,i}=w_{n,i}-\eta\cdot\bar{w}_{i-1}\) represents the local parameter update, where \(\eta\) is the learning rate. In the case of stochastic gradient descent (SGD) [25], the gradient \(\bigtriangledown g_{n,i}\) is typically computed as the partial derivative of the loss function with respect to the model parameters,  
Figure 1: Overview of the proposed Zone-Chain framework.  
estimated using a mini-batch of data. In this work, SGD is used for training the local model, where the parameters are updated iteratively based on mini-batch gradients computed from the local data.  
Once the local training reaches a certain number of iterations, \(\bigtriangledown g_{n,i}\) is uploaded to the corresponding ZSs. After ID\({}_{n}\) is verified, the local model is packaged and sent to Zone-Chain for aggregation of \(\bar{w}_{i}\):  
\[\bar{w}_{i}=\bar{w}_{i-1}+\frac{\sum_{n\in S_{i}}|D_{n}|\bigtriangledown g_{n,i }}{\sum_{n\in S_{i}}|D_{n}|} \tag{2}\]  
After the \(i\)-th round of FL, Zone-Chain broadcasts \(\bar{w}_{i}\) to each ZS. The above steps will be repeated until the global model converges or achieves the desired accuracy.