# TDLearning: Trusted Distributed Collaborative Learning Based on Blockchain Smart Contracts
## 3 Method
### Architecture of TDLearning  
Effective collaboration based on decentralised data resources and the use of smart contracts to ensure a trustworthy and fair collaborative process are the goals of the collaborative-learning mechanism proposed in this paper. Blockchain smart contracts are utilised to establish and capture collaborative behaviours and connections in this paper. Specifically, in this study, the distributed-collaboration process of the collaborative-learning mechanism is defined as a collaborative task, and a smart contract defines and encapsulates the collaborative relationship between the actors and nodes in the task, acting as a medium of communication and trust. At the same time, a model-fusion method based on feature fusion is proposed based on the idea of migration learning. Instead of the direct sharing of data resources, distributed-model collaboration training is used to organise dispersed data resources for effective distributed collaboration. The overall architecture of TDLearning is shown in Figure 1. The mechanism consists of six smart contracts, which are defined and encapsulated into three types of functional modules: role-authority management, trusted database construction, collaborative task management and collaborative incentive allocation. Authority management is implemented by the authority-management contract (AMC), database construction is based on the data-retrieval contract (DRC) and the data-evaluation contract (DEC) and task-process management and motivation are based on the task-management contract (TMC) and the task-incentive contract (TIC). The node in the mechanism contains four types of roles, namely supervisor, task owner, task participants and model verifiers. The roles and their corresponding collaborative behaviours are shown in Table 1. From the perspective of each node participating in the collaborative training of the distributed model, the collaborative-learning mechanism consists of the following three steps in total. \begin{table}
\begin{tabular}{p{130.1 pt} p{284.5 pt}} \hline \hline
**Role** & **Collaborative Behaviours** \\ \hline \multirow{4}{*}{Supervisor—_Su_} & (1) Smart contract deployment and collaborative node authority management. (2) Collaboration task access audit and collaboration node on-chain behaviour monitoring. (3) Initiation of smart-contract-function execution, such as data-quality assessment, contract incentive, etc. \\  & (1) _To_ issues global-model-development tasks, specifying pretrained model structures as well as standard test sets. (2) _To_ registers on-chain tasks via smart contracts and completes the incentive funding pledge. (3) After receiving all the validated pretrained models, _To_ completes global model fusion and fine tuning locally. (1) _Tp_ registers local private data by using a data-management contract, which participates in the collaborative-learning task as a data node. (2) _Tp_ uses the specified model structure to develop pretrained models locally by using the private data. (3) After the pretrained model is verified, _Tp_ receives automatic motivation from the smart contract. (1) _Mv_ completes pretrained model verification based on the standard test set given by the task owner and uploads the validation results via the smart contract. (2) After the smart contract reaches a consensus on the pretrained model validation, _Mv_ receives an automatic incentive from the smart contract. \\ \hline \hline \end{tabular}
\end{table} 
Table 1: The description of notation symbols used in TDLearning. Figure 1: Overall architecture of TDLearning: (1) Smart contracts define and encapsulate collaborative relationships, behaviours and specifications between collaborating nodes. (2) Collaborative model training: a model-fusion approach based on feature fusion. _Tp_ uses its local data to develop pretrained models. * _Mv_ verifies all pretrained models by using the standard validation set provided by _To_. * _To_ receives a validated pretrained model, and model fusion is completed by using its local data to develop the global model.