Blockchain Mechanism and Symmetric Encryption in A Wireless Sensor Network

The Internet of Things (IoT) paradigm allows the connection and exchange of information between millions of smart devices. This paradigm grows and develops exponentially as do the risks and attacks on IoT infrastructures. Security, privacy, reliability, and autonomy are the most important requirements in IoT Systems. If these issues are not guaranteed, the IoT system could be susceptible to malicious users and malicious use. In centralized IoT systems, attacks and risks are greater, especially when data is transmitted between devices and shared with other organizations. To avoid these types of situations, this work presents a decentralized system that guarantees the autonomy and security of an IoT system. The proposed methodology helps to protect data integrity and availability based on the security advantages provided by blockchain and the use of cryptographic tools. The accuracy of the proposed methodology was measured on a temperature and humidity sensing IoT-based Wireless Sensor Network (WSN). The obtained results prove that the proposal fulfils the main requirements of an IoT system. It is autonomous, secure to share and send information between devices and users, has privacy, it is reliable, and the information is available in the infrastructure. Furthermore, this research demonstrates that the proposal is less susceptible to the most frequent attacks against IoT systems, such as linking attack, man in the middle, and Distributed Denial of Service (DDoS) attack.


Introduction
The Internet of Things (IoT) can be seen as a network of physical devices, with the ability to collect and share different types of information in any location, time, medium, and context [1]. With these characteristics, IoT can be applied in many different fields, for example, in health care, monitoring, and sending vital information about the patients to the doctors to make their diagnosis [2]. In the military, the IoT technology is used for secure information exchange between remote units with the use of low-consumption wireless sensor networks [3]. Likewise, IoT plays a vital role in smart cities, buildings, and homes, with various contributions to improve the quality of life of the inhabitants. The authors of Reference [4] implemented an IoT video surveillance system with smart cameras using facial recognition to increase home security. Although data security and autonomy have great importance in the proposed IoT system to guarantee the integrity and availability of the video surveillance system, these characteristics are not taken into account. Besides, in Reference [5], an energy monitoring system based on IoT was proposed that uses an Android graphic interface to measure and show the excessive use of electricity in the home. In this work, the information is shared with users through an Android app; protocol, where a hash value can be calculated from the source data, but not vice versa. When a new block is added to the chain, the hash is calculated from the new block, as was done with the previous block. The hash is registered in the new block, along with the information it contains. If someone wants to make a modification or forgery in the block that has just been added, the discrepancy between the data and the hash is detectable [38]. If the new block was independent, no one would notice the discrepancy, but as its hash is calculated using the hash of the previous block, the discrepancy is notorious. To fix this, all the hashes of all the blocks must be falsified, and this task is very exhaustive, which requires too much effort, and that is why the blockchain becomes immune to counterfeiting. Figure 1 shows the general structure of a blockchain. The header contains the hash value of the current block, the previous block, and a timestamp. The body part consists of transactions or data.  Several authors propose different solutions for this detail with the use of cryptographic algorithms [43]. A cryptographic algorithm modifies the data in a document to achieve some security features such as authentication, integrity, and confidentiality [44]. An example is the Advanced Encryption Standard (AES). AES is a symmetric encryption algorithm with a high degree of security. Figure 2 shows the AES encryption process. Encryption converts data into an unintelligible form called encrypted text, while decryption converts this encrypted text into original plain text. The AES algorithm can use 128-, 192-, or 256-bit cryptographic keys to encrypt and decrypt data in 128-bit blocks [43]. Other way to secure the blockchain is to use authentication tools like in [45], where the authors propose a new light authentication called LBRAPS based on bitwise exclusive-or (XOR).
Sensors 2020, 20, x FOR PEER REVIEW 5 of 20 There are three types of blockchain: public, private, and hybrid [39]. The public type implies that the blockchain model is public and data is open, and anyone can consult, validate, and make use of the model. Some examples are Bitcoin, Ethereum, Monero, Dash, and Litecoi. The private blockchain is the opposite and it depends on the policies of the organization that allows access to the company or network. Finally, there are the consortium or permit networks, which are hybrid models between public and private [40]. In IoT systems, blockchain is applied like a communication protocol between devices, as in Reference [41], where a comparison between a communication protocol MQTT with blockchain is carried out. In the obtained results, the authors express how the use of a public blockchain model in an IoT system helps to solve security problems. However, this work only uses robust resources due to the public blockchain mechanism that is used. Another way to implement the blockchain in IoT systems is presented in Reference [42]. In this work, the use of blockchain to generate blocks of all collected information from an IoT system is carried out. This fact represents a more optimal way of embedded IoT systems. A detail with this proposal is that when data is collected and travels to the storage, there is a vulnerable point in the system. Several authors propose different solutions for this detail with the use of cryptographic algorithms [43]. A cryptographic algorithm modifies the data in a document to achieve some security features such as authentication, integrity, and confidentiality [44]. An example is the Advanced Encryption Standard (AES). AES is a symmetric encryption algorithm with a high degree of security. Figure 2 shows the AES encryption process. Encryption converts data into an unintelligible form called encrypted text, while decryption converts this encrypted text into original plain text. The AES algorithm can use 128-, 192-, or 256-bit cryptographic keys to encrypt and decrypt data in 128-bit blocks [43]. Other way to secure the blockchain is to use authentication tools like in [45], where the authors propose a new light authentication called LBRAPS based on bitwise exclusive-or (XOR). Figure 3 shows the proposed methodology integrating blockchain and symmetric encryption in a wireless sensor network system to monitor physical variables like temperature and humidity.

Methodology
First, the sensors measure the temperature and humidity. The wireless sensor network was deployed in an office at the university's faculty of engineering, where usually between three to ten people work. Temperature and humidity were measured every minute. The temperature inside the office ranged between 19 and 21 °C. Once obtained from the sensors, the data was encrypted with the AES methodology. The private key was statically assigned based on two parameters: the number of busy nodes in the WSN and the signal type used for the temperature or humidity monitoring. At this point, the encrypted data travels to the receiver using the MQTT protocol, which applies a topicbased publish-subscribe architecture. These topics are the monitored variables, such as humidity and temperature. Once the message reaches the recipient, the data is decrypted with the private key that was used for the encryption. After the information goes through the decryption process, it uploads the information to a local database along with the timestamp from when the information was entered   Figure 3 shows the proposed methodology integrating blockchain and symmetric encryption in a wireless sensor network system to monitor physical variables like temperature and humidity.

Methodology
First, the sensors measure the temperature and humidity. The wireless sensor network was deployed in an office at the university's faculty of engineering, where usually between three to ten people work. Temperature and humidity were measured every minute. The temperature inside the office ranged between 19 and 21 • C. Once obtained from the sensors, the data was encrypted with the AES methodology. The private key was statically assigned based on two parameters: the number of busy nodes in the WSN and the signal type used for the temperature or humidity monitoring. At this point, the encrypted data travels to the receiver using the MQTT protocol, which applies a topic-based publish-subscribe architecture. These topics are the monitored variables, such as humidity and temperature. Once the message reaches the recipient, the data is decrypted with the private key that was used for the encryption. After the information goes through the decryption process, it uploads the information to a local database along with the timestamp from when the information was entered and the node ID of where it came from. In parallel, the data can be visualized to interpret and observe the signals. When there is a considerable amount of data in the local database, the blockchain block is created with all the records that are in the database. The block is added to the data, along with the rest of the blocks containing previous records of the WSN. This is how the chain is formed into a blockchain, sharing the data with different users, and in the meantime, ensuring that modifications in the data or changes in the chain do not occur.
Sensors 2020, 20, x FOR PEER REVIEW 6 of 20 and the node ID of where it came from. In parallel, the data can be visualized to interpret and observe the signals. When there is a considerable amount of data in the local database, the blockchain block is created with all the records that are in the database. The block is added to the data, along with the rest of the blocks containing previous records of the WSN. This is how the chain is formed into a blockchain, sharing the data with different users, and in the meantime, ensuring that modifications in the data or changes in the chain do not occur.

