# Towards Blockchain-Based Federated Machine Learning: Smart Contract for Model Inference
## 6 Conclusions  
The developed Hyperledger Fabric application incorporated two different implementation variants--a chaincode-based solution, and a combination of chaincode and oracle web service component. Although the introduction of oracle service enables the reusability of existing ML libraries and a more flexible development of FL solutions, it introduces a runtime overhead. To determine the impact on the performance, we conducted experiments assessing runtime differences between the standalone chaincode and the combination of chaincode with the oracle service. Furthermore, the performance overhead was evaluatedusing two different logistic regression models validation--one of three coefficients with synthetic data, and the other one of 15 coefficients with the EEG eye state dataset.  
The benchmarking experiment using the synthetic dataset has shown promising results with the median runtime overhead of \(\sim\)2% overall and individual medians not exceeding 6.59% irrespective of the experimental setup. Larger overheads were introduced at smaller data sizes mostly due to the data upload step to the oracle service. As the network and data increase, the impact on the overhead tends to diminish due to the longer inference runtimes compared to the data transfer delay. The benchmarking experiment using the EEG eye state dataset had a median runtime overhead of \(\sim\)4% and individual medians were in the range from 0.8 to 9.7%. Although the size of the EEG eye state dataset was bigger more than four times (and data record dimensionality bigger than seven times) than the synthetic dataset, the overall median overhead increased by two percentage points, suggesting that the oracle runtime is mostly affected by the model inference rather than the dataset transfer step. Therefore, to summarize, the performance is not as sensitive to the dataset size changes, as opposed to the network size changes, where an additional peer increases the runtime linearly by over 6 s at the largest amount of data records benchmarked.  
Our research suggests that the increases in runtime, due to the transfer of computations to oracles running on individual peers, seem to be negligible if compared to the possibilities that such an implementation has the potential to unlock. The implemented prototype and Hyperledger Fabric need to be further developed to achieve federated learning for real-world applications. Organizations that require more participating peers should evaluate if the time required to validate the model using the pure chaincode is sufficiently lower than the more universal approach using the oracle service component.  
As future work, we plan to introduce the capability to combine the uploaded ML models into the ensemble or sequentially evolve a single online ML model. Furthermore, since the proof-of-concept demonstrated that the impact of oracle service on runtime performance is marginal, we plan to support a wider variety of models through third-party ML libraries and experiment with model merging approaches.  
Conceptualization, E.V., V.D., M.J., L.C.; methodology, L.C., M.J., V.D.; software, V.D.; validation, E.V., L.C.; formal analysis, V.D., M.J.; resources, L.C., R.B.; data curation, E.V.; writing--original draft preparation, V.D., M.J.; writing--review and editing, E.V., L.C., M.J., V.D.; visualization, E.V., M.J., L.C.; supervision, R.B.; funding acquisition, L.C. All authors have read and agreed to the published version of the manuscript.  
This research received no external funding.  
Not applicable.  
[1]**Data Availability Statement:** Publicly available datasets were used: Synthetic 2D [18], EEG-eye-state [19].  
[2]**Conflicts of Interest:** The authors declare no conflict of interest.