Unlock the full potential of AI with Building LLMs for Production—our 470+ page guide to mastering LLMs with practical projects and expert insights!

Publication

Blockchain
Latest   Machine Learning

Blockchain

Last Updated on July 24, 2023 by Editorial Team

Author(s): Lamprini Papargyri

Originally published on Towards AI.

From Connectivity to Intelligence: How Blockchain and AI are Transforming the IoT Ecosystem

Blockchain is a secure, decentralized, distributed, timestamped data structure that offers solutions for issues in various sectors such as finance, data security and privacy, agriculture, supply chain management, energy, and healthcare in IoT. Blockchain’s name comes from its architecture — a chain of blocks where each one is connected to the previous using a cryptographic hash value that is used to verify the data integrity of each block and reduces significantly the transaction hacking by any malicious action. A block is a data structure that entails the transaction data, a timestamp and the hash value of the current and the previous block and allows to collect and store of a group of transactions as a block in the ledger.

Transactions are generated and exchanged by members of the network, and depending on the blockchain network type, they might be able to modify the state. The Blockchain and AI convergence for IoT introduces offers many opportunities for tackling various issues such as lack of transparency and security, centralized information, etc as shown in Figure 2.

Figure 2. Blockchain and AI for IoT.

A ledger is a data architecture that can store many types of information, including all the historical transactions that have been made by all the users of the blockchain network, while each user has a copy of the ledger.

Blockchain is a distributed append-only data structure. Blockchains allow having a distributed peer-to-peer (P2P) network where non-trusting users can verifiably interact with each other without the need for an intermediary entity. The blockchain infrastructure can be considered as a group of interconnected mechanisms, as illustrated in Figure 3.

Figure 3. An overview of blockchain structure.

At the bottom of the infrastructure, there are signed transactions which are collected and stored in a bloc which is one of the most important mechanisms of blockchain technology. The blocks are connected by storing a unique cryptographic hash value of the previous block in the current block.

Any member that connects to the blockchain network is called a node. Those who have writing permissions in the blockchain and thus verify rules are called full nodes. Their role is to assign and store transactions into blocks and determine whether the transactions are valid and should be included in the blockchain or not. As an example of a transaction, Alice transfers a bitcoin to Bob, and she tries to transfer the same bitcoin to Carol. The nodes of the network must reach a consensus on which transactions are valid and, thus should be kept in the blockchain to guarantee that there will be no corrupt branches and divergences.

This is the aim of the Consensus mechanism/protocol, which can differ depending on the blockchain type. Proof-of-work (PoW) and Proof of Stake (PoS) are the most widely used. Other consensus mechanisms consist of the Byzantine Fault Tolerance (BFT) and its variations, the Delegated Proof of Stake (DPoS), the Proof of Luck (PoL), the Proof of Elapsed-Time (PoET), the Federated Byzantine Agreement (FBA), and others.

Proof of work is a distributed consensus protocol that needs to solve a complex computational process, such as finding hashes with specific patterns to prevent anybody from gaming the system and ensuring authentication and verifiability. It is used in the mining of cryptocurrencies and for validating new transactions. Due to PoW, Bitcoin and other cryptocurrency transactions can be securely processed without the need for an intermediary authority. PoW requires enormous amounts of energy, which only rises as more miners enter the network. For this reason, many blockchains, such as Ethereum, are progressively shifting to PoS due to the great reduction of energy consumption and enhanced scalability.

Proof of Stake is one of the alternative consensus mechanisms to PoW since it is more efficient in terms of computational resources and reduces the risk of an attack on the network, as it structures compensation in a way that makes an attack less gainful.

On the top of the infrastructure is the Compute Interface layer, which allows blockchains to provide additional functionality. Essentially, a blockchain stores a state which consists of all the historical transactions, therefore allowing the calculation of each user’s balance. Yet, for more complex problems, we have to store advanced states which are updated dynamically using distributed computing, e.g., states that shift from one to another once specific criteria are met. This requirement has given rise to Smart Contracts (SCs) which use nodes of the blockchain to execute the terms of a contract.

The Governance layer takes into account human interactions in the physical environment. Therefore, governance deals with how these actors from diverse groups come together to create, maintain, or integrate new methods and alter the inputs that consist of a blockchain.

