Internet of Things system based on block chain technology

Through the combination of blockchain technology and smart contracts, the shortcomings of IoT systems in terms of security, data privacy and intelligent management are solved, data transparency and immutability are realized, and the system's anti-attack ability and automation are improved. The degree of enhances interoperability between devices and remote control efficiency.

CN119030686AInactive Publication Date: 2024-11-26XUZHOU UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411122024.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-15
Publication Date
2024-11-26
Estimated Expiration
Not applicable · inactive patent

Smart Images

  • Figure CN119030686A_ABST
    Figure CN119030686A_ABST
Patent Text Reader

Abstract

The invention discloses an Internet of Things system architecture method based on a block chain, and belongs to the technical field of Internet of Things security enhancement. According to the invention, the distributed account book and encryption technology of the block chain are utilized, and the data generated by the Internet of Things equipment is stored on a plurality of nodes in the network in a dispersed manner, so that the data security and reliability are ensured. And meanwhile, by means of distributed identity management, the Internet of Things equipment is recorded and tracked by using the non-tampering characteristic of the block chain, so that the traceability and management of the equipment are realized. The intelligent contract is applied to realize automatic transaction and cooperation between the Internet of Things equipment, human intervention and operation cost are reduced, and specific operation can be automatically executed through preset conditions and by utilizing environment sensor data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of Internet of Things security enhancement, and specifically relates to an Internet of Things system architecture method based on blockchain. Background Art

[0002] IoT systems usually rely on servers or cloud services for data storage, authorization, and authentication. This centralized approach is extremely vulnerable to security threats such as denial of service (DoS), Sybil attacks, or data tampering. For example, attackers can paralyze a large number of IoT devices through distributed denial of service (DDoS) attacks. In addition, the anonymity and heterogeneity of IoT devices make them challenging in terms of fault tolerance, and they are also limited by computing power, storage space, and network bandwidth. With the continuous development of this field, security issues have become a key obstacle to the further development of the Internet of Things. Most of the existing technologies focus on blockchain technology and IoT technology itself, ignoring the combination of technologies. The combination of blockchain technology and IoT not only expands the boundaries of IoT applications, but also provides safer, more efficient, and more reliable solutions. Summary of the invention

[0003] 1. Problems to be solved

[0004] The present invention aims to solve the technical problems of the Internet of Things in terms of security, data privacy, data integrity and intelligent management, provide a more secure, efficient and reliable solution for the application of the Internet of Things, expand the application scenarios of the Internet of Things, and promote the interoperability and automation between smart devices. It is necessary to study the encryption algorithm, consensus mechanism and smart contract of regional connection technology, combine the sensor technology, communication technology and cloud computing and edge computing technology of the Internet of Things, and finally become a more complete application scenario.

[0005] 2. Technical solution

[0006] In order to solve the above technical problems, the technical solution adopted by the present invention is: a blockchain-based Internet of Things system architecture method, which can make up for the deficiencies of the Internet of Things in terms of security, data privacy, data integrity and intelligent management, thereby providing a safer, more efficient and reliable solution for the application of the Internet of Things, expanding the application scenarios of the Internet of Things, and promoting the interoperability and automation between smart devices. It is characterized in that the data generated by the Internet of Things devices are stored in multiple nodes in the network by using the distributed ledger and encryption technology of the blockchain to ensure data security and reliability. At the same time, with the help of distributed identity management and the tamper-proof characteristics of the blockchain, the Internet of Things devices are recorded and tracked to achieve device traceability and management. The application of smart contracts realizes automated transactions and cooperation between Internet of Things devices, reduces human intervention and operating costs, and can automatically perform specific operations by using environmental sensor data through preset conditions.

[0007] To further supplement the above solution, the blockchain technology adopts a distributed ledger system, and each full node participating in the Internet of Things system saves a copy of the data, which reduces the Internet of Things system's dependence on centralized servers and improves the system's anti-attack capabilities and stability.

[0008] To further supplement the above solution, the blockchain adopts Ethereum smart contract technology, which can automatically execute contract terms when specific conditions are triggered, such as automatic payment, automatic rights protection, etc., which makes automated interaction between IoT devices possible.

