Khenfouci Yamina
email: ykhenfouci@esi.dz

SuperChain: Decentralized and Trustful Supervised Learning over Blockchain

Keywords: Blockchain, Artificial Intelligence, Decentralized Artificial Intelligence, Machine learning, Supervised Learning

Machine learning and Blockchain are two of the most noticeable technologies during the last years. The first one is based on Artificial Intelligence (AI) and big data, and the second one has significantly revolutionized different scopes from fintech to entertainment to healthcare by adding transparency, immutability, and a layer of security into their ecosystem.

Both technologies are data-driven, allowing researchers to take an enhanced interest to study their integration for secure, immutable, and efficient data sharing and analysis. We are interested in the converging of these two technologies and we propose a decentralized and efficient framework for the training of machine learning (ML) algorithms over Blockchain called SuperChain. Mainly, we consider the training of supervised learning algorithms such as Regression, k-nearest neighbors (KNN) and decision trees. Experimental results demonstrate that the proposed framework is reliable and trustworthy and improve the efficiency of the execution of machine learning algorithms.

I. INTRODUCTION

Machine Learning is a subset of artificial intelligence, consisting of computational methods that help recognize patterns in data and make predictions whose accuracy increases with the quantity and quality of data used to train the algorithms [START_REF] Nozari | & Others Artificial intelligence and Machine Learning for Real-world problems (A survey)[END_REF]. The term model refers to a machine learning algorithm that has been trained on data. It is used to make predictions by identifying trends and envisioning future outcomes. The model can be represented as a neural network, a support vector machine, a decision tree, a clustering, etc. A good prediction model helps make the right decision and analytic [START_REF] Tanwar | Machine learning adoption in blockchain-based smart applications: The challenges, and a way forward[END_REF], which highly depends on the completeness and accuracy of data. Corrupted data may lead to AI decision outcomes that can be highly erroneous, risky, and dangerous for applications handling sensitive data (e.g., AI-based healthcare applications).

Blockchain technology is a decentralized ledger offers transparency and immutability in transactions between parties without any intermediary [START_REF] Rajasekaran | A comprehensive survey on blockchain technology[END_REF]. Blockchain has emerged and used amongst different scopes, since it's public, distributed and secure by design. This has lead various companies and research institutions to look into, and to invest resources in this technology. Blockchain technology can be used to create decentralized AI (DAI) systems [START_REF] Team | Nebula ai (nbai)-decentralized ai blockchain whitepaper[END_REF], where data and computation are distributed among multiple nodes, rather than being controlled by a single entity. This can lead to more transparent, secure, and trustworthy AI systems. Blockchain technology will eventually get into the innovative applications of AI [START_REF] Cheema | Machine Learning with Blockchain for Secure E-voting System[END_REF]. Our main objective is to find how blockchain can transform AI and ML to be distributed, trustworthy, and reliable, and to improve their performance and efficiency.

In this paper, we present a system to ensure the immutability of data, the reliability of training machine learning within a blockchain. We provide a blockchain for machine learning (SuperChain) specifically for supervised ML such as : decision trees, regression and KNN. In which, we build a blockchainbased consensus for the training of machine learning algorithms for data published in a decentralized peer-to-peer (P2P) storage systems or blockchain network. The proposed system SuperChain contains three types of participants, the first is the data nodes that publish the training data, supervised learning tasks ( or training algorithm) with minimum requirements such as the minimal accuracy value, and a reward. The second type is consensus nodes or miners, which work to solve the announced training tasks or execute the training; the last is validation nodes which evaluate the models to choose the optimal model or the best solution and update the blockchain. The main idea is that when a data node announces a task, consensus nodes compete with each other and perform the training of supervised learning during a period defined by the data node, to build a new model. These models are published on the blockchain. After receiving a valid solution that meets the training accuracy criterion, the data node releases the test set. The validation nodes execute a consensus to select the optimal solution which has the best performance. This solution is saved on a block, added to the chain resistant to the modification, and could be traced back. Finally, the data node distributes the task reward to the winner consensus node.

Furthermore, the result of this work will contribute into other similar approaches of decentralized ML.

Our contribution is manifolds: 1) We developed a blockchain framework using Golang to implement many AI algorithms over blockchain.

2) We introduced SuperChain, a novel distributed system built on the convergence of AI and blockchain for the training of supervised learning within the blockchain.