Key Characteristics of Blockchain
The blockchain as a new module contributes to the security of the WSN with its characteristics. To have data integrity and traceability in a blockchain, the authors of Reference [46] concluded four attributes from other research. From these, we considered three to be relevant in a WSN: • Autonomous: This is considered one of the most important aspects of a blockchain system, as no one is controlling or governing the system.
• Immutability: Blockchain is used for security purposes in many applications because it cannot be manipulated without a trace using currently known technology.
• Contractual: The blockchain creates consensus between the chains or peers. The consensus process is executed autonomously using rules according to the data status, contributing to the full autonomy of the system. These characteristics are essential in various fields of the Internet of Things. The authors of Reference [47] described a Cloud-Based IoT network architecture, with a need for system autonomy and incorruptible data storing blocks. Also, a blockchain system for industry 4.0 was presented in Reference [48], and the study agrees on how decentralization, verifiability, and immutability can be used to improve security (along with other cryptographic tools).

Data Security in Wireless Networks
Providing security in wireless sensor networks differs from traditional approaches due to resource limitations and computational restrictions. A sensor network can be called secure if it can provide end-to-end security, fulfilling the requirements of confidentiality, authenticity, and data availability [49]. The sheer number of interconnections between thousands of sensor nodes in large sensor networks can cause technical issues such as interoperability issues, lack of service quality, and data accessibility problems. To evaluate the security systems for existing wireless sensor networks, the authors of Reference [50] propose to use requirements such as data confidentiality, authenticity, and availability. Also, they mention how cryptographic and security authentication tools like key management, symmetric, asymmetric, or hybrid encryption provide various security options for the sensor network. In Reference [51], evaluation points for wireless sensor network security are proposed. The first four points have primary importance, and the last is important in some sensor network systems.

Key Characteristics of Blockchain
The blockchain as a new module contributes to the security of the WSN with its characteristics. To have data integrity and traceability in a blockchain, the authors of Reference [46] concluded four attributes from other research. From these, we considered three to be relevant in a WSN:

•
Autonomous: This is considered one of the most important aspects of a blockchain system, as no one is controlling or governing the system. • Immutability: Blockchain is used for security purposes in many applications because it cannot be manipulated without a trace using currently known technology. • Contractual: The blockchain creates consensus between the chains or peers. The consensus process is executed autonomously using rules according to the data status, contributing to the full autonomy of the system.
These characteristics are essential in various fields of the Internet of Things. The authors of Reference [47] described a Cloud-Based IoT network architecture, with a need for system autonomy and incorruptible data storing blocks. Also, a blockchain system for industry 4.0 was presented in Reference [48], and the study agrees on how decentralization, verifiability, and immutability can be used to improve security (along with other cryptographic tools).

Data Security in Wireless Networks
Providing security in wireless sensor networks differs from traditional approaches due to resource limitations and computational restrictions. A sensor network can be called secure if it can provide end-to-end security, fulfilling the requirements of confidentiality, authenticity, and data availability [49]. The sheer number of interconnections between thousands of sensor nodes in large sensor networks can cause technical issues such as interoperability issues, lack of service quality, and data accessibility problems. To evaluate the security systems for existing wireless sensor networks, the authors of Reference [50] propose to use requirements such as data confidentiality, authenticity, and availability. Also, they mention how cryptographic and security authentication tools like key management, symmetric, asymmetric, or hybrid encryption provide various security options for the sensor network. In Reference [51], evaluation points for wireless sensor network security are proposed. The first four points have primary importance, and the last is important in some sensor network systems.

1.
Data availability refers to ensuring robust security in the sensor network, to protect the resources or the sensor nodes. The nodes in the sensor networks must have self-protection to avoid unnecessary message processing or task execution. This can reduce energy use and increase the life span of the sensor network. Wireless sensor networks are susceptible to multiple types of denial of service attacks, node compromise attacks, and resource consumption attacks [52]. Therefore, the availability and security of resources must be effectively maintained.

2.
Data confidentiality can be achieved by allowing only authenticated users to access data or devices in the system to send messages. In sensor networks, data can be protected using cryptographic methods to allow only authenticated users to access it. Unauthorized or third parties cannot read the original data if confidentiality is effectively provided [53]. Therefore, to have data confidentiality, wireless sensor networks must use encryption methods.

3.
Data authentication in sensor networks allows the system to verify whether data is sent from authorized sources or not, and also protects the original data from alterations.

4.
Data integrity in sensor networks is necessary to verify the information reliability and capacity, to ensure that the message has not been damaged, altered, or changed. The integrity of the network is violated when the malicious node in the network sends false data with a valid identifier id.

5.
Time synchronization is important in systems with sensor node uptime coordination, as a more collaborative sensor network may involve group synchronization.
These security assessment features for wireless sensor networks are applied in various fields of IoT. Reference [54], References [55] and [56] in Medicine 4.0, Reference [57] in mobile cloud computing, and Reference [48] in Industry 4.0 agree that data availability, confidentiality, authentication, and integrity are evaluation points in security systems which must be complied with in the implementation of IoT. As each field uses a different variation of information from multiple types of users that use a different kind of technology, these general security requirements must be set as security goals.

