Blockchain managed federated learning for a secure IoT framework

In this work, we present a blockchain-based federated learning (FL) framework that aims achieving high system efficiency while simultaneously addressing issues relating to data sparsity and the disclosure of private information. It is more efficient to build a number of smaller clusters rather than one big cluster for multiple networks. Blockchain-based FL is carried out in each cluster, with the model changes being compiled at the end of the process. Following that, the accumulated updates are swapped across the clusters, which, in practise, improves the updates that are accessible for each cluster. When compared to the extensive interactions that take place in blockchain-based FL, cluster-based FL only sends a limited number of aggregated updates across a substantial distance. This is in contrast to the extensive interactions that take place in blockchain-based FL. In order to conduct an analysis of our system, we have implemented the prototypes of both cluster and blockchain-based FL models. The findings of the experiments show that cluster-based FL model raise the accuracy goes upto 72.6%, and goes down to 11%. The loss goes upto 3.6 and goes down to 0.8. In addition, cluster-based FL model has the potential to hasten the convergence of the model, provided that the same quantity of data is input into it. The reason for this is due to the fact that during a training cycle, cluster-based FL model combines the computational resources of many different clusters.

susceptible to security breaches.Because of this, there is a chance that the centralized server won't perform well, and thus leaves the framework vulnerable.The blockchain technology that is capable of working in conjunction with it, is on the horizon [5].The usage of a blockchain makes it feasible to provide decentralized control over the aggregation of model update information as well as safe operation orchestration [6].
In this study, we combine blockchain technology with fuzzy logic to develop a new kind of logic known as blockchain-based fuzzy logic.Because of the emphasis placed on system design and algorithm optimisation [7], a major problem associated with data sparsity in a blockchain-based FL cluster [8] is not taken into consideration.As an example, when an IoT network goes into service for the very first time, it is only capable of holding very few data samples due to its early level of development.A further consideration is that if there are just a few IoT devices in a network, it will use the blockchainbased cluster to gather sufficient data in an excessive amount of time.
The quality of the data samples may be improved in an easy manner by expanding the size of a blockchain-based FL cluster in such a way that it incorporates the maximum number of devices that are technically possible.It's possible that these devices are spread out over a number of different networks, some of which are quite far from one another.As a direct consequence of this, the network delay that exists between devices has the potential to be very substantial.On the other hand, the blockchain technology that is now being used in the cluster necessitates consistent communications all over the network in order to accomplish the goal of reaching a consensus.It is possible that both the efficiency of establishing a consensus and the efficiency of the system that corresponds to it are quite subpar when seen in their whole.This is due to the fact that communications with a high latency and frequency are the reason.In addition to this, a blockchainbased FL cluster has the requirement that any modifications made to the models must be broadcast across the FL cluster.According to the results that Wang et al. came to, it is possible to partially reassemble the private data by making use of the model's most recent changes [9].Since a result of this, the possibility of data privacy leakage grows proportionally with the size of the cluster's scope.This is especially true when the cluster is formed across more than one network, since this multiplies the number of networks that are involved.
In addition, the aggregated updates hide the precise changes that are applied to each node, which helps to secure the privacy of the data more effectively [10].
Inter-cluster and intra-cluster protocols have been proposed to exchange cross-cluster models in a safe manner.The single-chain consensus and the cross-chain consensus are two types of sub-protocols that are used in both intra-cluster and inter-cluster, respectively.While intra-cluster is simple and straightforward, making it easy to grasp, it is inefficient as a system and may be regarded the foundation of inter-cluster.The intra-cluster mechanism is suggested as a means of making the system more efficient.In particular, intra-cluster will regularly pick a cluster representative to carry out model aggregation, which will ultimately result in a reduction in the number of occasions when sluggish cross-chain agreement is reached.
In a nutshell, the following are the most significant contributions we've made: We highlight the challenge that is presented by the currently available blockchainbased FL model solutions, which are referred to as the issue of data sparsity and the problem of poor efficiency combined with privacy leakage.We suggest the use of cluster-based FL model as a solution to this problem.Cluster-based FL model prototypes, i.e., inter-cluster and intra-cluster are built, and comprehensive tests are carried out to establish the technology's practicability and effectiveness.