3) We Perform a security analysis of SuperChain and we propose appropriate counter-measures that can potentially mitigate the security issues associated with SuperChain.

The rest of the paper is organized as follows: Section II introduces some definitions and preliminaries. Section III presents the related work. Section IV describes the SuperChain framework in Section V. Section V presents the implementation of SuperChain, the different experiments and results. Finally, Section VI concludes the paper.

II. PRELIMINARIES

A. Blockchain

According to [START_REF] Nakamoto | Bitcoin: A peer-to-peer electronic cash system[END_REF], the Blockchain is a system based on cryptographic proof instead of trust, allowing any two willing parties to transact directly with each other without the need for a trusted third party. Also, the Blockchain is a distributed digital ledger which contains chained blocks of all transaction. Blockchain starts from a genesis block, and each block except for the genesis block is chained to a previous block by referencing its hash. Transactions in the blockchain are recorded chronologically, publicly and cryptographically signed [START_REF] Xu | Spdl: A blockchain-enabled secure and privacy-preserving decentralized learning system[END_REF]. Blockchain technology are so popular at the moment because of its design features which are distributed database, enhanced security, immutability, decentralized systems, and faster settlement. [START_REF] Namasudra | Introduction to Blockchain Technology[END_REF]. Blockchain consists of three major components: blockchain network, distributed ledger, and consensus algorithm [START_REF] Xu | Spdl: A blockchain-enabled secure and privacy-preserving decentralized learning system[END_REF]. Consensus algorithm defines how to append a new block to the chain and determines the efficiency, security, and scalability of the blockchain network. Proof of work (PoW) proposed in Bitcoin [START_REF] Nakamoto | Bitcoin: A peer-to-peer electronic cash system[END_REF], is well known, but it consumes a large amount of computing in solving the Hash puzzle.

In this paper, we will propose a new blockchain-based consensus for practical work consisting of the training of machine learning models for data published on the blockchain network.

B. Supervised Learning Algorithms

Linear Regression: Linear Regression is a statistical supervised learning technique to predict the quantitative variable by forming a linear relationship with one or more independent features. The linear regression has two types:

• Simple regression: describe the relationship between a dependent Y and independent variable X [START_REF] Abhigyan | Understanding the linear regression!!!!, Medium. Analytics Vidhya[END_REF], the mathematical equation that approximates linear relationship between X and Y is:

Y = β 0 + β 1 X + ϵ (1)
• Multiple regression (MLR): to predict the result of an answer variable, using a number of explanatory variables [START_REF] Maulud | A review on linear regression comprehensive in machine learning[END_REF]. The object of (MLR) is to model the linear relationship between the independent variables x and dependent variable y that will be analyzed [START_REF] Zhang | Multiple linear regression for high efficiency video intra coding[END_REF]. The basic model for MLR is

Y = β 0 + β 1 X 1 + ... + β m X m + ϵ (2)
K-Nearest Neighbors: is a type of supervised learning algorithm used in Classification and Regression :

• KNN Classifier: Has a discrete value as its output.