System Performance Metrics
The exponential growth of development in low-power electronics, ubiquitous smart sensors, and Wireless Sensor Networks (WSN) produces a wide range of monitoring and tracking applications. These technologies must meet with various quality requirements. The authors of Reference [58] proposed evaluation metrics for Quality of Service (QoS).
Latency is the delay experienced by packet during the travel from the source to the receiver node. The network layer can achieve minimal latency or end-to-end delay by calculating the shortest route or the route with the least obstruction for the packet. According to Reference [59], the Message Queue Telemetry Transport (MQTT) communication protocol counts with a latency of 40 ms. This is considered a low time compared to Reference [60], as other protocols can reach 1000 ms in latency. On the other hand, even though the use of blockchain could affect the latency of the system in general terms, it can still cope with an even higher level of delays. According to Reference [61], several authors implemented Etherum, a public blockchain model, causing 15,000 ms of lag, and their IoT systems were able to handle it. While using private blockchain designs, they experienced only 8000 ms latency [62].
Reliability is the network's ability to transmit information in real-time. To ensure this, a light communication protocol can be used, or if the system has to cover large areas, several receiver points can be placed. The studies of References [63][64][65] mention that the lower the latency, the greater the reliability. The throughput is the number of packets arriving safely at the system per second. In the work of Reference [66], their 3-node system presents an interval of 2.12 to 2.81 messages per second, with generic microcontrollers such as ESP8082 and Arduino Yun Mini.
Adaptivity or scalability is the system's capacity to adapt to the changes, like adding or removing nodes from the network or any alteration that could affect the stability of the systems.
In addition to these characteristics, the Central Processing Unit (CPU) frequency, the percentage of CPU usage, and the system temperature are important to quantify the system's performance and lifetime. The authors of Reference [67] mention how the important factors are the CPU frequency and the percentage of the CPU, as adequate use of these two considerably lengthens the lifetime of the system. Likewise, the authors of Reference [68] mention the importance of the system temperature. If it exceeds the limits, the system can be irreversibly damaged, or it can simply hinder its performance, affecting the variables such as adaptivity or reliability, as well as the security and integrity of the data.
The selection of these characteristics to measure the performance of an IoT system agrees with the works of References [54][55][56][57][69][70][71]. They agree that low latency is an important characteristic of IoT systems. According to the authors of Reference [54], the communication protocol plays a major role in this property and low latency helps the interoperability of the system. The authors of Reference [56] argue that scalability and reliability are also important as the size of the IoT systems are constantly growing.
These performance characteristics in wireless sensor networks can be affected by the computational complexity of some encryption tools. According to the authors of Reference [72], the computational cost of the encryption algorithms depends on the number of encryption cycles or rounds, which is dependent on the size of the key that is used for the encryption. Table 1 presents a comparison of six encryption tools with different key sizes, block sizes, and numbers of rounds. According to the authors of Reference [73], cryptographic tools with more than 16 rounds tend to be more robust, but it is not recommended to use them in WSNs directly because of their slow performance and exceeding memory requirement. The results reported in Reference [74] show that encryption algorithms which use 64-bit keys to preserve the privacy of your information can be broken in 3.5 months with supercomputers which test 1012 passwords in a second. While encryption algorithms using 128-bit keys at this time are valued at 5.4 × 1018 years. According to the authors of Reference [73], the security solution developed for wireless sensor networks must be modular. The number of rounds in the AES encryption algorithm depends on the size of the encryption key. If the size of the key is 128, the system uses 10 rounds, if it is 192, it will use 12, and if the key size is 256, the number of rounds is 14. This method does not require complex computing and energy-intensive procedures and works simply by dividing a message into 128-bit blocks in length and sequentially encrypting its 128-bit key. This algorithm has been tested in the ZigBee modules of practically all modern manufacturers, finding a balance between security and system performance [75].

System Architecture
The proposed system is designed according to the layered architecture of an IoT system and it is outlined in Figure 4. The first layer represents the environment with the monitored signals such as temperature and humidity. The second is the perception layer, where the WSN is located with three sensor nodes, each consisting of a Telaire T9602 sensor and a Pycom brand WiPy 3.0 microcontroller. The microcontroller works with python programming language version 2.7 with access to a great number of libraries and applications. In the transport layer, the encrypted data travels to the receiver using the MQTT protocol. This protocol was selected for its favorable characteristics like scalability, the secure message sending and receiving, minimum bandwidth, energy consumption and processing, and its publisher/subscriber architecture, among others. The middleware layer is essential not only for the proposed methodology but also for the MQTT protocol and the publish/subscribe architecture based on topics. For the development of the IoT system of WSNs, a Raspberry Pi 3B+ model was used. This layer has the function of being an intermediary of messages in the wireless sensor network. In parallel, it decrypts messages with the AES methodology and moves the records to the database.
The application layer is where the blockchain and the "Grafana" graphic display system are located. The visualization of the data is in real-time while the page is being updated. In the proposed embedded system, the blocks are generated with all the records contained in the database, and each block is uploaded to be part of the blockchain. In the last section, we can find the end-users who access the data manually in the blockchain through an administrator for different purposes. After accessing the data, the users can work with the data but cannot modify it. If there is a modification, the chain is broken, and the blockchain system is affected.
Sensors 2020, 20, x FOR PEER REVIEW 9 of 20 using the MQTT protocol. This protocol was selected for its favorable characteristics like scalability, the secure message sending and receiving, minimum bandwidth, energy consumption and processing, and its publisher/subscriber architecture, among others. The middleware layer is essential not only for the proposed methodology but also for the MQTT protocol and the publish/subscribe architecture based on topics. For the development of the IoT system of WSNs, a Raspberry Pi 3B+ model was used. This layer has the function of being an intermediary of messages in the wireless sensor network. In parallel, it decrypts messages with the AES methodology and moves the records to the database. The application layer is where the blockchain and the "Grafana" graphic display system are located. The visualization of the data is in real-time while the page is being updated. In the proposed embedded system, the blocks are generated with all the records contained in the database, and each block is uploaded to be part of the blockchain. In the last section, we can find the end-users who access the data manually in the blockchain through an administrator for different purposes. After accessing the data, the users can work with the data but cannot modify it. If there is a modification, the chain is broken, and the blockchain system is affected.
The operation of symmetric AES encryption in conjunction with the MQTT protocol is described in Figure 5. This figure displays how the data travels encrypted through the network with the MQTT protocol. The encryption key in this example is the node ID with a size of 128-, 192-, or 256-bits. For security reasons, only the node and the broker know the key.  Figure 6a represents how one of the sensor nodes works during the test. Also, Figure 6b shows the internal structure of the node, the Wipy 3.0, and the Telaire T9602 humidity and temperature sensor. On the other hand, Figure 7 presents a screenshot of the Grafana data visualization interface that displays the information from the database in real-time.     Figure 6b shows the internal structure of the node, the Wipy 3.0, and the Telaire T9602 humidity and temperature sensor. On the other hand, Figure 7 presents a screenshot of the Grafana data visualization interface that displays the information from the database in real-time. Figure 6a represents how one of the sensor nodes works during the test. Also, Figure 6b shows the internal structure of the node, the Wipy 3.0, and the Telaire T9602 humidity and temperature sensor. On the other hand, Figure 7 presents a screenshot of the Grafana data visualization interface that displays the information from the database in real-time.   Figure 6a represents how one of the sensor nodes works during the test. Also, Figure 6b shows the internal structure of the node, the Wipy 3.0, and the Telaire T9602 humidity and temperature sensor. On the other hand, Figure 7 presents a screenshot of the Grafana data visualization interface that displays the information from the database in real-time.

Blockchain Design
The transaction or block in the chain ( Figure 8) has two parts: a header and a body. The header has four attributes: • Timestamp: This attribute is necessary to know when the block was created in all transactions.

•
Block hash: This hash is important because it will be linked to the future block. The hash is created based on the transactions of the day. If a piece of information is modified, the hash no longer matches the one registered in this field. • Block number: This data represents the position the block occupies in the chain to know the number of blocks that the blockchain system contains.

Blockchain Design
The transaction or block in the chain ( Figure 8) has two parts: a header and a body. The header has four attributes: Timestamp: This attribute is necessary to know when the block was created in all transactions. Block hash: This hash is important because it will be linked to the future block. The hash is created based on the transactions of the day. If a piece of information is modified, the hash no longer matches the one registered in this field. Block number: This data represents the position the block occupies in the chain to know the number of blocks that the blockchain system contains.
The body contains all the records or transactions of the data in the database that were made during the day or at a certain time. Figure 9 exhibits the creation of the blocks and their unification in a blockchain system. The first block is the genesis block. In the original blockchain design for Bitcoin, Satoshi Nakamoto proposes this block to be the basis of the construction of the entire chain [32]. The design of this block contains all the fields except the hash of the previous block.