Motivation
Within the framework of IoT-based cloud network the blockchain-based FL is often taken into account within a constrained amount of space.The use of blockchain in a cloud network, needs all of the equipment are located in close proximity to one another and are linked by a LAN (Local Area Network) that is capable of fast speeds is an example that is often used.
However, the blockchain-based system could have certain problems since it was intended for a restricted amount of area.To begin, there is a possibility that there are not enough dataset samples to obtain a reasonable model in such a constrained area.This is particularly the case when the IoT devices have only been in operation for a short period of time.In this respect, the newly developed technologies are required to go through a protracted time in which they are unable to reap the advantages of the machine learning technology.To find a solution to the problem, a region that lacked adequate data would look to other regions for more data to augment their own.Second, when it comes to a job involving machine learning, having more data often results in a more accurate model.Because there may be numerous locations containing the data, each of which may have a feature space or sample space that is comparable to the others, these areas have the potential to collaborate in order to produce a model that is superior than any that is specific to a single area.
The problems described above encourage academics to use data from a variety of sources.A straightforward answer is to create a large blockchain-based FL cluster that acts as a collection point for several devices that are scattered over numerous locations or cluster.There are two distinct kinds of device communication that might take place inside a cluster: intra-cluster and inter-cluster.
The first method is carried out by means of a LAN (Local Area Network) that operates at a fast speed inside a cluster, while the second method is backed by a WAN (Wide Area Network) that operates at a slow pace across clusters.
For the blockchain technology to be used in the cloud network system, the devices that make up the network must be spread out throughout the clusters.It is possible that the FL process will go more slowly as a consequence of the lengthy delay that may be caused by communication between different nodes.Consequently, it seems to be impracticable to construct a broad blockchain-based FL cluster spanning a number of different nodes.
To our good fortune, maybe there is another way for us to investigate this matter.Because the blockchain-based FL framework is more applicable to a limited space, for the purpose of providing high efficiency, one possible course of action would be to implement blockchain-based FL in each network on its own and then trade blockchainbased FL models across the various networks.When seen from this angle, the longlatency communications that occur between networks might experience a significant amount of margin reduction.

