## 9 Conclusions  
In this paper, we introduced an approach to ensure accountability and end-to-end data flow integrity in MQTT by leveraging blockchain and IPFS technologies. The core idea consists of building an MHT of the data exchanged between publishers and subscribers and then verifying the computed root of the MHT. The integration of blockchain with IPS enhances the scalability of the proposed approach since only the essential data (i.e., the root of the MHT) are stored on the blockchain, while the MHT itself is stored on IPFS.  
The blockchain effectively prevents brokers and publishers from repudiating messages to create immutable and verifiable logs of all communications. Additionally, our solution ensures that when an attacker is able to modify the flow of messages in transit, publishers and subscribers can detect this integrity violation. Differently from the majority of the solutions in the literature concerning end-to-end security in MQTT, our proposal does not rely on trusted third parties. Additionally, it enhances the MQTT protocol with accountability guarantees.  
In our study, we provided a security analysis to show that under standard cryptographic assumptions, our approach guarantees both accountability and end-to-end data flow integrity. Additionally, we performed a thorough experimental campaign to study the impact of our solution on MQTT. Our experimental results indicate that the proposed solution incurs minimal overhead on the system's throughput. The overhead is due to the additional integrity verification operations required at the end of each round. However, by choosing an appropriate round time frequency, the reduction in throughput can be negligible. Our results also show that our solution scales well with an increase in the number of clients and, thus, does not introduce any scalability issue.  
Finally, we provided a detailed analysis of the costs of our solution by also showing an estimation of the costs per year required by our solution. Overall, the execution costs are relatively low, especially given the critical security and accountability benefits our solution provides. Additionally, from our analysis, it emerges that the more subscribers in the system, the lower the costs per client. This demonstrates that our solution scales very well with an increasing number of clients in the system.  
The future work will focus on optimizing the system by incorporating a methodology to estimate the best round time frequency into the solution. This could be achieved by dynamically adjusting the round time frequency (during communication between clients) to better match the frequency of data exchange.  
Conceptualization, F.B. and S.L.; methodology, F.B. and S.L.; software, S.L.; validation, S.L.; formal analysis, S.L.; investigation, F.B. and S.L.; resources, S.L.; data curation, S.L.; writing--original draft preparation, S.L.; writing--review and editing, S.L.; visualization, S.L.; supervision, F.B.; project administration, F.B. All authors have read and agreed to the published version of the manuscript.  
This research received no external funding.  
Data Availability Statement: Data are contained within the article.