[0009] To further supplement the above scheme, the IoT system constructed by blockchain is composed of the following core components: IoT devices (such as sensors, CAN cards on cars and Raspberry Pi), blockchain network, smart contracts and user interface (such as Geth). IoT devices are responsible for collecting data and executing control commands, blockchain network is used to safely store and verify data transactions, smart contracts automatically execute predetermined rules, and user interface provides users with a platform to interact with the system. In the IoT constructed by blockchain, each device can participate as a network node. The data generated by the device will be encrypted and sent to the blockchain network together with the timestamp. Through distributed ledger technology, that is, the invention is supported by the data security technology mentioned above, the data is stored in a decentralized database, which makes the data highly transparent and tamper-proof. In addition, smart contracts can automatically verify and execute transactions or data exchanges without the need for a central authority.

[0010] 3. Beneficial effects

[0011] Compared with the prior art, the present invention has the following beneficial effects:

[0012] The smart contract IoT constructed in the present invention represents the cutting-edge application of the integration of blockchain technology and IoT, and provides a new way to enhance the intelligent management and operational security of equipment, which can not only realize the effective collection and verification of data, but also improve the efficiency of automation and remote control of equipment management. At the same time, smart contracts enhance the security of the system, ensure the transparency of operations and the immutability of data. With the advancement of technology, future IoT systems will rely more on smart contracts to achieve a wider range of automation and intelligent applications. The combination of blockchain technology and IoT reduces the dependence of IoT systems on centralized servers and improves the system's anti-attack capabilities and stability. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] The present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments.

[0014] Figure 1 IoT and simulation device architecture diagram

[0015] Figure 2 Geth version diagram

[0016] Figure 3 Node.js version diagram

[0017] Figure 4 Web3 version diagram

[0018] Figure 5 Sensor connection diagram

[0019] Figure 6 Sensor connection diagram

[0020] Figure 7 Raspberry Pi connection diagram

[0021] Figure 8 Temperature test run result diagram

[0022] Fig. 9 Temperature test trigger alarm operation result diagram

[0023] Fig.10 Car CAN card data analysis and operation results diagram

[0024] Fig.11 Automobile CAN card data frame structure diagram DETAILED DESCRIPTION

[0025] The present invention is further described below in conjunction with specific embodiments.

[0026] The present invention specifically relates to a blockchain-based IoT system architecture method. By using the distributed ledger and encryption technology of the blockchain, the data generated by the IoT devices are dispersedly stored on multiple nodes in the network. At the same time, with the help of distributed identity management, the IoT devices are recorded and tracked by utilizing the tamper-proof characteristics of the blockchain. The application of smart contracts realizes automated transactions and cooperation between IoT devices.

[0027] In the present invention, the IoT and simulation device architecture are shown in FIG. Figure 1As shown. The blockchain-based Internet of Things built by the invention consists of three devices, including a computer as a full node of the blockchain, and two Raspberry Pis as light nodes in the blockchain to participate in the operation of the Internet of Things. The architecture of the entire network is a two-level architecture in terms of hierarchy, and a star structure logically. The blockchain-based Internet of Things built by the present invention is used in remote control car experiments. The experimental car reports its own relevant data to the control center through the Internet of Things. The Raspberry Pi is now used to simulate the experimental car and perform data transmission and interactive operations with the central node. The present invention selects Ethereum's official client Geth, and constructs an Internet of Things system by building a private chain. At the same time, the invention also cooperates with Node.js and Web3 to interact with the Geth console by executing JS scripts. Due to various factors such as the operating system and specific experimental requirements, the Geth version finally adopted by the invention is as follows Figure 2 As shown, the Node version is Figure 3 As shown, the Web3 version is Figure 4 shown.

[0028] In the present invention, the IoT system constructed by blockchain consists of the following core components: IoT devices (such as sensors, CAN cards on cars and Raspberry Pi), blockchain networks, smart contracts and user interfaces (such as Geth). IoT devices are responsible for collecting data and executing control commands, blockchain networks are used to securely store and verify data transactions, smart contracts automatically execute predetermined rules, and user interfaces provide users with a platform for interacting with the system. In the IoT constructed by blockchain, each device can participate as a network node. The data generated by the device will be encrypted and sent to the blockchain network together with a timestamp. Through distributed ledger technology, that is, the invention is supported by the data security technology described above, the data is stored in a decentralized database, which makes the data highly transparent and tamper-proof. In addition, smart contracts can automatically verify and execute transactions or data exchanges without the need for a central authority. In the experiment of remote cars, the process of the car sending a complete data to the node is mainly reflected in the following parts:

[0029] 1) Data Collection and Transmission

[0030] IoT devices (such as temperature sensors or cameras) collect environmental data, which is encrypted and securely sent to the blockchain network.

[0031] 2) Data Verification

[0032] Nodes in the network (which may be other IoT devices or services) are responsible for verifying the validity of the data. Verification usually relies on a consensus algorithm. In the IoT system described in the invention, the PoA consensus algorithm is adopted, that is, the "signer" specified in the genesis block performs the verification work.

[0033] 3) Data storage

[0034] Once the data is verified, it is added to the blockchain. Each block contains a certain number of transactions or data and is linked to the previous block through a cryptographic hash to form a continuous chain.

[0035] 4) Execute smart contracts

[0036] Smart contracts automatically execute actions when certain conditions are met. For example, if a sensor detects that the temperature exceeds a set threshold, a smart contract can automatically trigger the air conditioning system to turn on.

[0037] 5) User Interaction

[0038] Users can monitor the status of IoT devices and data on the blockchain through dedicated application programming interfaces (APIs) or graphical user interfaces (GUIs) to perform device management or data analysis.

[0039] The blockchain-based IoT smart contract constructed by the present invention consists of a set of codes that define the rules and conditions of transactions on the blockchain platform. Its structure includes: variable declaration, function definition and event notification. Variables are used to store contract status, functions are used to modify status or implement contract logic, and events are used to notify users when specific operations occur. The code of the smart contract will become unchangeable after being deployed to the blockchain, ensuring the consistency and transparency of execution. In the blockchain-based IoT constructed by the invention, remote control of the car can be achieved by deploying smart contracts. By continuously reporting to the smart contract various status information of the car obtained by the sensor, feedback information issued by the smart contract can be received when the temperature exceeds a fixed value. The relevant parts of the smart contract deployed by the invention are as follows:

[0040]

[0041] In the blockchain-based Internet of Things established by the present invention, smart contracts play a key role in the control of remote-driven cars. In terms of data collection and verification, smart contracts can be used to verify the authenticity and accuracy of data collected from devices on remote-driven cars. In terms of device control and automated response, smart contracts automatically command cars to perform specific operations based on the collected data, such as temperature adjustment, lighting control, etc. At the same time, smart contracts enable remote management of cars, allowing users to update device settings or perform fault diagnosis through smart contracts, thereby reducing manual intervention and improving management efficiency. The invention divides the process of building the Internet of Things into the following steps:

[0042] 1) Initialization and deployment

[0043] Developers of IoT solutions first need to write smart contract code to define the logic and conditions for device operations. Smart contract code is usually written in high-level languages ​​such as Solidity, and then deployed to the blockchain. Each deployed contract has a unique address, also known as a contract account, through which devices can interact with the contract.

[0044] 2) Data interaction and processing

[0045] IoT devices regularly send collected data to the blockchain network. Smart contracts automatically receive this data and process it according to built-in logic. For example, a smart contract can calculate the average temperature and decide whether to adjust the operating status of related equipment based on the set rules.

[0046] 3) Automatic execution and control

[0047] Once the data meets specific conditions defined in the smart contract, such as the temperature exceeds a preset safety threshold, the smart contract automatically executes the corresponding operation instructions. These instructions may include sending commands to related equipment to perform switching operations or adjust the operating parameters of the equipment.

[0048] 4) Security and Updates

[0049] The immutability of smart contracts on the blockchain provides additional security for IoT devices. Any attempt to modify a smart contract will be detected and rejected by other nodes in the network, ensuring transparency of operations and security of the system. In addition, contract updates require multiple confirmations or compliance with specific protocol rules to ensure the system's continued adaptability and upgrade capabilities.

[0050] 5) Continuous monitoring and incident handling

[0051] Smart contracts in IoT systems can also be programmed to monitor device status and performance and process events that occur in the system in real time. For example, contracts can be designed to automatically notify maintenance personnel or activate backup systems when equipment failure or performance degradation is detected to ensure uninterrupted service.