Predicts a class by using the highest majority category among its k most similar nearest neighbors. The key idea of KNN is to predict the correct class for the test data by calculating the distance between the test data and all the training points [START_REF] Christopher | Nearest Neighbor. Medium[END_REF].Then select the K number of points which is closet to the test data. • KNN Regression: Has a real number (a number with a decimal point) as its output. Predicts a value by using the mean (average) of the k nearest neighbors. This means that the new point is assigned a value based on how closely it resembles the points in the training set [START_REF] Singh | KNN algorithm: Introduction to K-nearest neighbors algorithm for regression[END_REF]. Decision Trees: As the name goes, it uses a tree-like model of decisions, where each node represents a feature (attribute), each link (branch) represents a decision(rule) and each leaf represents an outcome(categorical or continues value) [START_REF] Sanjeevi (mady | Chapter 4: Decision Trees Algorithms[END_REF]. It is used in decision analysis to visually and explicitly represent decisions and decision making [START_REF] Gupta | Decision trees in machine learning[END_REF]. There are couple of algorithms there to build a decision tree such as:

• CART (Classification and Regression Trees): uses Gini Index(Classification) as metric. • ID3: (Iterative Dichotomiser 3) uses Entropy function and Information gain as metrics [START_REF] Gupta | Decision trees in machine learning[END_REF].

III. RELATED WORK

Many decentralized and efficient machine learning systems using Blockchain technology had been surveyed in different works. In what follows, we will present some of the solutions that are relevant to our study. :

Authors in [START_REF] Tsai | An efficient parallel machine learning-based blockchain framework[END_REF] propose a parallel framework to find out suitable hyper-parameters of deep learning in a blockchain environment by using a meta-heuristic algorithm. The proposed framework also consider the issue of communication cost, by limiting the number of information exchanges between miners. useful parallel deep learning framework for blockchain environment. The proposed framework inherits the characteristic of blockchain, and it can provide a secure way to get the trained model because the model on the knowledge chain needs to be verified by most miner nodes.

Authors in [START_REF] Wang | A unified analytical framework for trustable machine learning and automation running with blockchain[END_REF] propose a unified analytical framework for trustable machine learning by using blockchain technology. This unified framework solves both the trustability and automation issues in machine learning. Furthermore, it enables a computer to translate core machine learning implementation from a single thread on a single machine to multiple threads on multiple machines running with blockchain.

Authors in [START_REF] Nassar | Blockchain for explainable and trustworthy artificial intelligence[END_REF] propose a Blockchain-based framework for complex AI systems that achieve a trustworthy and Explainable AI based on the main features of Blockchain, consensus, smart contracts, trusted oracles, and decentralized storage.

Authors in [START_REF] Sgantzos | Artificial intelligence implementations on the blockchain. Use cases and future applications[END_REF] present the blockchain as a highly secure storage in protecting data and can host an advanced AI as the artificial general intelligence. The authors show that blockchain immutability creates an enabling environment for a high quality, permanent and growing datasets for deep learning. Furthermore, the authors present two ways the implementation of genetic algorithms on blockchain .

Authors in [START_REF] Lihu | A proof of useful work for artificial intelligence on the blockchain[END_REF] propose a novel proof of useful work (PoUW) protocol based on training a machine learning model within the Blockchain. PoUW rewards useful work and punish malicious and uses an extra incentive mechanism to participate in the work.

Authors in [START_REF] Bravo-Marquez | Proof-of-learning: a blockchain consensus mechanism based on machine learning competitions[END_REF] propose WekaCoin, a peer-to-peer cryptocurrency based on a distributed consensus protocol called Proof-of-Learning.Proof-of-Learning permit to elevate a new block that contains the best-ranking machine-learning model for a given task.

Authors in [START_REF] Marathe | DInEMMo: decentralized incentivization for enterprise marketplace models[END_REF] propose DInEMMo, a solution of Blockchain-based smart contracts which represent the ML model and use case attributes, generate models based on user input, compute the price of the ML model based on the user policy and calculate the incentives to the model's owner and contributors.

Authors in [START_REF] Kurtulmus | Trustless machine learning contracts; evaluating and exchanging machine learning models on the ethereum blockchain[END_REF] propose DanKU protocol that establish a marketplace of ML models. This protocol create contracts that reward the training of a machine-learning model for a particular data set in a trustless manner.

Most of the work already cited explores the combination between blockchain and IA and focuses on how AI can be a disruptive technological paragon via the use of the blockchain.Certain works, propose an alternative mechanism to the transaction validation process consisting in replacing the computational waste involved in hash-based puzzles in the PoW mining process with useful work such as machine learning training. Others, are interested in creating a marketplace of decentralized machine learning models over blockchain including only a convolutional neural network or deep learning. These works use an existing blockchain such as Ethereum. According to our knowledge, SuperChain is the first framework that host the supervised learning algorithms on the blockchain that improves their efficiency and confidence. SuperChain present an immutable and trustworthy for the storage of data and Supervised model incorporates a high level of security mechanisms.

IV. SYSTEM OVERVIEW

In this section, we provide a high-level overview of the SuperChain framework. A decentralized supervised learning platform based on the blockchain. The overall architecture of SuperChain is illustrated in the "Fig. 1". This system is composed of three layers:

• Data Layer: mainly used to store the data dedicated to the supervised learning on Inter-Plenary File Systems (IPFS) a peer to-peer version controlled distributed filesystem [START_REF] Benet | Ipfs-content addressed[END_REF].

• Blockchain Layer: involve all process related to the blockchain such as: the creation and validation of a new block, performing the consensus between all nodes, to select the optimal machine learning solution and update the Blockchain.

• Machine learning Layer: Determine the decisionmaking process performed by the consensus and validation nodes, the supervised ML algorithm and its performance evaluation. SuperChain is a permissionless blockchain since participants are not authenticated and can join the network pseudoanonymously, even adopting any role. We define three types of roles in the system:

• Data nodes: nodes who commission machine learning tasks and data on the blockchain network. • Consensus nodes: are the suppliers of the computational power to the system; they compete to train a model that meets the requirements as specified by the data node. These nodes verify also if a mined block is the result of honest and useful work. The winner consensus node receives the reward specified by the data node. • Validation nodes: proceed to rank and evaluate the ML models published by the consensus nodes, reach a consensus about the best model, and propose new blocks to the chain containing the winning model.. Our system is designed to ensure a secure collaborative framework for training ML models by combining ML with blockchain and IPFS. The system can ensure privacy, transparency, low communication overhead, as well as encourage nodes to participate in the ML process to build mutual ML models.

The overall SuperChain workflow is illustrated in the "Fig. 2". The process of SuperChain is further detailed in the following subsections.

A. ML Task submission

In SuperChain, a task issued by a data node can be a classification, regression or decision tree Ml task (algorithms) through publishing a task publication transaction on the blockchain . This task contains the following information:

• Pointer to the training dataset,

• Specification of the machine learning algorithm that defines everything needed to create, train and evaluate a model,

• Minimum performance accuracy,

• Reward for the consensus node and validations nodes.

The dataset D is first split into:

• A training dataset, further revealed to the consensus node to perform ML work on it. The training dataset is hashed and stored in IPFS.

• A test dataset revealed to the validation nodes when the final model should be tested.

The task is broadcast to the entire blockchain network. The test data should remain off the blockchain in order to prevent malicious consensus nodes from using the test set for training.

Therefore, the data node only broadcasts the test data after it starts to receive trained models. The data node can decide to wait for a number of solutions to arrive before releasing pas clair ce que distingue notre solution des autres. how? why? How can be read by minors? the test set. After the test set is released, no solutions from consensus node will be accepted.

B. Training

The training is executed in competition between the consensus nodes of the network. The consensus node can choose any ML task published in the Blockchain , this ML task can be a classification, regression or decision tree Ml task (algorithms). Then, for each information in the training dataset, it selects the subset from the data set samples which are the nearest neighbors . Then, it calculate the category this information. the nearest neighbors of. Then, it calculate the category of x (Line 04-08) .

C. Validation and block commitment

Once data nodes publish testing data,the model validation and block commitment stage begins for this, validation nodes execute a consensus to agree on ranking and evaluating all models and synchronize the optimal model for a selected task.

In the following, we explain the algorithm (2) related to ranking and validation of ML models :

First of all, the validation nodes download models from IPFS (Line 01). Then, the nodes calculate the performance metric for each model using the testing data (Line 03).

After that, each validation node builds a candidate block containing in addition of the model assessed with it's performance. The proposed block with the candidate ranking is for each x ∈ X do The validation nodes build a candidate ranking, which is an ordered list of pairs with the model and its performance score for the testing data (Line 09-10). The list is sorted in ascending or descending order depending on the metric. The network establishes a time limit for evaluating all the models in a validation round. When all of the nodes agree on the score obtained and consider that the model is valid , a consensus node with the highest performance model accuracy is rewarded and it's block is appended to the blockchain (Line 11-14).

V. EXPERIMENTS

The purpose of our experiments is to evaluate the efficiency and effectiveness of SuperChain. We carry out two sets of experiments. The first is designed to verify if SuperChain can reliably control the amount of time between the creation of two sequential blocks. If a blockchain system can generate blocks at regular intervals, transactions carried out through the system will not experience unexpected delays. The second experiment compares the accuracy of Supervised learning models (Logistic Regression, KNN, and Decision tree) trained within SuperChain and the traditional methods.

A. Blockchain Model

We implemented SuperChain, blockchain architecture using Go programming language, which makes it easy to build simple, reliable, and efficient multithreaded networking applications [START_REF]Community, G. libp2p implementation in Go[END_REF] and Go-LibP2P to build a P2P modular stack network [START_REF] Labs | libp2p implementation in Go[END_REF]. The implementation was conducted on an Ubuntu Operating System with a Core i7 8th Gen CPU with 16GB of RAM to ensure that each Consenus and validation nodes have end ift++ 18: end while 19: return BC,validated equal processing power. Regarding the implementation of the blockchain, we are focused on the following components:

Transaction: In the previous section, we have seen that there are three types of transaction: The publication of a machine learning algorithm task is done through a Task ML transaction, the publication of the model is done through a model transaction and the publication of block is done through block transaction. The transactions exchange between nodes in SuperChain is performed by using the stream based on go-libp2p-pubsub functionality [START_REF] Labs | libp2p implementation in Go[END_REF]. These streams are signed and treated as unidirectional streams. The outbound stream is used only to write data.The inbound stream is used only to read data. Furthermore, all data exchanged is encrypted and protected from eavesdropping using libp2p-secio [START_REF] Labs | libp2p implementation in Go[END_REF].

Block: An example as displayed in "Fig. 3". In this example, we assume that the block in SuperChain includes the following information: A block is a container data structure that groups transactions together. The block consists of a header, containing metadata, followed by a list of transactions. The block header consists of different sets of block metadata. First, there is a reference to a previous block hash, which Consensus: Inspired by the competition in solving Hash puzzel in PoW consensus, we have set up SuperChain to implement supervised learning consensus, the mining puzzle was determined by the accuracy of model (value between 0 and 1). The validity of each block depends on the compliance of the following requirements:

1) The model meets the performance requirement introduced at the start of the execution.

