# Machine Learning for Blockchain and IoT Systems in Smart Cities: A Survey
## 3 Blockchain for Security and Data Integrity in Smart Cities
However, while FL enhances privacy and reduces the risks of data breaches, it comes with its own set of vulnerabilities, such as potential exposure to model poisoning attacks where malicious participants can compromise the model's integrity. This contrasts with blockchain's strength in data integrity and security, which is ensured through cryptographic mechanisms and consensus protocols. Therefore, the choice between implementing blockchain or FL in IoT systems should be based on the specific needs of the application, particularly in balancing the demands for privacy, security, and scalability [56; 57; 58; 59]. Moreover, blockchain's role in ensuring data provenance and traceability is indispensable in smart cities. In complex urban environments, where data from multiple sources are continuously integrated and analyzed, the ability to trace the origin and modifications of data becomes essential for accountability and transparency. Blockchain provides an unalterable history of data transactions, enabling city administrators and stakeholders to verify the authenticity and source of the data. This traceability is particularly beneficial in critical applications such as public health monitoring, where accurate data provenance is necessary to make informed decisions during emergencies, such as disease outbreaks or environmental hazards [60; 61; 62; 63]. Smart contracts, another pivotal feature of blockchain, further augment security and operational efficiency in smart cities. These self-executing contracts with predefined rules and conditions automate and enforce agreements between parties without the need for intermediaries. In smart city applications, smart contracts can streamline a wide range of processes, from automated billing and payments in smart utilities to real-time traffic management systems. By embedding these contracts into blockchain, cities can ensure that all transactions and processes are executed as intended, with full transparency and without the risk of human error or corruption [64; 65; 66; 67]. However, the integration of blockchain in smart cities is not without challenges. The scalability of blockchain networks is a significant concern, especially as the number of IoT devices continues to grow exponentially. Traditional blockchain systems, such as Bitcoin or Ethereum, face limitations in transaction throughput and latency, which could hinder their application in high-density urban environments. To address these challenges, advancements in blockchain technologies, such as sharding, sidechains, and layer-two solutions, are being explored. These innovations aim to enhance the scalability and performance of blockchain networks, making them more suitable for the demands of smart cities [69; 70; 71; 72]. Furthermore, the energy consumption of blockchain, particularly in proof-of-work consensus mechanisms, poses a sustainability challenge in the context of smart cities. Since smart cities are designed to promote sustainability and energy efficiency, integrating energy-intensive blockchain systems could be counterproductive. Therefore, there is a growing interest in alternative consensus mechanisms, such as proof of stake or proof of authority, which offer lower energy footprints while maintaining security and decentralization [73; 74; 75]. In conclusion, blockchain technology plays a critical role in securing IoT systems and ensuring data integrity in smart cities. Its decentralized, immutable, and transparent nature provides robust protection against data tampering and cyber threats, while smart contracts streamline and secure urban processes. However, the successful implementation of blockchain in smart cities will require addressing the challenges of scalability and energy consumption, ensuring that these systems can meet the demands of rapidly growing urban environments while supporting the broader goals of sustainability and resilience [76; 77; 78].