[0052] In the IoT built by the invention, there is only one blockchain. In a multi-chain environment, smart contracts can also implement cross-chain operations. For example, a smart contract running on Ethereum can interact with another contract running on a different blockchain, expanding the operational capabilities and application scope of IoT devices. By achieving interoperability between different blockchains, smart contracts can integrate a variety of devices and services more widely. It is worth noting that the execution of smart contracts is entirely dependent on conditional triggers, which are determined by the logic defined in the contract. When the conditions are met, the contract will execute the relevant transactions. Blockchain technology guarantees the irreversibility and certainty of these transactions, that is, once a smart contract executes an operation, these operations cannot be tampered with or revoked. Therefore, strict code review and testing are required during the development process to ensure the correctness and security of contract behavior. In addition, since smart contracts are directly connected to the operation of physical devices, incorrect code may lead to unexpected consequences of device operation.

[0053] In the blockchain-based Internet of Things architecture constructed by the present invention, a consensus algorithm is used to strengthen the security protection of the blockchain Internet of Things, effectively resisting malicious nodes from attacking the network or tampering with transaction data. The consensus algorithm requires that all nodes participating in the Internet of Things must follow established rules and protocols to ensure the legitimacy and uniformity of transactions and blocks. In addition, thanks to the application of the consensus algorithm, even if there is a failure in the network or there are malicious nodes, the nodes of the blockchain network can still reach a consensus to ensure the consistency of transactions and block states. This consistency is one of the core characteristics of blockchain technology, making blockchain a trusted distributed database. The consensus algorithm also improves the reliability of the blockchain network, enabling the network to continue to operate and process a large number of transactions. Through the consensus algorithm, the nodes in the network can effectively collaborate to ensure the timely confirmation and processing of transactions and blocks, thereby improving the availability and reliability of the network.

[0054] In the application scenario of the Internet of Things based on blockchain built by the present invention, considering that it takes a long time to monitor various parameters on the car in real time, small energy consumption, secure data guarantee, and timely transaction confirmation are all issues that need to be considered for the Internet of Things built by the invention. Considering that the Proof of Stake (PoS) algorithm of the PoS algorithm is a consensus algorithm relative to the Proof of Work (PoW), it determines the right to generate blocks by holding the amount of currency. On this basis, considering that the invention is built for the private chain of laboratory 417, the invention believes that the PoA of the node verifier is a credible organization or individual, which is more suitable for continuously monitoring various status parameters sent by the car at a lower cost in the experiment and giving corresponding responses. The core principle of the PoA algorithm is that the pre-authorized node (called the verifier) ​​is responsible for generating and verifying the block. These verifiers are usually credible entities with known identities, and they maintain the security of the network through identity and reputation. This greatly improves the resource waste problem and the speed problem in the PoW consensus algorithm described before the invention. In the Internet of Things PoS algorithm built by the present invention, a new block is first generated according to the network protocol by selecting a node instance and broadcasting it to the network. The node that generates the block will receive a certain reward as an incentive. After other nodes receive the new block, they will verify it to ensure that the transactions therein are valid and comply with the network rules and protocols. If the verification is passed, the new block will be added to the blockchain to reach a consensus. Only after the block reaches a consensus, the transaction in the block is considered to be successfully published. In order to establish a blockchain Internet of Things based on the equity proof consensus algorithm, it is necessary to declare the entire blockchain in the file of the genesis block when building the genesis block. The Clique consensus algorithm used in the invention belongs to the Proof of Authority (PoA) consensus mechanism. Wherein period represents the block time interval in seconds, and is set to generate a new block every 15 seconds. Epoch represents the number of blocks of each epoch length, which is used to adjust the voting snapshot, and is set to recalculate the vote every 30,000 blocks to determine which nodes can become authoritative nodes.

[0055] The inventor used blockchain to build the Internet of Things in the laboratory 417 of Jingxin Building of Xuzhou Institute of Engineering, aiming to improve the security performance of the entire Internet of Things. The network environment built by the Internet of Things is the local area network of laboratory 417, and the IP address of each device is the IP address assigned by the DHCP protocol in the local area network of 417. After the Internet of Things is built, different smart contracts can be deployed to meet the corresponding needs under different experimental conditions and backgrounds. The specific implementation steps are as follows:

[0056] 1) Simulation process

[0057] In order to further study the practical application of remote driving car collecting data from sensors and sending it to the labeling node, the invention will elaborate on the process of using DS18B20 temperature sensor to simulate the information collected by the CAN card on the car. As a high-precision digital temperature sensor, DS18B20 is widely used in various environmental monitoring and equipment control due to its high accuracy, small size, easy interface connection and other characteristics. In the remote driving car system, by integrating such sensors in an analog way, the temperature changes inside the vehicle and the surrounding environment can be monitored in real time, providing important data support for the system. The reason why the invention chooses DS18B20 temperature sensor is as follows. First, the invention considers the basic characteristics of DS18B20 temperature sensor and its application in the simulation car system. DS18B20 sensor has a one-wire interface (One-Wire), which means that in addition to power and ground wires, only one data wire is needed to complete the data reading work. This simplified wiring method is very suitable for vehicles, which have strict requirements on space layout and line management. The sensor itself supports a measurement range of -55°C to +125°C with a resolution of 0.5°C, which is an ideal simulator choice for automotive interior environments that require precise temperature control.

[0058] In terms of technical implementation, in order to further simulate the remote driving car collecting data from the sensor and sending it to the labeling node, the invention uses the DS18B20 temperature sensor to simulate the information collected by the CAN card on the car. DS18B20 is a single-bus digital temperature sensor with high precision and digital signal output, which is very suitable for remote data monitoring systems. In the actual car monitoring system, the CAN card, as part of the vehicle's internal communication network, is responsible for collecting data from various sensors and sending it to the on-board computer or remote monitoring center through the CAN bus. In this simulation, we use DS18B20 to replace the temperature sensor in the real car and obtain data through its precise temperature measurement function. In order to realize data transmission, the invention wrote a JavaScript (JS) script to send the temperature data collected by the DS18B20 sensor to the smart contract account on the target node with a specific communication protocol. Smart contracts are self-executing contracts stored on the blockchain, and their code will be automatically executed when the predetermined conditions are met. In this study, the smart contract account is designed to receive and process the data sent by the sensor. When the smart contract account receives the temperature information from the DS18B20 sensor, it first determines whether the temperature value is within the legal range. If the temperature is within the preset normal range, the smart contract will not take any action and will only record the data on the blockchain for future query and analysis. This data can be used as a reference for vehicle maintenance or as a basis for driving habit analysis. However, if the temperature reported by the sensor is outside the normal range, such as too high, the smart contract will immediately trigger a warning mechanism. This warning may be a simple message pushed to the owner's mobile app to alert the owner to possible overheating problems in the vehicle. In more serious cases, if the temperature is far beyond the safety threshold, the smart contract can even instruct the vehicle to take emergency measures, such as automatically reducing the speed, starting the cooling system, or guiding the vehicle to the nearest parking lot when it is safe.

[0059] In terms of technical implementation, the access and data reading of the DS18B20 temperature sensor is completed through a microcomputer such as the Raspberry Pi. The Raspberry Pi has sufficient computing power and network capabilities to run JS scripts to send sensor data to the blockchain network over the Internet. On the Raspberry Pi, we need to perform a series of configurations, including enabling the 1-Wire interface, installing the necessary software modules, and writing scripts for reading temperature data and sending data. The writing of the JS script needs to take into account the interaction with the smart contract. First, the script needs to be able to read the temperature data of the DS18B20 sensor, which can be achieved by accessing a specific file in the Raspberry Pi file system. Then, the script needs to format the data into a format that the smart contract can understand, usually a string of encoded hexadecimal numbers. Finally, the script needs to use the Web3.js library of the Ethereum network to communicate with the smart contract, send transactions, and handle any responses or events that may occur.

[0060] 2) Sensor