2) The model is at the top of the performance-ordered list.

3) All validation nodes have validated the model and have agreed on its performance.

We implemented learning models using a libraries like ML in golang library called golearn: "batteries included" machine learning library for Go [START_REF] Sjwhitworth | Machine Learning for Go[END_REF].

B. Datasets

All experiments were performed using the data provided by the UC Irvine Machine Learning repository located in :

• Iris Data set: it contains four features (length and width of sepals and petals) of 150 objects of three species of Iris plant:Iris setosa, Iris virginica and Iris versicolor [START_REF] Mushtaq | A Iris Data Set[END_REF]. • Breast Cancer Wisconsin(BCW) Diagnostic Data Set:

Predict whether the cancer is benign or malignant, having 699 instances, 02 classes (malignant and benign), and 09 integer-valued attributes [START_REF] Wolberg | Breast cancer wisconsin (diagnostic) data set[END_REF]. • Titanic: Machine Learning from Disaster competition dataset was provided by Kaggle. The Titanic dataset consist of a training set that includes 891 passengers and a test set that includes 418 passengers which are different from the passengers in training set.

C. Experiment Scenarios

In this section, we describe the experiments that we have carried out using SuperChain to evaluate the effectiveness of trained models and examine the accuracy. Depending on the type of algorithm, we can use metrics like accuracy, recall, precision, F1 score to evaluate the performance of the given model.