Results
Hardware performance was tested in two scenarios. First, the sensor network system operated with the symmetric encryption mechanism and the proposed private blockchain system. In the second scenario, the sensor network system without the proposed safety mechanisms was tested to show that the methodology can be implemented in a low-resource architecture. In the test scenario, a Raspberry Pi 3B+ was used with the following architecture: 1.4 GHz 64-bit quad-core processor Dual-band wireless Local Area Network (LAN)  The body contains all the records or transactions of the data in the database that were made during the day or at a certain time. Figure 9 exhibits the creation of the blocks and their unification in a blockchain system. The first block is the genesis block. In the original blockchain design for Bitcoin, Satoshi Nakamoto proposes this block to be the basis of the construction of the entire chain [32]. The design of this block contains all the fields except the hash of the previous block.

Blockchain Design
The transaction or block in the chain ( Figure 8) has two parts: a header and a body. The header has four attributes: Timestamp: This attribute is necessary to know when the block was created in all transactions. Block hash: This hash is important because it will be linked to the future block. The hash is created based on the transactions of the day. If a piece of information is modified, the hash no longer matches the one registered in this field. Block number: This data represents the position the block occupies in the chain to know the number of blocks that the blockchain system contains.
The body contains all the records or transactions of the data in the database that were made during the day or at a certain time. Figure 9 exhibits the creation of the blocks and their unification in a blockchain system. The first block is the genesis block. In the original blockchain design for Bitcoin, Satoshi Nakamoto proposes this block to be the basis of the construction of the entire chain [32]. The design of this block contains all the fields except the hash of the previous block.

Results
Hardware performance was tested in two scenarios. First, the sensor network system operated with the symmetric encryption mechanism and the proposed private blockchain system. In the second scenario, the sensor network system without the proposed safety mechanisms was tested to show that the methodology can be implemented in a low-resource architecture. In the test scenario, a Raspberry Pi 3B+ was used with the following architecture: 1.4 GHz 64-bit quad-core processor Dual-band wireless Local Area Network (LAN)

Results
Hardware performance was tested in two scenarios. First, the sensor network system operated with the symmetric encryption mechanism and the proposed private blockchain system. In the second scenario, the sensor network system without the proposed safety mechanisms was tested to show that the methodology can be implemented in a low-resource architecture. In the test scenario, a Raspberry Pi 3B+ was used with the following architecture: The duration of the test in both scenarios was 120 minutes. During this time, we recorded the state of the hardware attributes every minute, such as the system temperature, the CPU's working frequency, and the percentage of CPU usage. Figures 10 and 11 show the system temperature on the Celsius scale. The black line represents the system behavior when both blockchain and symmetric encryption systems are jointly working. The blue lines in Figures 10 and 11 visualize the system temperature in the second scenario, without applying the proposal. There are sections in Figure 10 over the black line, where the temperature reaches 57 • C; during these peak intervals, the chain is formed from the blocks by the blockchain system. In both waveforms, the temperature reaches between 49 to 51 • C because the graphic visualization of the data or any query in the database was performed. In Figure 11, temperature trend is shown to be maintained, however, this performance has slightly increased as the system was being used for other functions, such as data consultation and graphical monitoring.
Sensors 2020, 20, x FOR PEER REVIEW 12 of 20  4 GB de Random Access Memory (RAM)  Operating System (OS) Raspbian The duration of the test in both scenarios was 120 minutes. During this time, we recorded the state of the hardware attributes every minute, such as the system temperature, the CPU's working frequency, and the percentage of CPU usage. Figures 10 and 11 show the system temperature on the Celsius scale. The black line represents the system behavior when both blockchain and symmetric encryption systems are jointly working. The blue lines in Figures 10 and 11 visualize the system temperature in the second scenario, without applying the proposal. There are sections in Figure 10 over the black line, where the temperature reaches 57 °C; during these peak intervals, the chain is formed from the blocks by the blockchain system. In both waveforms, the temperature reaches between 49 to 51 °C because the graphic visualization of the data or any query in the database was performed. In Figure 11, temperature trend is shown to be maintained, however, this performance has slightly increased as the system was being used for other functions, such as data consultation and graphical monitoring.
The graphs of Figures 12 and 13 show the CPU frequency of the embedded system. In the Raspberry Pi 3B+, frequency ranges from 600 to 1400 MHz. In this figure, the black line represents the system behavior when both blockchain and the symmetric encryption system operate. In the same way, the blue line represents the behavior without the proposed methodology. These waveforms show intervals where CPU frequency is extended to a total of 1400 MHz. This happened when the blockchain block was created for the IoT system and this was uploaded to the data cloud.
Besides, Figures 14 and 15 represent the waveforms of the system CPU usage. The black line represents the behavior of the system when the blockchain and the symmetric encryption system are running, and the blue line represents the behavior without the system. In the Raspberry Pi embedded system, the maximum percentage is 100%. These graphs show how the system does not use 50% of the capacity in both study cases.    The duration of the test in both scenarios was 120 minutes. During this time, we recorded the state of the hardware attributes every minute, such as the system temperature, the CPU's working frequency, and the percentage of CPU usage. Figures 10 and 11 show the system temperature on the Celsius scale. The black line represents the system behavior when both blockchain and symmetric encryption systems are jointly working. The blue lines in Figures 10 and 11 visualize the system temperature in the second scenario, without applying the proposal. There are sections in Figure 10 over the black line, where the temperature reaches 57 °C; during these peak intervals, the chain is formed from the blocks by the blockchain system. In both waveforms, the temperature reaches between 49 to 51 °C because the graphic visualization of the data or any query in the database was performed. In Figure 11, temperature trend is shown to be maintained, however, this performance has slightly increased as the system was being used for other functions, such as data consultation and graphical monitoring.
The graphs of Figures 12 and 13 show the CPU frequency of the embedded system. In the Raspberry Pi 3B+, frequency ranges from 600 to 1400 MHz. In this figure, the black line represents the system behavior when both blockchain and the symmetric encryption system operate. In the same way, the blue line represents the behavior without the proposed methodology. These waveforms show intervals where CPU frequency is extended to a total of 1400 MHz. This happened when the blockchain block was created for the IoT system and this was uploaded to the data cloud.
Besides, Figures 14 and 15 represent the waveforms of the system CPU usage. The black line represents the behavior of the system when the blockchain and the symmetric encryption system are running, and the blue line represents the behavior without the system. In the Raspberry Pi embedded system, the maximum percentage is 100%. These graphs show how the system does not use 50% of the capacity in both study cases.   The graphs of Figures 12 and 13 show the CPU frequency of the embedded system. In the Raspberry Pi 3B+, frequency ranges from 600 to 1400 MHz. In this figure, the black line represents the system behavior when both blockchain and the symmetric encryption system operate. In the same way, the blue line represents the behavior without the proposed methodology. These waveforms show intervals where CPU frequency is extended to a total of 1400 MHz. This happened when the blockchain block was created for the IoT system and this was uploaded to the data cloud.
Besides, Figures 14 and 15 represent the waveforms of the system CPU usage. The black line represents the behavior of the system when the blockchain and the symmetric encryption system are running, and the blue line represents the behavior without the system. In the Raspberry Pi embedded system, the maximum percentage is 100%. These graphs show how the system does not use 50% of the capacity in both study cases.