[0061] First, you need to consider how to connect the DS18B20 temperature sensor to the Raspberry Pi. The required materials include the Raspberry Pi, the DS18B20 temperature sensor, a 4.7kΩ pull-up resistor, and several jumpers. The DS18B20 sensor usually has three pins: VDD, GND, and DQ. VDD is the power input (red wire), GND is the ground wire (black wire), and DQ is the data line (yellow wire). When connecting, connect the red wire (VDD) of the DS18B20 to the 3.3V power pin of the Raspberry Pi, and the black wire (GND) to any GND pin of the Raspberry Pi. Finally, connect the yellow wire (DQ) to a GPIO pin of the Raspberry Pi (usually GPIO4). Connect a 4.7kΩ pull-up resistor between the DQ data line and the VDD power line. This resistor is very critical because it ensures that the data line remains at a high level in the idle state, thereby ensuring the accuracy of data transmission. The connection circuit diagram of the sensor is as follows Figure 5As shown. The operation of DS18B20 is based on the one-wire bus protocol, which is a unique communication protocol that allows multiple similar devices to share the same data line for communication, greatly simplifying wiring and system expansion. Each DS18B20 sensor has a unique 64-bit serial number to distinguish different individuals, which means that multiple DS18B20 sensors can be connected on the same data line, and each sensor can be individually addressed and read. The temperature range that DS18B20 can measure is -55℃ to +125℃, and the resolution can be configured from 9 to 12 bits. This high-precision digital output can be transmitted over long distances more accurately without interference compared to analog signals. There is an analog-to-digital converter (ADC) inside the sensor, which converts the measured temperature into a digital value and sends it to the main controller (Raspberry Pi in this case) via a one-wire bus. The actual picture of the sensor connection is as follows Figure 6 shown.

[0062] 3) Connection between Raspberry Pi and sensor

[0063] After configuring the software in the Raspberry Pi operating system, it can communicate smoothly with the DS18B20 temperature sensor. Figure 7 As shown. The use of DS18B20 requires not only the preparation of physical connection, but also depends on the support of software level, including the configuration of operating system and the loading of driver, as well as the subsequent data reading and processing. This part is crucial to ensure that the system accurately reads and processes the temperature data from the sensor. In the Internet of Things project, the coordination between hardware devices and operating systems is the key to achieve data acquisition and control. Especially when using microcomputers such as Raspberry Pi, the configuration of the operating system becomes the basis for connecting external sensors and performing specific tasks. The DS18B20 temperature sensor communicates with the host through a one-wire bus protocol, and the implementation of this protocol depends on the support of the operating system level.

[0064] The Raspberry Pi operating system (based on Linux Raspbian) provides support for the 1-wire bus protocol, but requires manual configuration by the user to activate the corresponding function. The Raspberry Pi enables the 1-wire bus protocol support on the GPIO pins by modifying the boot configuration file. This operation involves adding a specific Device Tree Overlay in the / boot / config.txt file, which is a data structure used in the Linux kernel to describe hardware component information. Specifically, by adding dtoverlay=w1-gpio,gpiopin=4 in the configuration file (assuming that GPIO4 is used as the data transmission pin), the Raspberry Pi will load the driver for the 1-wire bus protocol at boot time, allowing communication with the DS18B20 sensor through the specified GPIO pin. The addition of this configuration item reflects the ability of the microcomputer to dynamically configure the hardware functions during the boot process, allowing users to customize the behavior of the hardware interface according to the project requirements. After restarting the Raspberry Pi, the operating system will load the necessary modules according to the updated configuration file to activate the corresponding hardware functions. After the operating system restarts and loads the 1-wire bus support, the next task is to load the Linux kernel modules related to the 1-wire bus communication. These modules are middleware for interaction between the operating system and hardware devices, responsible for implementing protocol details and handling data transmission. In the Raspberry Pi, the modules that need to be manually loaded include w1-gpio and w1-therm, which support the 1-wire bus communication of the GPIO interface and the data processing of the temperature sensor respectively. After loading these modules, the operating system will create device folders corresponding to each connected DS18B20 sensor in the / sys / bus / w1 / devices directory, and each folder name contains a unique 64-bit serial number. This serial number is encoded in each DS18B20 sensor at the factory and is used to uniquely identify each device in the 1-wire bus protocol. Users can communicate directly with specific sensors by accessing these folders. After successfully detecting the sensor, the Raspberry Pi can obtain temperature data by accessing the device folder representing the sensor and reading the file named w1_slave. The w1_slave file contains the raw data collected from the sensor, including a cyclic redundancy check (CRC) code to verify the integrity of the data. Open and read this file, and the Raspberry Pi will parse the file content.