Experiment 1:Time between the creation of two sequential blocks: In this experiment, we measure the amount of time between the creation of two sequential blocks to verify if SuperChain is realiable (Table I).

Experiment 2: Decentralized Regression over Blockchain: In this experiment, we compare the performance of the centralized logistic regression with that of the decentralized one, utilizing the Titanic and BCW Datasets, comprising one data node, an different number of consensus nodes and validations nodes (Table II).

Experiment 3: Decentralized Decision Tree over Blockchain: In this experiment, we compare the performance of the centralized Decision Tree with that of the decentralized one, utilizing the Iris and BCW Datasets, comprising one data node, an different number of consensus nodes and validation nodes (Table III).

Experiment 4: Decentralized KNN over Blockchain: In this experiment, we compare the performance of the centralized KNN with that of the decentralized one, utilizing the Titanic and BCW Datasets, comprising one data node, an different number of consensus nodes and validation nodes (Tables IV andV).

D. Results and Discussion

According to the result presented in Tables II, III, IV and V, we can see clearly that the accuracy of supervised learning models within the SuperChain System is higher than the accuracy of the traditional models. Also, The accuracy of the Supervised learning model performed within a blockchain composed of four (04) consensus nodes is higher than the model performed in a network of two (02) consensus nodes. Remarkably, the performance score of models increases with the increase of nodes number, and this is for different used datasets. We conclude that the benefits of decentralization would result in a significant model accuracy score. However, we can confirm that SuperChain is more efficient than the traditional Supervised learning models. Furthermore, according to the Table I,we can observe that each execution of an ML task within SuperChain always converges and after each learning round, the system always adds a new block to the blockchain in the amount of time 1 à 2 Seconds. Upon the analysis of the implementation process, we observe that SuperChain is reliable and trustworthy, as ensured by the basic concept of blockchain technology. All learning data is saved in the blockchain and can be simply traced back to check its origin. Moreover, the models added to the blockchain are mined by consensus node and verified by all blockchain network validation nodes. Furthermore, each node in the network gets a copy of the model and the integrity is ensured through the consensus mechanisms and cryptographic hashing algorithms.