Hardware Performance
Based on the results of the previously presented experiments, we can identify several vital points in the proposed wireless sensor network architecture. We can observe in the graphs of the temperature and the percentage of CPU usage that not all resources are used. Scalability is one of the essential features in wireless sensor networks and any IoT system. During the tests, we observed that adding or removing nodes does not disturb any aspect of the architecture or methodology, the blockchain system and symmetric encryption continue to work without any problem or delay in sending packages.
According to Reference [76], the temperature limit on a Raspberry Pi 3B+ is 85 • C. If this limit is exceeded, the embedded system suffers damage in its structure and operation. In both testing scenarios, we noted that the temperature never exceeded 60 • C. Furthermore, according to Reference [41], the system could present problems in its performance and the interoperability of the entire infrastructure when the CPU usage reaches 90% or 100%. The obtained CPU usage results (Figures 14 and 15), applying the proposed methodological approach, remain below 50% of the capacity of those in Reference [42], and occupy between 98% and 100% of all the capacity of the systems. It can be noted that despite using a robust architecture, their proposal turns out to be too heavy to be implemented in a low-resource system.
The system's performance analysis, using the metrics defined in Section 3.1, shows that the presented proposal has a good balance between security and resource consumption. Features such as low latency and reliability were achieved thanks to the MQTT protocol. The latency of 40 ms can be considered an acceptable value, compared to other protocols where latency can go up to 120 or 1000 ms. The reliability is reflected in the number of packets connecting to the system per second, which was 1.94 packets per second in a space of two hours of experimentation. The graphs of the system performance (Figures 10-15) show that the low-resource usage was not altered by the use of cryptographic tools, thanks to the low computational consumption of the AES. Also, despite the low-power usage, AES provides a high degree of security, reliability, and integrity to the data transmitted over the network. Adaptivity or scalability is possible due to the low consumption of resources. Adding or removing an N number of nodes does not affect the interoperability of the system. Neither the security system nor any level of infrastructure was affected, as the graphs of system performance (Figures 10-15) show. It is demonstrated that the use of cryptographic tools of average computational usage, such as AES, has a significant impact on the system to have a good performance, provide security, reliability, integrity, and availability to the system, and also do not interfere with the interoperability of infrastructure. Table 2 presents a comparison of two investigations against our proposal. These works were selected based on the following criteria: (1) To be set in a real scenario, and (2) to address the same research topic as this work, a security proposal for IoT systems which has been implemented in a real infrastructure without simulations. The evaluated performance indexes are: 1.

Security Analysis
Basic security: As stated in Reference [77], it is defined in three fundamental security aspects: confidentiality, integrity, and availability (CIA).

2.
DDoS attack: It is understood as the resistance or not to this type of attack, based on its architecture and model.

3.
Linking attack: It is identified as the resistant or not to this type of attack, based on the architecture it proposes.

4.
Interoperability: This feature refers to whether all the model layers exchange information and use the exchanged information.

5.
Cryptographic tools: Tools that were used or not used for the development of the IoT system.

6.
Type of blockchain: Identified as private, public, or consortium.  The comparison between the models of Reference [77,78] with our proposal makes evident some differences. In our project, Hashwas used as a cryptographic tool in the blockchain during transactions with different organizations. Besides, the AES tool was used in the data transport layer. There are numerous advantages to using these encryption tools. HASH maps arbitrary size data to a fixed size string. AES is a symmetric encryption tool that requires a private key for encryption and decryption of information, the length of which must be 128-, 192-, or 256-bits. Furthermore, they are designed to be a one-way function. So, the only way to get the input data from the HASH code is by brute-force searching for the possible inputs or using a table of matching hashes. Moreover, the proposed methodology applies private blockchain while the other methods used public blockchain for their model. This choice makes the proposed model more robust, and the design adaptable to other needs of the sensor network system, adding more features as the IoT system grows. Table 3 presents the characteristics, pros, and cons of each related scheme. Table 3. Characteristics, pros, and cons of each related scheme.

Basic Security Aspects
Confidentiality, integrity, and availability to the IoT system and the information it shares.
It can disturb the performance of the system, it depends on the resources that are used.

Decentralization
The decentralized approach helps the overall security and integrity of the system.
It could represent a high computational cost for the system.

Topic-based publish-subscribe architecture
Prevent unknown devices from spamming the system, trying to spread malware, or launching a Distributed Denial of Service (DDoS) attack.
A static architecture could be represented as a limitation for some IoT systems.

MQTT communication protocol
Due to its characteristics, it can boast of having a really low consumption as well as using very few resources for its operation.
Being designed as a lightweight protocol, the use of cryptographic tools for data transmission is not contemplated.

Cryptographic tools
Integrity and reliability of the information that is shared locally and externally.
It could represent a high computational cost for the system, depending on the resources used and the way they are applied.

Blockchain type
A private blockchain is customdesigned based on the needs of the system.
The needs of the IoT system change according to time and interaction with users. Blockchain's designs, being more robust, cover the needs of the system without having to make changes to the design.

Conclusion
Risk growth and analysis are among the main concerns in the development of the IoT paradigm. This research presents a decentralized infrastructure for IoT systems, which guarantees the security,  The comparison between the models of Reference [77,78] with our proposal makes evident some differences. In our project, Hashwas used as a cryptographic tool in the blockchain during transactions with different organizations. Besides, the AES tool was used in the data transport layer. There are numerous advantages to using these encryption tools. HASH maps arbitrary size data to a fixed size string. AES is a symmetric encryption tool that requires a private key for encryption and decryption of information, the length of which must be 128-, 192-, or 256-bits. Furthermore, they are designed to be a one-way function. So, the only way to get the input data from the HASH code is by brute-force searching for the possible inputs or using a table of matching hashes. Moreover, the proposed methodology applies private blockchain while the other methods used public blockchain for their model. This choice makes the proposed model more robust, and the design adaptable to other needs of the sensor network system, adding more features as the IoT system grows. Table 3 presents the characteristics, pros, and cons of each related scheme. Table 3. Characteristics, pros, and cons of each related scheme.

Basic Security Aspects
Confidentiality, integrity, and availability to the IoT system and the information it shares.
It can disturb the performance of the system, it depends on the resources that are used.

Decentralization
The decentralized approach helps the overall security and integrity of the system.
It could represent a high computational cost for the system.

Topic-based publish-subscribe architecture
Prevent unknown devices from spamming the system, trying to spread malware, or launching a Distributed Denial of Service (DDoS) attack.
A static architecture could be represented as a limitation for some IoT systems.

MQTT communication protocol
Due to its characteristics, it can boast of having a really low consumption as well as using very few resources for its operation.
Being designed as a lightweight protocol, the use of cryptographic tools for data transmission is not contemplated.

Cryptographic tools
Integrity and reliability of the information that is shared locally and externally.
It could represent a high computational cost for the system, depending on the resources used and the way they are applied.

Blockchain type
A private blockchain is customdesigned based on the needs of the system.
The needs of the IoT system change according to time and interaction with users. Blockchain's designs, being more robust, cover the needs of the system without having to make changes to the design.

Conclusion
Risk growth and analysis are among the main concerns in the development of the IoT paradigm. This research presents a decentralized infrastructure for IoT systems, which guarantees the security, Sensors 2020, 20, x FOR PEER REVIEW The comparison between the models of Reference [77,78] with our proposal make differences. In our project, Hashwas used as a cryptographic tool in the bloc transactions with different organizations. Besides, the AES tool was used in the data There are numerous advantages to using these encryption tools. HASH maps arbitra fixed size string. AES is a symmetric encryption tool that requires a private key for decryption of information, the length of which must be 128-, 192-, or 256-bits. Furthe designed to be a one-way function. So, the only way to get the input data from the H brute-force searching for the possible inputs or using a table of matching hashes. proposed methodology applies private blockchain while the other methods used pu for their model. This choice makes the proposed model more robust, and the desig other needs of the sensor network system, adding more features as the IoT system presents the characteristics, pros, and cons of each related scheme. Table 3. Characteristics, pros, and cons of each related scheme.