Related work
Several research have been conducted to investigate the feasibility of a successful collaboration between FL and blockchain technology.The issue of sparse data is addressed in almost none of these publications, despite the fact that many papers focus on the integration of systems or the optimisation of algorithms.On the other hand, the immediate deployment of existing cross-chain technology to unite a large number of FL clusters is now thwarted due to inefficiencies or problems with centralization.Because of the decentralized nature of blockchain technology and the traceability it offers, there has been a lot of consideration given to incorporating it into FL.
BFL is used in a broad range of applications, such as the Internet of Things (IoT), the Internet of Vehicles (IoV), and Mobile Edge Computing [11], with the ultimate goal of enhancing resiliency [12], while also protecting privacy [10].
To be more specific, Bao et al. [12], Kim et al. [13], and Pokhrel et al. [14] all suggest designs that, if implemented, would make it feasible to carry out FL in a manner that is truly distributed.Kim et al. have made the recommendation that devices that collect a greater quantity of data should also contribute the compensatory mechanism to the global model.This provides an additional incentive for data-rich devices to upload even more of their data.However, none of these methods solves the fundamental issue, which is that any device that is part of a cluster is only able to access a tiny portion of the total data that is accessible.
In order to ensure that users' personal information is protected during data exchanges in the IoT network, Lu et al. [15] combined the FL tasks with the consensus computing activities.However, they only consider optimizing the method and do not take into account the possibility that a FL cluster may have an issue with data being sparse.In summary, each and every previous piece of research has tested the idea that the data contained inside a cluster is all that is necessary to construct an accurate model.
In addition, there have been ongoing attempts made to group together all of the blockchain's nodes, after which they will be arranged as a single chain.It is possible that the nodes will be dispersed over a vast region, which will cause an increase in the amount of work for the communications infrastructure of the network.
A number of cross-chain solutions [16] have been offered in order to facilitate the information exchange that occurs across various implementations of blockchain technology.This collection of technologies may be classified in a number of different ways [17], the most frequent of which are the notary, sidechain/relay, and hash-locking categories.
In recent years, academics have made a number of strides forward in fields relevant to the development of cutting-edge technologies, such as blockchain, smart networks, the Internet of Things, and software-defined networks.
The concept of a smart distribution network was introduced and studied in Kazmi et al. 's study [18], which was conducted within the context of the smart-grid paradigm.They put an increased emphasis on the procedures that were connected with implementation and were included into the planning model for the intelligent distribution network.Separately, Huang et al. [19] suggested an architecture for intelligent networks that would combine intelligent operations that were made possible by artificial intelligence, were driven by vast volumes of wireless data, and were made easier by network function virtualization.This architecture for intelligent networks would be used in intelligent networks.The Quality-of-Service (QoS) objective was also accomplished since the authors made it possible for mobile users to connect to the network that offered the highest possible level of service at a cost that was within their financial means.
Takenaka et al. [20], on the other hand, presented an illustration of a smart network and researched the use of IoT data in industrial environments.In order to achieve goals such as mass customisation or the development of new services, the need of having a suitable data format and analytical techniques was emphasized in this article.In recent research [21], Chakrabarty and colleagues developed a blueprint for the creation of safe and efficient smart cities. Notaries are required to cooperate with one another to guarantee that each stage in the notarization process is carried out accurately [22,23].On the other side, growing centralization brings forth a whole new challenge.
In this paper, we present the need of an integrated framework for safeguarding the privacy of users while simultaneously optimising the partitioning of applications, the allocation of resources, and the placement of service caches.The aforementioned issues, however, involve variable delays that are sensitive, and as a result, the issue of overall optimisation is highly tough.
Deep learning [9] and blockchain technology [10] have attracted a lot of attention from edge computing specialists in recent years.When it comes to making judgements in real time for things like autonomous resource allocation and robotics, wireless communication networks (4G and VANET) significantly depend on deep learning.Inside the widely dispersed edge nodes, blockchain offers reliable connectivity and administration of computing, communication, and storage resources [10].This provides a strong impetus for the urgent investigation of a unique scheduling strategy that is supported by deep learning and blockchain technology.In addition, FL [14,15], and [11] (federated learning) is regarded as a valuable resource for the purpose of training deep learning agents in a manner that is decentralized.This is due to the fact that FL is capable of preventing unauthorised access to sensitive information at all stages of the training process.
In example, the status of the various chains would be inconsistent in the event if the notaries did not operate as expected or behaved maliciously.The sidechain and relay method makes it possible for one chain to watch the operations taking place on another chain and do the actions that are appropriate in response.Before any of the other chains will acknowledge it as valid, every action in a chain has to get approval from the consensus.Because reaching agreement often involves a significant amount of delay, this drastically lowers the efficiency of the activities that take place across chains.The hash-locking system allows for cross-chain atomic actions to be performed without depending on any third-party organizations or individuals.