[0065] 4) High temperature detection

[0066] After successfully connecting the sensor to the Raspberry Pi, the data detected by the temperature sensor can be sent to the smart contract on the blockchain through the Raspberry Pi, thereby realizing temperature monitoring. The smart contract deployed by the invention is as follows:

[0067]

[0068]

[0069] Through the smart contract, it can be detected that when the temperature exceeds 30 degrees Celsius, an alarm will be triggered. After deploying the smart contract, the inventor ran the script that called the smart contract. The temperature test results are as follows: Figure 8 To further verify the functional integrity of the smart contract, the invention calls the smart contract again and transmits a constant that exceeds the temperature setting value of the smart contract as input data to the blockchain. From the results, it can be seen that the contract can identify temperatures that exceed the specified value and issue an alarm. The results of the temperature test triggering the alarm are shown in Fig. 9 shown.

[0070] 5) Car CAN card data reading

[0071] The inventor mentioned earlier that the original purpose of using blockchain to build the Internet of Things was to serve as a security guarantee for the remote car to send data to the control console in the remote driving experiment of Laboratory 417 of Xuzhou Institute of Engineering. On this basis, the inventor published a smart contract for reading the car CAN card data on the private chain. The main function of this smart contract is to receive data and identify the corresponding values ​​of each parameter. The results of the car CAN card data analysis are as follows Fig.10 As shown. Fig.10 As can be seen from the figure, the smart contract successfully identified the values ​​of each parameter and returned a parameter list. The test data used when testing the smart contract is 0xB3CA0101C0AAAACC. After converting the test data into binary, it can be split according to the CAN card data frame structure. The CAN card data frame structure is as follows Fig.11 By comparing the data frame structure diagram and the result diagram returned by the smart contract, it is not difficult to find that the smart contract correctly identifies the values ​​of each field and returns a parameter list.

[0072] It is known from common technical knowledge that the present invention can be implemented by other embodiments that do not deviate from its spirit or essential features. Therefore, the above disclosed embodiments are only illustrative in all respects and are not exclusive. All changes within the scope of the present invention or within the scope equivalent to the present invention are included in the present invention.

Claims

1. A blockchain-based IoT system architecture method, characterized by Methods for distributing and storing data generated by IoT devices in multiple nodes of a network by using distributed ledger and encryption technology of blockchain (1); methods for implementing automated transactions and cooperation between IoT devices by using smart contracts (2); and methods for jointly ensuring the security of IoT systems by using blockchain and smart contracts (3).

2. The blockchain technology according to claim 1 adopts a distributed ledger system, characterized in that Each full node participating in the IoT system saves a copy of the data, reducing the IoT system's reliance on centralized servers and improving the system's anti-attack capabilities and stability. The blockchain-based IoT built by the invention consists of three devices, including a computer as a full node of the blockchain and two Raspberry Pis as light nodes in the blockchain to participate in the operation of the IoT. The entire network is a two-level architecture in terms of hierarchy and a star structure in terms of logic.

3. The blockchain according to claim 2 adopts the Clique consensus algorithm, characterized in that The ability to automatically execute contract terms when specific conditions are triggered makes it possible for automated interactions between IoT devices. The present invention writes a JavaScript (JS) script to send the temperature data collected by the DS18B20 sensor to the smart contract account on the target node using a specific communication protocol. The script uses the Web3.js library of the Ethereum network to communicate with the smart contract, send transactions, and handle any responses or events that may occur.

4. The IoT system constructed with blockchain according to claim 3 is characterized by being composed of the following core components: IoT devices (such as sensors, CAN cards on cars and Raspberry Pi), blockchain networks, smart contracts and user interfaces (such as Geth). IoT devices are responsible for collecting data and executing control commands, blockchain networks are used to securely store and verify data transactions, smart contracts automatically execute predetermined rules, and user interfaces provide users with a platform for interacting with the system. In the IoT constructed with blockchain, each device can participate as a network node. The data generated by the device will be encrypted and sent to the blockchain network together with a timestamp. Through distributed ledger technology, that is, the invention is supported by the data security technology mentioned above, and the data is stored in a decentralized database, which makes the data highly transparent and tamper-proof. In addition, smart contracts can automatically verify and execute transactions or data exchanges without the need for a central authority.