VI. SECURITY ANALYSIS

In this section, we perform a security analysis of Su-perChain and we propose appropriate counter-measures that can potentially mitigate the security issues associated with SuperChain.

Public, Persistent and Decentralized

The model in SuperChain is a shared and publicly visible resource. One can essentially trust that the model will persist and be available on different decentralized nodes (blockchain copy synchronization).

Versioning

It is easy to revert to an earlier version of the model by at any time by a blockchain tracesbacks mechanism.

Safety Properties and Liveness

SuperChain consensus protocol meets three properties, safety, correctness, and liveness.

The safety property ensures that the added blocks are valid and identical for all node. The block structure is defined in SuperChain in section V-A. Furthermore, the block is added to the blockchain only if its model meets the following requirements:

1) The model meets the performance requirement introduced at the start of the execution such as the accuracy value.

2) The model is at the top of the performance-ordered list.

3) All validation nodes have validated the model and have agreed on its performance.

Correctness requirement means not only every single request should be processed correctly, but also the sequence of requests from a different nodes in the network should be processed in the correct order. In order to achieve correctness, SuperChain consensus protocol maintains correctness for agreements and resistance to Byzantine failures by adopting a mechanism where a block is approved bu all validation node SuperChain guarantees liveness because the supervised learning performed within the framework converges always and after each learning round, the system always adds a new block to the blockchain.

To ensure the reliability of a SuperChain consensus, we involved all blockchain necessary security assumptions that make the consensus correct and byzantine fault tolerance.

Malicious node

SuperChain system can not be vulnerable to a single point of failure. Segregation of duties have been implemented to minimize the impact of a single point of failure by creating different roles (node types) in the SuperChain. A possibly malicious strategy that a consensus node can adopt, is to participate in its own competition and submit a perfect model based on the knowledge obtained from the testing data. In SuperChain, each node can have only one role data node or consensus node. A malicious consensus node could wait until the test data is released and then submit a model trained on the test data. This is avoided because the Superchain protocol establishes that model test data are released by data node after the finalization of training process by consensus node and publication of all models on blockchain network.

It's worth mentioning that the SuperChain has a lot of room for improvement to mitigate several risks such as the need to design a system where no user can cheat or gain an advantage over any other user, the data node doesn't reveal the testing data, and nodes collusion.

VII. CONCLUSION

We presented a novel system for distributed and decentralized machine learning systems over blockchain. For this purpose, we briefly reviewed the related work focusing on the work of decentralized machine learning by the blockchain. Furthermore, we presented the roles, the environment, and the consensus protocol that combines machine learning with blockchain technology to create reliable and trustworthy useful work. In addition, we implemented a proof of supervised learning consensus for Superchain and demonstrate that the accuracy of the SuperChain Supervised model is higher than the accuracy of the traditional ones. Additionally, we performed a security analysis of SuperChain regarding different security properties such as safety, correctness, and liveness. Our contribution can be easily extended to other AI algorithms. Furthermore, we intend to perform other security proofs to minimize SuperChain limitations.

Fig. 1 .

 1 Fig. 1. SuperChain layered architecture.

Fig. 2 .

 2 Fig. 2. SuperChain Workflow.

  Then, it proceeds to train a model using the data set dedicated to the model. At the end of the training, each consensus node submits its model through a Model transaction. Algorithm 1 represent KNN algorithm, one of the training algorithm executed within a SuperChain. The main objective of this algorithm is to build a model that predicts the value of a target field (class) in the training data based on the values of its nearest neighbors, First of all, a consensus node selects the task available in the network (Line 01) and begins the training using data training related to this task available on IPFS (Line 02).

8 :

 8 Select the subset N from the data set D, the N contains k training samples which are the k nearest neighbors of the test sample x Calculate the category of x: c x = arg c∈C max y∈N I(c = class(y)) 9: end for 10: end while 11: Save model and it's hash on BC 12: return Model(M ) sent along with the others validation nodes which proceeds to reevaluation (Line 04-08).

