# pFedBASC: Personalized Federated Learning with Blockchain-Assisted Semi-Centralized Framework
## 4 Methodology
### Block Structure Design  
The design of all blocks in pFedBASC includes three parts: _header information_, _model information_, and _validation information_ as shown in Figure 3.  
* _Header information_: The block header primarily records information necessary for blockchain's historical records and traceability. This section consists of three standardized pieces of information: the block ID, which provides a unique identifier for the current block, allowing other blocks to distinguish and reference it; the timestamp, which records the time when the block was added to the chain, facilitating subsequent tracebacks and timeline construction for any anomalies; and the block type, which indicates whether the block is a _download_, _evaluation_, or _upload block_, aiding in the subsequent processing of block-specific information. Additionally, the client ID records the identification information of the client involved in the operation, facilitating the traceability of the actor. * _Model information_: This part contains the information and attributes necessary for the FL training process. It is strongly related to the block type, and detailed descriptions will follow based on the type of block involved. * _Validation information_: The block includes data crucial for verifying the accuracy of the content within the blockchain. By recording the previous hash of the parent block and the current block's hash, the blockchain's tamper-proof nature is ensured, preventing attackers from compromising the integrity of the blockchain by altering a single block. Based on the above block design, certain personalized designs were made for blocks with different functions to support the designated functions of the blocks. Figure 3: The training procedure of pFedBASC and the design of the block structure. * _Download Block:_ Blocks record the model parameters that a client downloads from the blockchain system. This enables the system to update the contribution score of the model's uploader or provide rewards based on intellectual property rights. Moreover, suppose a client's local model encounters security issues or errors. In that case, the download records can be traced to determine if the problem originated from a model stored in the blockchain system, thus ensuring traceability. In the _header information_ of a download block, the client ID records which client performed the download, facilitating traceability. The _model information_ section records which uploaded block's model parameters were downloaded, specifically noting the block ID where the model parameters reside. Recording the block ID instead of the model parameters effectively reduces the storage space required for this block. * _Evaluation Block:_ Blocks are tasked with recording a client's evaluation of model parameters within the blockchain system. Primarily, they log the loss function value derived from model inference on this client, allowing the system to track and record the quality and reliability of a particular model's parameters. This tracking can inform incentives for the clients who uploaded the high-quality model parameters, thus encouraging high-quality training. In the _header information_, the evaluation block's client ID identifies which client performed the evaluation, enhancing traceability. The _model information_ section records which uploaded block's model parameters were evaluated, including the block ID and the corresponding scores. This paper primarily designs and discusses evaluation blocks, without delving into their further utilization. * _Upload Block:_ Blocks are designated for storing new rounds of locally aggregated model parameters from a client. They are crucial for providing other clients with reliable model parameters for aggregation, aimed at enhancing the accuracy and generalizability of local models across clients. In the _header information_, the upload block's client ID indicates which client uploaded the model parameters, ensuring traceability.