Proposed method
When linked with machine learning (ML) technology in cloud IoT networks, Blockchain technology plays an increasingly essential role related to the security in the network.The traditional machine learning technique, on the other hand, calls for the acquisition of data from a wide variety of devices.This might result in a major breach of privacy in the IoT situation, in which the data in question is very privacy-sensitive.
In order for the researchers to protect the consumers' privacy without compromising their experience, they need to take into consideration the federated learning (FL) technology.The objective of FL is to carry out machine learning in a distributed manner, without first bringing all of the data together as a centralized repository [4].FL starts the process by asking that each node carry out a local training job throughout each round of the process.After this, FL combines the model alterations in order to get it ready for the subsequent round of training.This is achieved by the use of a procedure that moves forward one round at a time.There is a centralized server in the architecture of FL that is used to coordinate the training activities and aggregate the model updates.This is the design that is utilized by default.Additionally, the model is stored on this server.On the other side, this leads in various difficulties that are linked with centralization, such as single-point failure and hostile behavior.Centralization is related with these issues because it increases the likelihood of their occurring.
The distributed ledger technology (blockchain) is being implemented into FL [10] as a solution to the problems caused by centralized servers.Blockchain technology, which originated with Bitcoin [24], is anticipated to facilitate peer-to-peer collaboration in a manner that is independent of centralized authority [5].Through the use of the consensus method, the coordination of training activities and the accumulation of model updates may be carried out in a decentralized manner using the blockchain system [25].Since the blockchain may be conceived of as a tamper-proof record, it is less likely that a peer would act irrationally because of its presence.In addition, since the model modifications that are recorded on the blockchain are both auditable and traceable, this will discourage them from engaging in such activity.The following is one way that the blockchain technology-based FL may be modeled.Let's say that blockchain technology-based FL is being used in cloud IoT network, and that each of the devices in the network is part of a cluster.In the following, the word 'node' will be used interchangeably with 'device' while referring to IoT cloud network, and the term 'cluster' will be used when referring to devices.Let's say that the training dataset is split up across N nodes that (i = 1, 2 . . ..N ) in a blockchain technology-based FL clus- ter, and that each node n i has s i samples of its own.
When training a distributed model, the gradients from all of the working nodes first need to be aggregated into a single value before they can be utilized to make adjustments to the model weights.On the other hand, it's possible that the gradients coming from the various worker nodes won't be in sync with one another because of network latency and other variables.Because of this, the weights of the model can end up being changed in a way that is incompatible with the gradient as a whole.Due to stochastic gradient descent (SGD) and the utilization of mini-batches, the gradients that are computed by each worker node have a possibility of being noisy.When these gradients with their inherent noise are added together, the final gradient can have an even higher level of inherent noise.Because of this, the weights of the model could end up being updated in a way that is inconsistent with the actual gradient of the data.There is a possibility that the magnitudes of the gradients computed by each worker node will vary.This is because of a number of factors, including the fact that various worker nodes will have varying data distributions.Because of this, the model weights might end up being changed in a way that gives preference to the gradients coming from the worker nodes that provide the biggest magnitudes.
The goal of the training for node n i is to minimise f i (w) , which is defined as follows: where x i (m), y i (m) is the sample indexed by m in node n i k and L x i (m), y i (m), w is the loss function that has to be used in order to create a prediction based on this sample.In circumstances in which the learning model is known as a deep learning model, and the method used is gradient descent is especially used in order to reduce the total amount of model loss.The steps involved in the computation are as stated below: in where t and η are the number of steps in gradient descent and the learning rate of that descent respectively.The gradients ∇f i (w t ) are computed for the function f i (w t ).
On the basis of the model updates obtained from single-node learning, blockchain technology based FL makes an effort to aggregate all of the model updates received from the many nodes that make up the cluster.The following is its intended training goal function , where M refers to the total number of samples in the training dataset.
A gradient aggregation strategy is offered as a means of determining the value of w that will result in the lowest possible value for the training objective function G train (w) .This value will be determined by calculating which value of w will result in the lowest possible value.To be more specific, when employing this method, each node supplies its very own local gradient, and the other nodes subsequently aggregate the gradients in order to construct a new model:

Cluster-based FL design
We present a cluster-based FL framework, which links different blockchain-based FL clusters in order to construct a learning model.This is done in order to solve the challenges posed by blockchain-based FL data sparsity as well as its high latency connection.The comprehensive system overview of cluster-based FL uses the example of two networks as a basis for discussion.To be more explicit, one instance of blockchain-based FL is run at each cluster, and the cluster that each network devices comprise is made up of all the devices in that cluster.At the conclusion of each training cycle in FL, the most recent model changes are distributed across all of the clusters.After that, we go on to developing further the structure of the cluster-based FL framework.Consensus may be reached either quickly or put off till later.In the cluster-based FL model that is proposed, we combine the model updates (such as gradients in a deep learning model) from many blockchain-based FL clusters into a single set.This allows us to make use of more data features and produce a more accurate model.It is anticipated that the cluster-based FL (1) model would acquire equivalent model performance in comparison to that of the blockchain-based FL model, which is composed of all of the nodes across clusters; nevertheless, it may operate more efficiently.The mathematical model of cluster-based FL model, which is based on the blockchain-based FL model.Imagine that there are C b blockchain-based FL clusters, and that each of these clusters C b has a training dataset that consists of n b samples, where b = 1, 2, . . ., M are the num- ber of clusters.Following this, we will construct the cluster-based FL model in order to link the M blockchain-based FL clusters.The overall training goal of cluster-based FL is seen from the perspective of the cluster as a whole.Blockchain-based FL is more secure than traditional FL because it uses cryptography to protect the data and the model.This makes it more difficult for attackers to steal or tamper with the data or the model.Blockchain-based FL is more privacy-preserving than traditional FL because it uses a decentralized network to train the model.This means that the data never leaves the clusters, which protects the privacy of the data.Blockchain-based FL is more trustworthy than traditional FL because all transactions are public and verifiable.This helps track training progress and ensures independence.Blockchain-based FL is more scalable than classical FL since it trains models utilizing data from several clusters.This lets models be trained on larger datasets, which may boost efficiency.
Blockchain-based FL implementation is tough.Blockchain-based FL is harder to implement than regular FL since it requires blockchain technology.It might be challenging to install and keep up with blockchain technology due to its complexity.Because of the added cost of implementing blockchain technology, blockchain-based FL may be more expensive than conventional FL.Costs associated with implementing and maintaining a blockchain system might be high.The scalability of blockchain-based FL is an open question, as it has not yet been tested on significant datasets or large numbers of clusters.The method known as gradient descent is also utilized in order to ascertain the value of w that yields the best results.The blockchain-based FL used in each cluster during each stage of the gradient descent process is responsible for determining w.w is then sent between clusters, and the results are tallied by each cluster separately after they have been transferred.
The aggregated updates in cluster-based FL are represented as where the numbers n i and M represent the total number of nodes that are present in all of the clusters combined (C i ) and the number of nodes that are found in each individual cluster, respectively.In addition, the value of N represents the total number of samples that were applied to each of the different clusters.As a result, we come to the realization that the gradient descent procedure utilized by the blockchain-based FL framework is identical to the one utilized by the cluster-based FL model.