Basic Security Aspects
Confidentiality, integrity, and availability to the IoT system and the information it shares.
It can disturb the performanc depends on the resources

Decentralization
The decentralized approach helps the overall security and integrity of the system.
It could represent a high com for the system

Topic-based publish-subscribe architecture
Prevent unknown devices from spamming the system, trying to spread malware, or launching a Distributed Denial of Service (DDoS) attack.
A static architecture could be limitation for some IoT

MQTT communication protocol
Due to its characteristics, it can boast of having a really low consumption as well as using very few resources for its operation.
Being designed as a lightwei use of cryptographic to transmission is not con

Cryptographic tools
Integrity and reliability of the information that is shared locally and externally.
It could represent a high com for the system, depending o used and the way they

Blockchain type
A private blockchain is customdesigned based on the needs of the system.
The needs of the IoT system c to time and interaction Blockchain's designs, being m the needs of the system wit make changes to the

Conclusion
Risk growth and analysis are among the main concerns in the development of the This research presents a decentralized infrastructure for IoT systems, which guarante  The comparison between the models of Reference [77,78] with our proposal makes evident some differences. In our project, Hashwas used as a cryptographic tool in the blockchain during transactions with different organizations. Besides, the AES tool was used in the data transport layer. There are numerous advantages to using these encryption tools. HASH maps arbitrary size data to a fixed size string. AES is a symmetric encryption tool that requires a private key for encryption and decryption of information, the length of which must be 128-, 192-, or 256-bits. Furthermore, they are designed to be a one-way function. So, the only way to get the input data from the HASH code is by brute-force searching for the possible inputs or using a table of matching hashes. Moreover, the proposed methodology applies private blockchain while the other methods used public blockchain for their model. This choice makes the proposed model more robust, and the design adaptable to other needs of the sensor network system, adding more features as the IoT system grows. Table 3 presents the characteristics, pros, and cons of each related scheme. Table 3. Characteristics, pros, and cons of each related scheme.

Basic Security Aspects
Confidentiality, integrity, and availability to the IoT system and the information it shares.
It can disturb the performance of the system, it depends on the resources that are used.

Decentralization
The decentralized approach helps the overall security and integrity of the system.
It could represent a high computational cost for the system.

Topic-based publish-subscribe architecture
Prevent unknown devices from spamming the system, trying to spread malware, or launching a Distributed Denial of Service (DDoS) attack.
A static architecture could be represented as a limitation for some IoT systems.

MQTT communication protocol
Due to its characteristics, it can boast of having a really low consumption as well as using very few resources for its operation.
Being designed as a lightweight protocol, the use of cryptographic tools for data transmission is not contemplated.

Cryptographic tools
Integrity and reliability of the information that is shared locally and externally.
It could represent a high computational cost for the system, depending on the resources used and the way they are applied.

Blockchain type
A private blockchain is customdesigned based on the needs of the system.
The needs of the IoT system change according to time and interaction with users. Blockchain's designs, being more robust, cover the needs of the system without having to make changes to the design.

Conclusion
Risk growth and analysis are among the main concerns in the development of the IoT paradigm. This research presents a decentralized infrastructure for IoT systems, which guarantees the security,  The comparison between the models of Reference [77,78] with our proposal makes evident some differences. In our project, Hashwas used as a cryptographic tool in the blockchain during transactions with different organizations. Besides, the AES tool was used in the data transport layer. There are numerous advantages to using these encryption tools. HASH maps arbitrary size data to a fixed size string. AES is a symmetric encryption tool that requires a private key for encryption and decryption of information, the length of which must be 128-, 192-, or 256-bits. Furthermore, they are designed to be a one-way function. So, the only way to get the input data from the HASH code is by brute-force searching for the possible inputs or using a table of matching hashes. Moreover, the proposed methodology applies private blockchain while the other methods used public blockchain for their model. This choice makes the proposed model more robust, and the design adaptable to other needs of the sensor network system, adding more features as the IoT system grows. Table 3 presents the characteristics, pros, and cons of each related scheme. Table 3. Characteristics, pros, and cons of each related scheme.

Basic Security Aspects
Confidentiality, integrity, and availability to the IoT system and the information it shares.
It can disturb the performance of the system, it depends on the resources that are used.

Decentralization
The decentralized approach helps the overall security and integrity of the system.
It could represent a high computational cost for the system.

Topic-based publish-subscribe architecture
Prevent unknown devices from spamming the system, trying to spread malware, or launching a Distributed Denial of Service (DDoS) attack.
A static architecture could be represented as a limitation for some IoT systems.

MQTT communication protocol
Due to its characteristics, it can boast of having a really low consumption as well as using very few resources for its operation.
Being designed as a lightweight protocol, the use of cryptographic tools for data transmission is not contemplated.

Cryptographic tools
Integrity and reliability of the information that is shared locally and externally.
It could represent a high computational cost for the system, depending on the resources used and the way they are applied.

Blockchain type
A private blockchain is customdesigned based on the needs of the system.
The needs of the IoT system change according to time and interaction with users. Blockchain's designs, being more robust, cover the needs of the system without having to make changes to the design.

Conclusion
Risk growth and analysis are among the main concerns in the development of the IoT paradigm. This research presents a decentralized infrastructure for IoT systems, which guarantees the security, Sensors 2020, 20, x FOR PEER REVIEW The comparison between the models of Reference [77,78] with our proposal make differences. In our project, Hashwas used as a cryptographic tool in the bloc transactions with different organizations. Besides, the AES tool was used in the data There are numerous advantages to using these encryption tools. HASH maps arbitra fixed size string. AES is a symmetric encryption tool that requires a private key for decryption of information, the length of which must be 128-, 192-, or 256-bits. Furthe designed to be a one-way function. So, the only way to get the input data from the H brute-force searching for the possible inputs or using a table of matching hashes. proposed methodology applies private blockchain while the other methods used pu for their model. This choice makes the proposed model more robust, and the desig other needs of the sensor network system, adding more features as the IoT system presents the characteristics, pros, and cons of each related scheme. Table 3. Characteristics, pros, and cons of each related scheme.

Basic Security Aspects
Confidentiality, integrity, and availability to the IoT system and the information it shares.
It can disturb the performanc depends on the resources

Decentralization
The decentralized approach helps the overall security and integrity of the system.
It could represent a high com for the system

Topic-based publish-subscribe architecture
Prevent unknown devices from spamming the system, trying to spread malware, or launching a Distributed Denial of Service (DDoS) attack.
A static architecture could be limitation for some IoT

MQTT communication protocol
Due to its characteristics, it can boast of having a really low consumption as well as using very few resources for its operation.
Being designed as a lightwei use of cryptographic to transmission is not con

Cryptographic tools
Integrity and reliability of the information that is shared locally and externally.
It could represent a high com for the system, depending o used and the way they

Blockchain type
A private blockchain is customdesigned based on the needs of the system.
The needs of the IoT system c to time and interaction Blockchain's designs, being m the needs of the system wit make changes to the