A smart contract is defined as “A computerized transaction protocol that executes the terms of a contract”. It is a program supported by the blockchain network that enforces or self-executes contractual clauses, providing additional security in the transactions. The smart contract code is stored on the blockchain network, and it is recognized by a unique address, and for members to operate with it, they just send a transaction to this address. The valid execution of the smart contract is enforced by the consensus mechanism.

The rapid development of smart contracts has contributed to a great extent to the 2nd generation of blockchains, also known as Blockchain 2.0.

Categorization of Blockchain Networks

Blockchain networks can be categorized in many ways, especially based on access to blockchain data. In public blockchains (permissionless) any person can enter as a new user or node miner and implement operations such as transactions or contracts. Private and consortium networks belong to the permissioned blockchain type, where a group of allowed users is well-defined with specific characteristics and permissions over the network operations. Private blockchains can avoid PoW mechanisms which are very computationally expensive and utilize a wider range of consensus protocols based on disincentives due to the minimized risk of Sybil attacks. A consortium blockchain is a hybrid between public and private blockchains. While the scalability and privacy are similar with private networks, their main difference is that a group of nodes can verify the transactions in contrast with private networks in which one node makes the validation. Table 1 shows the key features of each blockchain network regarding it’s characteristics.

Public

In public (permissionless) blockchain networks, data is public, and all members are free to enter and leave the system. The networks are open for reading (or perusing as often called in literature) and writing (compose) activities by all users on the network. In public blockchains, members can download the blockchain code into their framework, modify them and use them according to their requirements. The key benefits of public blockchains are decentralization and transparency, where the users are consistently unidentified. The transaction time on public blockchains is longer when contrasted to consortium and private blockchains. Public blockchains require a consensus of, in any event, 51% validators and use complicated arithmetic to solve security computational problems which need enormous power consumption and are additionally inclined to assault on the off chance that the attackers take control of 51% validators.

Consortium

Many organisations, for instance, banks, administrative associations, and private blockchain organizations provide many kinds of unified blockchains. Consortium blockchains work as permissioned frameworks, where all users can read the information on the blockchain. Nonetheless, a couple of approved and trusted users have access to write on the blockchain. Consortium blockchain networks are faster and lighter than public since the users are pre-endorsed with known identities. Normally a transaction gets endorsement within 1 second and requires less energy.

Private

Private blockchains are likewise faster since they use known identities and pre-endorsed users in the organization, which leads to quick transactions with less energy consumption for approval. A private blockchain network is monitored by one organization and is a type of permission framework where members are pre-endorsed for read/write tasks and are constantly known inside the organization. The exchange endorsement time on private networks is usually less than 1 sec.

Table 1. Categorization of main characteristics of blockchain networks.

Below we provide a methodology for a blockchain network technology classification providing additional features apart from the classical ones, such as the ownership and management of the information shared in the blockchain, we study characteristics such as if the state should be saved, how many validator nodes exist and if they are trusted so we can select the appropriate blockchain technology based on the specific problem.

Generally, using blockchain technology is a good choice when multiple parties that don’t trust each other want to interact and store the state of a system. A flowchart to facilitate the decision-making process on the selected blockchain technology based on the specific problem, a flowchart is provided in Figure 4. We consider one or multiple entities that write the system state, i.e., a writer corresponds to a party with write access in a traditional centralized database system or to a consensus participant in a blockchain system.

If there is no need to store data, a blockchain is of no use and a regular database is better suited. Moreover, if there is only one validator node (writer), a blockchain does not provide additional transparency and at the same time, degrades the performance and the speed of information exchange. If all the validators commonly trust each other, a centralized database with shared write access is the best choice. In contrast, if they do not trust each other, a permissioned blockchain should be used.

Additionally, the selection of blockchain technology depends on whether public verifiability is needed. If everyone is able to read the state, a public permissioned blockchain can be used. However, if the group of readers may need to be restricted, a private permissioned blockchain will be the best choice. If the set of validator nodes is unknown, as usually happens in cryptocurrencies, a permissionless blockchain network should be adopted.

Figure 4. Flowchart to determine which blockchain technology is the suitable solution to solve a problem.

Features of Blockchain

Blockchain technology is able to offer multiple benefits in many sectors. The main features are:

Decentralization: blockchain is usually a decentralized and distributed framework that is based on peer-to-peer interaction between communicating nodes, as shown in Figure 5. Decentralization allows the processing power of all involved members to be used, reducing latency and eliminating single points of failure.

Figure 5. Client-Server (left) vs P2P Network (right).

Transparency: one of the main advantages of blockchain is the enhanced trust and transparency that it offers, in contrast to the centralized systems, while storing the state and offering access to the members (depending on the network as described above).

Immutability: hash functions are immutable and are used to connect the current block to the previous, maintaining the integrity of the blocks’ information. The only way to make changes to the blocks is for the majority of users to agree with that change.

Enhanced security: the use of the public key combined with the consensus protocol minimizes the risk of attacks and thus increases the trust and security of the network. The lack of a single point of failure, which can significantly impact the whole system, provides enhanced security compared to traditional centralized systems.

Anonymity: in the case of public networks, pseydoanonymous identity is used to protect the users’ privacy and provide a transparent and trustworthy transaction.

Autonomy: blockchain significantly supports the production of new devices that can make smart and autonomous decisions, for example, autonomous vehicles.

Weaknesses and Threats

Blockchain technology is difficult to be compromised and has proved that it can deal with all types of attacks due to the cryptographic puzzles and the consensus mechanisms. Near unfeasible to hack. However, the inherited security characteristics of blockchain make it resilient to attacks but not fully protected.

51% Attacks: This attack, also known as the majority attack, is the most prevalent threat in blockchain technology. It can occur when a cluster of miners takes control of more than 50% of the network’s mining hash rate or computing power, and they can control the consensus, block new transactions from being confirmed as well as change the ordering of new transactions and alter the blockchain. Moreover, attackers can rewrite parts of the blockchain and reverse completed transactions, leading to an issue known as double-spending. The fast-growing of mining pools (with GHash.io4 temporarily reaching 51% of the Bitcoin mining power in 2014), has amplified the probability of this attack happening, which in turn could compromise the integrity of Bitcoin.

Social engineering: Phishing is the most common social engineering attack, which involves tricking victims into giving up their private keys, login credentials, or personal information, usually by using fake emails. In the case of phishing, there is no flaw in the system but human inattention or fallibility, while the attacker is presented as a trustworthy entity in an electronic communication.

Software flaws: Software applications that adopt blockchain are still susceptible to many bugs and software flaws, and therefore it’s very important that they undergo rigorous testing and verification, including penetration testing, code reviews, and audits for smart contracts.

Malware: Malware, in the context of blockchain, is a sort of virus that takes advantage of flaws in the systems, as discussed above, causing performance issues and giving unrestricted access to a computer’s resources. Malware is a serious threat that, based on the application, can be a harmful block-mining program, crypto-exchange hack software, or any other code capable of shutting down servers or stealing cryptocurrency from the users of the network.

The Denial of Service (DoS), Man in the Middle (MitM) or Sybil attacks can also degrade the network operation. Most peer-to-peer protocols and IoT systems are susceptible to these types of threats since they significantly depend on communications.

Wasted resources and Usability

The maintenance of blockchain networks requires huge amounts of power. In 2014 the power used for Bitcoin mining was similar to Ireland’s electricity consumption. Also, advancing accessibility of blockchain technology (e.g., via the more user-friendly application programming interface, API) should grow its exposure to areas other than technical computer science and therefore assist in tackling the issue of wasted resources.

Artificial Intelligence

Artificial intelligence is an emerging technology that allows a machine to display human intelligence using vast amounts of data, many times created by IoT sensors and devices. These data are used in training models to identify patterns and anomalies and make accurate predictions. With the use of automated decision-making abilities and control activities like streamlining decision-making, devices optimize operations, manage warehouses, reduce downtime, and much more. With AI-based IoT authentication, it provides enhanced security solutions based on ML models.

AI is a technology that proposes to gain a deep understanding and design systems that show intelligent characteristics and therefore improve decision-making. The ongoing growth is attributable to a subgroup of artificial intelligence such as machine learning, deep learning, etc, where models are developed to find and learn associations based on a huge amount of unprocessed data. Deep learning (DL) models have been applied to a great extent and set new standards where high-quality digital data are abundant, and there is a strong economic motivation to automate forecasting tasks.