The proposed model architecture
The cluster-based gradient aggregation between two networks as an overview of clusterbased FL.In order to carry out FL, a permissioned blockchain system is constructed in each cluster, which is formed when Internet of Things (IoT) devices in a cloud network come together to form a node.
• The gradients that are accumulated in network B are those that have been transferred from network A, where they were first produced.In a way that is more tangible, the on-device training that is undertaken in order to generate a local model update (also referred to as FL training) is carried out by every device and node that is part of network A. • The updated gradients of the model are then broadcast throughout the network, where they are finally recorded on the blockchain ledger by means of the intra-chain consensus for FL (sometimes referred to as the FL consensus).• During the process of reaching a consensus, the gradients from each of the several devices are added together.In point of fact, each of the aforementioned three processes goes through one cycle of blockchain-based FL in network A. • After then, the accumulated updates are sent from network A to network B through a process known as "gradient exchange."After the device at network B has downloaded the updates, it will perform a twofold validation against the downloaded updates.

Data transaction structures
Because the data structures associated with machine learning are equivalent to those found in the traditional one, our primary emphasis will be placed on the structures that are important to the blockchain system.In cluster-based FL, there are primarily four distinct transaction structures, each of which corresponds to a different consensus aim.These transaction structures are referred to as gradient transactions, confirmation transactions, application transactions, and reward/punishment transactions.
After the conclusion of the on-device, local training, which includes the gradient updates, every device will then provide the gradient transaction.It is crucial to note that the aggregated gradients are stored in a separate transaction from the original gradients that were supplied by the devices.You may find this data in the aggregated gradients exchange.You can tell by looking closely at the red area of the emblem.The confirmation transaction, which can be used for either the acceptance or reception consensus, is recommended by the block packager.Both agreements are achieved via the utilisation of the transaction.This means that a confirmation-type transaction may contain either the gradients or the receipts.
There are two distinct processes that make up the mechanism that is used to arrive to a FL consensus inside a cluster [26].These two sub-protocols are referred to by their respective names, which are the intra-cluster chain consensus and the inter-cluster chain consensus, respectively.
The Two-Phase Commit (2PC) protocol was developed in response to the Two-Phase Commit (2PC) protocol that is widely used in the database industry [27].This protocol allows for the secure transfer of data between two clusters.The intra-cluster chain protocol is a cross between the conventional single-chain consensus and the 2PC approach.Both of these methods are used to reach consensus.This is as a result of the speedy operation of participating nodes after they have received the revised model as a result of employing this protocol.This has come about due to the fact that this protocol has been used.The explanation for this is that they have got the most recent version of the model.It illustrates the steps that need to be finished in order to finish the intra-cluster chain method.
In addition, the 2PC procedure can be broken down into two distinct steps, which are respectively known as the "prepare" stage and the "merge/discard" stage.Both of these stages are denoted by their respective names.During the phase that is referred to as "prepare," the single-chain consensus for each cluster is utilized in order to evaluate the appropriateness of the model modifications that have been conveyed from one cluster to another.In order to be more specific, each device will check the adjustments that have been received on the local dataset, and then decide whether or not to delete them, erase them entirely, or combine them with the dataset that was received from the distant cluster.In the event that this does not take place, the modifications that were made locally and the changes that were received will not be integrated.In this respect, the cluster will remove the updates that have been received, and only the changes that have been made locally will be put into the subsequent round of training that will take place.