Conclusion
Risk growth and analysis are among the main concerns in the development of the This research presents a decentralized infrastructure for IoT systems, which guarante  The comparison between the models of Reference [77,78] with our proposal makes evident some differences. In our project, Hashwas used as a cryptographic tool in the blockchain during transactions with different organizations. Besides, the AES tool was used in the data transport layer. There are numerous advantages to using these encryption tools. HASH maps arbitrary size data to a fixed size string. AES is a symmetric encryption tool that requires a private key for encryption and decryption of information, the length of which must be 128-, 192-, or 256-bits. Furthermore, they are designed to be a one-way function. So, the only way to get the input data from the HASH code is by brute-force searching for the possible inputs or using a table of matching hashes. Moreover, the proposed methodology applies private blockchain while the other methods used public blockchain for their model. This choice makes the proposed model more robust, and the design adaptable to other needs of the sensor network system, adding more features as the IoT system grows. Table 3 presents the characteristics, pros, and cons of each related scheme. Table 3. Characteristics, pros, and cons of each related scheme.

Basic Security Aspects
Confidentiality, integrity, and availability to the IoT system and the information it shares.
It can disturb the performance of the system, it depends on the resources that are used.

Decentralization
The decentralized approach helps the overall security and integrity of the system.
It could represent a high computational cost for the system.

Topic-based publish-subscribe architecture
Prevent unknown devices from spamming the system, trying to spread malware, or launching a Distributed Denial of Service (DDoS) attack.
A static architecture could be represented as a limitation for some IoT systems.

MQTT communication protocol
Due to its characteristics, it can boast of having a really low consumption as well as using very few resources for its operation.
Being designed as a lightweight protocol, the use of cryptographic tools for data transmission is not contemplated.

Cryptographic tools
Integrity and reliability of the information that is shared locally and externally.
It could represent a high computational cost for the system, depending on the resources used and the way they are applied.

Blockchain type
A private blockchain is customdesigned based on the needs of the system.
The needs of the IoT system change according to time and interaction with users. Blockchain's designs, being more robust, cover the needs of the system without having to make changes to the design.

Conclusion
Risk growth and analysis are among the main concerns in the development of the IoT paradigm.  The comparison between the models of Reference [77,78] with our proposal makes evident some differences. In our project, Hashwas used as a cryptographic tool in the blockchain during transactions with different organizations. Besides, the AES tool was used in the data transport layer. There are numerous advantages to using these encryption tools. HASH maps arbitrary size data to a fixed size string. AES is a symmetric encryption tool that requires a private key for encryption and decryption of information, the length of which must be 128-, 192-, or 256-bits. Furthermore, they are designed to be a one-way function. So, the only way to get the input data from the HASH code is by brute-force searching for the possible inputs or using a table of matching hashes. Moreover, the proposed methodology applies private blockchain while the other methods used public blockchain for their model. This choice makes the proposed model more robust, and the design adaptable to other needs of the sensor network system, adding more features as the IoT system grows. Table 3 presents the characteristics, pros, and cons of each related scheme. Table 3. Characteristics, pros, and cons of each related scheme.

Basic Security Aspects
Confidentiality, integrity, and availability to the IoT system and the information it shares.
It can disturb the performance of the system, it depends on the resources that are used.

Decentralization
The decentralized approach helps the overall security and integrity of the system.
It could represent a high computational cost for the system.

Topic-based publish-subscribe architecture
Prevent unknown devices from spamming the system, trying to spread malware, or launching a Distributed Denial of Service (DDoS) attack.
A static architecture could be represented as a limitation for some IoT systems.

MQTT communication protocol
Due to its characteristics, it can boast of having a really low consumption as well as using very few resources for its operation.
Being designed as a lightweight protocol, the use of cryptographic tools for data transmission is not contemplated.

Cryptographic tools
Integrity and reliability of the information that is shared locally and externally.
It could represent a high computational cost for the system, depending on the resources used and the way they are applied.

Blockchain type
A private blockchain is customdesigned based on the needs of the system.
The needs of the IoT system change according to time and interaction with users. Blockchain's designs, being more robust, cover the needs of the system without having to make changes to the design.

Conclusion
Risk growth and analysis are among the main concerns in the development of the IoT paradigm.
Sensors 2020, 20, x FOR PEER REVIEW The comparison between the models of Reference [77,78] with our proposal make differences. In our project, Hashwas used as a cryptographic tool in the bloc transactions with different organizations. Besides, the AES tool was used in the data There are numerous advantages to using these encryption tools. HASH maps arbitra fixed size string. AES is a symmetric encryption tool that requires a private key for decryption of information, the length of which must be 128-, 192-, or 256-bits. Furthe designed to be a one-way function. So, the only way to get the input data from the H brute-force searching for the possible inputs or using a table of matching hashes. proposed methodology applies private blockchain while the other methods used pu for their model. This choice makes the proposed model more robust, and the desig other needs of the sensor network system, adding more features as the IoT system presents the characteristics, pros, and cons of each related scheme. Table 3. Characteristics, pros, and cons of each related scheme.

Basic Security Aspects
Confidentiality, integrity, and availability to the IoT system and the information it shares.
It can disturb the performanc depends on the resources

Decentralization
The decentralized approach helps the overall security and integrity of the system.
It could represent a high com for the system

Topic-based publish-subscribe architecture
Prevent unknown devices from spamming the system, trying to spread malware, or launching a Distributed Denial of Service (DDoS) attack.
A static architecture could be limitation for some IoT

MQTT communication protocol
Due to its characteristics, it can boast of having a really low consumption as well as using very few resources for its operation.
Being designed as a lightwei use of cryptographic to transmission is not con

Cryptographic tools
Integrity and reliability of the information that is shared locally and externally.
It could represent a high com for the system, depending o used and the way they

Blockchain type
A private blockchain is customdesigned based on the needs of the system.
The needs of the IoT system c to time and interaction Blockchain's designs, being m the needs of the system wit make changes to the

Conclusion
Risk growth and analysis are among the main concerns in the development of the  The comparison between the models of Reference [77,78] with our proposal makes evident some differences. In our project, Hashwas used as a cryptographic tool in the blockchain during transactions with different organizations. Besides, the AES tool was used in the data transport layer. There are numerous advantages to using these encryption tools. HASH maps arbitrary size data to a fixed size string. AES is a symmetric encryption tool that requires a private key for encryption and decryption of information, the length of which must be 128-, 192-, or 256-bits. Furthermore, they are designed to be a one-way function. So, the only way to get the input data from the HASH code is by brute-force searching for the possible inputs or using a table of matching hashes. Moreover, the proposed methodology applies private blockchain while the other methods used public blockchain for their model. This choice makes the proposed model more robust, and the design adaptable to other needs of the sensor network system, adding more features as the IoT system grows. Table 3 presents the characteristics, pros, and cons of each related scheme. Table 3. Characteristics, pros, and cons of each related scheme.

Basic Security Aspects
Confidentiality, integrity, and availability to the IoT system and the information it shares.
It can disturb the performance of the system, it depends on the resources that are used.

Decentralization
The decentralized approach helps the overall security and integrity of the system.
It could represent a high computational cost for the system.

Topic-based publish-subscribe architecture
Prevent unknown devices from spamming the system, trying to spread malware, or launching a Distributed Denial of Service (DDoS) attack.
A static architecture could be represented as a limitation for some IoT systems.

MQTT communication protocol
Due to its characteristics, it can boast of having a really low consumption as well as using very few resources for its operation.
Being designed as a lightweight protocol, the use of cryptographic tools for data transmission is not contemplated.