Fig. 3 .

 3 Fig. 3. Block structure KNN over Blockchain.

  nombre de minors? validators? Il n ' y a qu'un seul chiffre dans le tableau. pourquoi accuracy est mons bonne pour BCW ? sauf pour Decision Tree BCW, pourquoi?

  Algorithm 1 Training Supervised algorithm within a blockchain (KNN) Require: The training data X(x 1 , x 2 . . . x n ), Y :Class labels of X, test object x, category label set C , Blockchain BC, B block, k number of nearest neighbors, tasklist list of available KNN task

	Ensure: Model(M )
	1: task ← SelectTask ( tasklist )
	2: trainingperiod ← task.trainingperiod
	3: X ←FetchTrainningData from IPFS
	4: while trainingperiod not elapsed do
	5:

  T imeEval evaluation periode, B condidate block, received B list of Condidat block, V alidationN odeN umber number of validation nodes, Blockchain BC Ensure: validated: True or False, Blockchain BC 1: test d ata ← data test of model from IPFS 2: while t < T imeEval do

	Algorithm 2 Model validation and Block commitment
	Require: trainingdata	training	data,	testdata
	testing data, 3: accuracy		←	CalculAccuracy(M odel,
		trainingdata,testdata)
	4:	B ← GenerateNewBlock(B,M odel,accuracy)
	5:	Broadcast to all validations nodes
	6:	new B ← WaitAndReceiveBlocks()
	7:	received B ← Append(received B , new B )
	8:	received B ← Append(received B ,B)
	9:	Ranking received B list of Block in descending order
		according the Accuracy accuracy(B Block, accuracy)
	10:	Send Condidate ranking list received B to the other
		validations node for reavaluation
	11:	if V ote == V alidationN odeN umber then	▷ all
		validation nodes are agree about the ranking
	12:	Select the first model model and its block B in
		the list	▷ model that has the Best Perƒormance
	13:	BC ← Append(BlockchainBC, newBlockB) ▷
		Add the block containing the performed model on the
		blockchain
	14:	validated ← True
	15:	else
	16:	validated ← False
	17:

TABLE I COMPARISON

 I OF BLOCK CERATION TIME PERFORMANCES.

			Block Index			Timestamp
		Genesis block (block 0)	2023-04-14 16:38:16.960260039 +0100 CET m=+0.003897067
			Block 1		2023-04-14 16:39:16.131826491 +0100 CET m=+78.175463696
			Block 2		2023-04-14 16:40:13.628502734 +0100 CET m=+116.672139904
					TABLE II
				COMPARISON OF REGRESSION PERFORMANCES.
			Dataset	Traditional Regression Titanic	Regression over Blockchain Titanic (Node=02) Titanic (Node=04)
			Accuracy		0.523	0.798	0.805
					TABLE III
				COMPARISON OF DECISION TREE PERFORMANCES.
		Traditional Decision Tree		Decision Tree over Blockchain
	Dataset	Titanic	BCW		Titanic (Node=02) Titanic (Node=04)	BCW (Node=02) BCW (Node=04)
	Accuracy	0.795	0.927		0.806	0.826	0.915	0.905

TABLE IV COMPARISON

 IV OF KNN PERFORMANCES "IRIS DATASET".

		Traditional KNN			KNN over Blockchain
	Performance class Precision	Recall	F1 Score	Precision(N=2) Recall(N=2) F1 Score(N=2) Precision(N=4) Recall(N=4)	F1 Score(N=4)
	Iris-Verginica	0.9630	0.8966	0.9286	0.9231	0.9600	0.9412	0.9600	0.9600	0.9600
	Iris-Versicolor	0.8800	0.9565	0.9167	0.9667	0.9355	0.9508	0.9565	0.9565	0.9565
	Iris-Setosa	1.0000	1.0000	1.0000	1.0000	1.0000	1.0000	1.0000	1.0000	1.0000
	Accuracy		0.9487			0.9630			0.9718
	N= Number of nodes.

TABLE V COMPARISON

 V OF KNN PERFORMANCES "BCW DATASET".

		Traditional KNN			KNN over Blockchain
	Performance class Precision	Recall	F1 Score	Precision(N=2) Recall(N=2) F1 Score(N=2) Precision(N=4) Recall(N=4)	F1 Score(N=4)
	Malignant	0.7536	0.4860	0.5909	0.7857	0.4783	0.5946	0.7330	0.4860	.5909
	Benign	0.7330	0.8988	0.8075	0.7368	0.9180	0.8175	0.7330	0.8988	0.8075
	Accuracy		0.7382			0.7483			0.7509