Cluster chain protocol
Although it seems that in cluster-based FL framework the intra-chain consensus is functional, this approach faces the significant obstacle of having a poor level of system efficiency.In order to complete one cycle of intra-cluster chain protocol, each cluster must first reach three different local consensuses.One of the three consensus processes is in charge of collecting the updates that are sent by the various nodes that are part of a cluster, while the other two are responsible for the data interchange that occurs across different clusters.Since attaining agreement on the blockchain takes so much time, a cluster-based FL architecture with inter-chain consensus may have a very low degree of system efficiency.This is especially true when there are a large number of nodes to consider.One approach that has been suggested to address this concern is the "inter-cluster chain."It might be a choice among several.In this tactic, representatives are chosen to speak for each group, and a system is set up to both reward and penalise them based on their performance.
Inter-cluster chains will often choose a leader in each cluster to ease the administration and coordination of learning on a global as well as a local scale.This is done in order to meet the needs of the inter-cluster chains.This specific individual serves in the capacity of a liaison, acting to facilitate communication between the various organizations.The term "this is done with the intention of" derives from the fact that the action is being made with the purpose of mitigating the negative impacts of making an excessive number of decisions by unanimous vote.This is where the phrase "this is done with the intention of" comes from.The Inter-cluster chain protocol advises that the representative take out a mortgage on part of their assets and develop a reward and punishment system that is suited to the representative's habits in order to dissuade the representative from engaging in malicious activity.This is done in order to prevent the representative from engaging in malicious behavior.This is done in the hope of reducing the likelihood of the representative engaging in deceptive or harmful behavior.This is done with the hopes of discouraging the representative from behaving in a manner that is not acceptable.
In contrast, a cluster-based FL round in intra-cluster chain does contain both the intra-chain consensus as well as the inter-chain consensus in its protocol.However, a round in cluster chain protocol does not include either.Instead, it is the responsibility of the representative to collect and organize all of the most recent updates that have been sent from the many nodes that comprise this cluster.In addition, it is responsible for deciding whether the changes from the remote cluster should be merged or discarded.It is anticipated that the overall system efficiency of cluster-based FL with Intra-cluster chain would be significantly enhanced as a result of the elimination of wasteful consensus in a round.
The 'commit/rollback' phase is the one that the system moves on to after the 'prepare' phase, which is the phase in which agreement was reached.During this phase, the results of the consensus are relayed to the remote cluster, and modifications are made if necessary.If adjustments are required, this step concludes with those adjustments being made.Operations that were finished during the previous cycle are committed, and a new cycle begins if the results of consensus polls conducted on both the local and remote clusters indicate that it is likely that an acceptance will take place.A new cycle begins if the results of consensus polls indicate that it is likely that an acceptance will take place.In the event that this hypothetical scenario was to play out, the activities that were performed during the cycle before it would be reversed, and each and every one of the processes that were performed during the cycle before it would be rendered null and void.It is necessary to underline that the rollback does not imply a split in the blockchain, as this point cannot be emphasized, and it is important to note that this does not mean that the blockchain has been split.Only the transactions that brought about changes during the cycle before it is removed from the blockchain ledger, but all of the actions that brought about those transactions are still recorded as having taken place.This ensures that the integrity of the blockchain is maintained.