Cryptographic tools
Integrity and reliability of the information that is shared locally and externally.
It could represent a high computational cost for the system, depending on the resources used and the way they are applied.

Blockchain type
A private blockchain is customdesigned based on the needs of the system.
The needs of the IoT system change according to time and interaction with users. Blockchain's designs, being more robust, cover the needs of the system without having to make changes to the design.

Conclusion
Sensors 2020, 20, x FOR PEER REVIEW 15 of 20 The comparison between the models of Reference [77,78] with our proposal makes evident some differences. In our project, Hashwas used as a cryptographic tool in the blockchain during transactions with different organizations. Besides, the AES tool was used in the data transport layer. There are numerous advantages to using these encryption tools. HASH maps arbitrary size data to a fixed size string. AES is a symmetric encryption tool that requires a private key for encryption and decryption of information, the length of which must be 128-, 192-, or 256-bits. Furthermore, they are designed to be a one-way function. So, the only way to get the input data from the HASH code is by brute-force searching for the possible inputs or using a table of matching hashes. Moreover, the proposed methodology applies private blockchain while the other methods used public blockchain for their model. This choice makes the proposed model more robust, and the design adaptable to other needs of the sensor network system, adding more features as the IoT system grows. Table 3 presents the characteristics, pros, and cons of each related scheme. Table 3. Characteristics, pros, and cons of each related scheme.

Basic Security Aspects
Confidentiality, integrity, and availability to the IoT system and the information it shares.
It can disturb the performance of the system, it depends on the resources that are used.

Decentralization
The decentralized approach helps the overall security and integrity of the system.
It could represent a high computational cost for the system.

Topic-based publish-subscribe architecture
Prevent unknown devices from spamming the system, trying to spread malware, or launching a Distributed Denial of Service (DDoS) attack.
A static architecture could be represented as a limitation for some IoT systems.

MQTT communication protocol
Due to its characteristics, it can boast of having a really low consumption as well as using very few resources for its operation.
Being designed as a lightweight protocol, the use of cryptographic tools for data transmission is not contemplated.

Cryptographic tools
Integrity and reliability of the information that is shared locally and externally.
It could represent a high computational cost for the system, depending on the resources used and the way they are applied.

Blockchain type
A private blockchain is customdesigned based on the needs of the system.
The needs of the IoT system change according to time and interaction with users. Blockchain's designs, being more robust, cover the needs of the system without having to make changes to the design.

Conclusion
Sensors 2020, 20, x FOR PEER REVIEW The comparison between the models of Reference [77,78] with our proposal make differences. In our project, Hashwas used as a cryptographic tool in the bloc transactions with different organizations. Besides, the AES tool was used in the data There are numerous advantages to using these encryption tools. HASH maps arbitra fixed size string. AES is a symmetric encryption tool that requires a private key for decryption of information, the length of which must be 128-, 192-, or 256-bits. Furthe designed to be a one-way function. So, the only way to get the input data from the H brute-force searching for the possible inputs or using a table of matching hashes. proposed methodology applies private blockchain while the other methods used pu for their model. This choice makes the proposed model more robust, and the desig other needs of the sensor network system, adding more features as the IoT system presents the characteristics, pros, and cons of each related scheme. Table 3. Characteristics, pros, and cons of each related scheme.

Basic Security Aspects
Confidentiality, integrity, and availability to the IoT system and the information it shares.
It can disturb the performanc depends on the resources

Decentralization
The decentralized approach helps the overall security and integrity of the system.
It could represent a high com for the system

Topic-based publish-subscribe architecture
Prevent unknown devices from spamming the system, trying to spread malware, or launching a Distributed Denial of Service (DDoS) attack.
A static architecture could be limitation for some IoT

MQTT communication protocol
Due to its characteristics, it can boast of having a really low consumption as well as using very few resources for its operation.
Being designed as a lightwei use of cryptographic to transmission is not con

Cryptographic tools
Integrity and reliability of the information that is shared locally and externally.
It could represent a high com for the system, depending o used and the way they

Blockchain type
A private blockchain is customdesigned based on the needs of the system.
The needs of the IoT system c to time and interaction Blockchain's designs, being m the needs of the system wit make changes to the The comparison between the models of Reference [77,78] with our proposal makes evident some differences. In our project, Hashwas used as a cryptographic tool in the blockchain during transactions with different organizations. Besides, the AES tool was used in the data transport layer. There are numerous advantages to using these encryption tools. HASH maps arbitrary size data to a fixed size string. AES is a symmetric encryption tool that requires a private key for encryption and decryption of information, the length of which must be 128-, 192-, or 256-bits. Furthermore, they are designed to be a one-way function. So, the only way to get the input data from the HASH code is by brute-force searching for the possible inputs or using a table of matching hashes. Moreover, the proposed methodology applies private blockchain while the other methods used public blockchain for their model. This choice makes the proposed model more robust, and the design adaptable to other needs of the sensor network system, adding more features as the IoT system grows. Table 3 presents the characteristics, pros, and cons of each related scheme. Table 3. Characteristics, pros, and cons of each related scheme.

Advantages Disadvantages
Basic Security Aspects Confidentiality, integrity, and availability to the IoT system and the information it shares.
It can disturb the performance of the system, it depends on the resources that are used.

Decentralization
The decentralized approach helps the overall security and integrity of the system.
It could represent a high computational cost for the system.

Topic-based publish-subscribe architecture
Prevent unknown devices from spamming the system, trying to spread malware, or launching a Distributed Denial of Service (DDoS) attack.
A static architecture could be represented as a limitation for some IoT systems.

MQTT communication protocol
Due to its characteristics, it can boast of having a really low consumption as well as using very few resources for its operation.
Being designed as a lightweight protocol, the use of cryptographic tools for data transmission is not contemplated.

Cryptographic tools
Integrity and reliability of the information that is shared locally and externally.
It could represent a high computational cost for the system, depending on the resources used and the way they are applied.

Blockchain type
A private blockchain is custom-designed based on the needs of the system.
The needs of the IoT system change according to time and interaction with users. Blockchain's designs, being more robust, cover the needs of the system without having to make changes to the design.

Conclusions
Risk growth and analysis are among the main concerns in the development of the IoT paradigm. This research presents a decentralized infrastructure for IoT systems, which guarantees the security, privacy, reliability, and autonomy of the system, and where smart devices can securely communicate with each other. This proposal of a decentralized approach can be implemented in most IoT infrastructures, different contexts, and services. It is based on a private blockchain mechanism; therefore, it benefits from its security properties. Also, we analyzed the computational consumption of infrastructure and data security. The analysis was performed based on performance indices widely used and mentioned in various investigations and implementations in the field of IoT, industry 4.0, medicine 4.0, and cloud computing, among other fields. Based on these evaluations, we can conclude that the proposed methodology has a low-resource consumption and fulfils the fundamental requirements of security, confidentiality, authenticity, and availability. Besides, the security analysis shows that the decentralized infrastructure is less susceptible to the most common attacks on IoT systems, such as DDoS, man-in-the-middle, and linking attack. On the other hand, the interoperability and autonomy of the system are not affected by adding or removing smart devices from the infrastructure, and latency in the network is kept low by the proposed communication protocol. Another point to conclude is that based on the performance indices, the security of the presented proposal can be implemented in various IoT contexts, such as industry 4.0, medicine 4.0, and in smart homes, among other fields.