Figure 6. The basic machine learning-based model integration with IoT.

Internet of Things (IoT)

IoT is the network of physical objects which can interact with each other and with the external environment while sharing a large amount of data in real time, providing services for information transfer, analysis, communication, independent and remote operation, and interaction with other systems.

IoT which helps move towards an always-connected future through the utilization of connected devices, such as sensors, and wearables, are expected to be half a trillion by 2030.

Currently, the IoT is utilized in many sectors as shown in Figure 7.

Figure 7. Sectors that benefit the most from IoT development.

AI and blockchain integration

Improves Data Safety and Integrity. The information that is contained within ht blockchain is considered highly secure, and therefore, artificial intelligence algorithms are fed with trustworthy data and lead to more trusted decision-making.

Enhanced Trust in Robotic Decisions. Recording the robotic decision-making process of an AI system on a blockchain would make it more transparent to the public and subsequently could gain their trust.

Table 2. Advantages of blockchain integration with artificial intelligence.

IoT and blockchain integration

IoT technology can optimize the automatization of processes while obtaining huge volumes of data. In the last decade, cloud computing has helped provide the IoT with the needed functionality to analyze information and transform it into real-time actions and knowledge. Although centralized architectures like the one used in cloud computing have significantly helped the development of IoT, they behave like black boxes, and network members don’t know where and how the information they provide is going to be used, and there is a lack of trust.

Blockchain technology is able to advance the IoT, offering a trusted sharing environment where information is reliable, transparent, and traceable. The security is even more enhanced since the data source can always be identified, and data remains immutable. In this manner, the utilization of blockchain can complement the IoT with solid and transparent information.

However, although blockchain applications are being broadly conveyed, penetrating more sectors and industries, numerous issues have not been solved yet. Therefore, blockchains are scaling and are becoming more efficient but not so durable.

AI-driven blockchain for IoT

Although blockchain technology is used for security, many issues, such as network size, complexity, and transaction cost, exist. To address these issues, the integration of artificial intelligence and blockchain can play a vital role.

The integration can produce a robust technology that can address many IoT challenges that are connected to the enormous amount of data produced by billions of IoT devices which can easily be analyzed by AI algorithms. Blockchain can store immutable records of the actions of IoT devices and offer and store them in a decentralized system offering autonomous operation. Blockchain networks are able to make IoT infrastructure more secure and resilient. However, due to the limitations in computational resources, blockchain networks are often restricted by scalability issues and delays in transaction processing.

Integrating AI with blockchain can benefit both technologies. For AI, blockchain can offer solutions to many issues of AI, such as transparency and explainability, since AI works like a black box. Additionally, blockchain can enhance AI effectiveness to secure data sharing that allows more data, an increased, therefore, increase training data and produces more efficient and accurate algorithms. Furthermore, the implementation of AI with smart contracts can reduce risks, as smart contracts are programmed to implement detailed actions when the conditions are met.

In the case of blockchain, AI is able to offer solutions to some of the issues of blockchain, such as the consensus protocol. Adopting AI in PoW or PoS can make nodes to validate transactions quickly and efficiently. Moreover, AI can resolve the scalability issues of blockchain and enhance energy consumption since mining needs enormous amounts of energy.

Conclusion

In conclusion, the convergence of blockchain and AI in the IoT ecosystem holds immense transformative potential. Blockchain technology’s secure and decentralized nature, combined with AI’s ability to analyze and make intelligent decisions, opens up new horizons for transparency, security, and trust in peer-to-peer interactions. By addressing challenges such as data integrity, lack of transparency, and centralized systems, this powerful combination paves the way for innovative solutions across various sectors. As technology continues to evolve and become more accessible, it is essential to strike a balance between harnessing its benefits and mitigating potential weaknesses and threats. Embracing the potential of blockchain and AI in the IoT ecosystem will undoubtedly drive advancements, reshape industries, and contribute to a smarter and interconnected future.

Join thousands of data leaders on the AI newsletter. Join over 80,000 subscribers and keep up to date with the latest developments in AI. From research to projects and ideas. If you are building an AI startup, an AI-related product, or a service, we invite you to consider becoming a sponsor.

Published via Towards AI

Feedback ↓