Results and discussion
In order to determine how well our framework works, we have implemented correspondingly mechanisms that have been proposed for intra-cluster protocol.The intracluster protocol is superior than inter-cluster protocol and the majority of our tests are performed on intra-cluster protocol.
In our studies, each computer serves as a node or device.The nodes are spread over two networks (A and B), each of which considered to have either 10/20 or 30 nodes.The blockchain system that has been implemented is a permissioned blockchain.We use the learning task, which is a need that often arises in the context of cloud IoT network The evaluation of cluster-based FL is carried out by including the performance of the model, the speed of convergence, and the latency of the system.
In this part of the article, we will compare the performance of the model using intracluster protocol.When it comes to blockchain-based FL, we create clusters of varying sizes, with nodes 10, 20 and 30.The results of the experiments are shown in Figs. 1, 2, 3 and 4. It includes the accuracy and the loss of the measurements for the model performance (Figs. 1, 2) and convergence speed performance (Figs. 3, 4).The x-axis represents the round number, and the y-axis represents the testing result (either accuracy or loss).
When compared to blockchain-based FL with 20 nodes, it is not difficult to determine that the performance of the model may be enhanced by cluster-based FL by a significant margin.To be more explicit, the accuracy goes upto 72.6%, and goes down to 11%.The loss goes upto 3.6 and goes down to 0.8.The fact that cluster-based FL is able to use the information stored in several racks to develop a more accurate model is the primary contributor to the development of this advancement.In addition, we can see that the performance of the cluster-based FL model and the blockchain-based FL model with 30 nodes are quite similar to one another if we compare the two.In other words, cluster-based FL We compared the dataset that was used in the cluster-based FL framework to the dataset that was used in a single blockchain-based FL model in order to test the hypothesis that the cluster-based FL framework may be able to accelerate model convergence.This allowed us to determine whether or not the hypothesis was true.Because of this, we were able to demonstrate the capabilities of the FL framework that is built on clusters and either confirm or refute our initial assumptions.The dataset is dispersed in a random fashion across the nodes of each system, including the nodes themselves.
As can be shown in Figs. 1, 2, 3 and 4, during an extensive training period, the cluster and blockchain-based FL is capable of bringing the model to an accuracy and loss that is comparable to one another.However, it takes blockchain-based FL over 200 rounds to attain model convergence, but the time required by cluster-based FL model is around 170 rounds, which is comparable to the time required by blockchain-based FL with 30 nodes.In conclusion, the cluster-based FL has the potential to hasten the model's convergence in comparison to the blockchain-based FL's limited size.The reason for this is because cluster-based FL combines the work done by numerous networks, which results in an increase in the total amount of processing power available to the model.
The model converges quickly in terms of rounds when using blockchain-based FL with 20 nodes, however each round takes an extremely lengthy time to complete, reducing the system's overall efficiency.In this paper, a comparison of the total system latency of the various models is made.The amount of time that has passed from the beginning of a predetermined number of training cycles is what is meant by the term "system latency."As the learning process continues, Fig. 5 evaluates and contrast the different amounts of latency shown by blockchain-based FL with 10, 20 and 3 nodes.The amount of time that has passed is shown as a function of the rounds in Fig. 5.The consensus time of cluster-based FL, which is shown in Fig. 6.In contrast, clusterbased FL significantly cuts down on the amount of cross-rack communication, which in turn leads to a reduction in the latency of the system.In addition, when the system latency of cluster-based FL for inter-cluster and intra-cluster protocol is compared, we find that intra-cluster protocol performs much better than inter-cluster protocol.This is because cluster-based FL primarily optimises the amount of time it takes to reach a consensus.

Conclusion
It is anticipated that the blockchain-based FL model would make enormous new options available for the cloud based IoT networks.However, the currently implemented blockchain-based FL systems are plagued by the issues of inefficient data processing and a lack of data availability.
In this paper, we suggest using cluster-based FL model to link the many blockchainbased FL clusters that have been created by dividing the nodes that are spread out across a vast region into several smaller clusters using blockchain-based FL.In order to improve the quality of the data samples used by each cluster, the aggregated updates are shared among the clusters.The amount of aggregated updates is modest, which results in a reduction in the communication overhead.As a result, the system's efficiency is significantly increased.
When seen from a different angle, the fact that blockchain-and cluster-based FL may enhance training outcomes by sharing model updates is counterbalanced by the possibility that doing so would place enormous demands of computation and communication on the relevant devices.In contrast, the majority of IoT devices often have limited resources and are thus unable to adequately support these demands.As future work, we may consider attempting to merge the technologies of cluster-based FL and edge computing.In future, with the help of blockchain managed federated learning, the models be trained with data acquired from Internet of Things (IoT) devices that are located in various regions in a network and can be updated constantly.Moreover, the data that is collected from Internet of Things devices has its own distinctive collection of hardware and software capabilities, which can be utilized to train models that are managed by blockchain and federated learning in future.

Fig. 1
Fig. 1 Model performance in terms of accuracy

Fig. 2
Fig. 2 Model performance in terms of loss

Fig. 3 Fig. 4
Fig. 3 Convergence speed performance in terms of accuracy

Fig. 5
Fig. 5 Comparison of time in seconds for different number of nodes in blockchain-based FL

Fig. 6
Fig. 6 Comparison of time in seconds for different number of nodes in cluster-based FL