# Blockchain-Based Decentralized Federated Learning Method in Edge Computing Environment
## 1 Introduction  
With the development of new generation information technology such as mobile internet, the number of mobile services and applications is growing exponentially, resulting in the generation of massive amounts of data. It has been shown that there are data security risks in well-known business associations [1]. User data are often stored in the centralized cloud servers of an organization or enterprise and can be accessed without privacy protection, which raises the risk of leakage of user-sensitive data [2]. Google took the lead in proposing a federated learning method [3] to solve the collaborative training problem of privacy protection so that private data can be safely used in a distributed environment. Therefore, federated learning has received extensive attention and research from industry and academia. However, federated learning has its own limitations [4]. It relies on a single centralized server and is vulnerable to a single point of server failure. Additionally, it lacks the incentive mechanism for local devices, which leads to the reduction of the initiative of local devices to participate in the training of federated learning. Blockchain is a decentralized and auditable ledger technique [5] that has become a solution to replace vulnerable centralized servers in insecure environments. By combining with blockchain, the decentralized federated learning method can be realized. However, in the scenario of combined blockchain and federated learning, distributed servers usually use cloud computing to transmit model data [4]. Since cloud servers are physically far from local devices, which will further increase the delay of network data transmission [6],traditional cloud computing techniques will weaken the role of servers in supporting the training process of federated learning models. Additionally, edge computing has become an efficient computing paradigm that sinks computing and storage resources to the side close to local devices [7, 8]. Compared to cloud-based servers, edge servers are closer to local devices and can respond to requests from local devices faster. Applying edge computing to federated learning can further reduce the latency and energy consumption of model training. However, when combining blockchain with federated learning in the edge computing environment, it also faces the challenge of the high cost of network communication [9]. As the number of local devices is large and keeps growing dramatically, local devices need to effectively offload data and tasks to the appropriate server close to the edge side of the network, optimizing the utilization of edge server resources and maximizing the system efficiency. This requires efficient and stable matching between local devices and edge servers [10]. The matching problem is affected by many factors, such as distance, network bandwidth, and computing power [11]. These factors involve new techniques such as node localization [12], and they need to be considered to reduce the overall system latency and energy consumption in the edge computing environment. Meanwhile, as the core of blockchain technique, the consensus algorithm plays a decisive role in the security and efficiency of blockchain [13, 14, 15, 16]. In highly decentralized federated learning with blockchain, all local devices participating in model training will also participate in the consensus process. The communication cost will increase significantly, which is bound to increase the consensus time of the blockchain, thus reducing the efficiency of model training. To address the problems of centralization and lack of incentives in traditional federated learning, this paper proposes a blockchain-based decentralized federated learning method for edge computing environments, named BD-FL. By designing a stable matching algorithm between local devices and edge servers and an optimized consensus algorithm, BD-FL can effectively reduce the overall system delay and speed up the model training efficiency. This paper makes the following contributions.