Internet of Things data acquisition method and device, equipment, storage medium and product

The allocation of high-quality oracle nodes and eliminating abnormal data through a polynomial time-heuristic algorithm solves the problem of uneven Internet of Things data quality and improves the quality and credibility of IoT data reported by blockchain.

CN120200736AActive Publication Date: 2025-06-24CHINA MOBILE M2M +1
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202510678779.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-26
Publication Date
2025-06-24
Estimated Expiration
2045-05-26

AI Technical Summary

Technical Problem

In the prior art, the quality of IoT data reported by oracle nodes is uneven, resulting in the low quality of IoT data reported by blockchain.

Method used

The polynomial time-heuristic algorithm is used to allocate high-quality oracle nodes to the data acquisition task, and eliminate abnormal data based on the deviation of the Internet of Things data, and perform data aggregation and uploading to the blockchain system.

Benefits of technology

Improve the credibility and quality of IoT data reported to the blockchain, ensuring the integrity and accuracy of the data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120200736A_ABST
    Figure CN120200736A_ABST
Patent Text Reader

Abstract

The invention provides an Internet of Things data acquisition method, device and equipment, a storage medium and a product, relates to the technical field of electrical digital data processing, and aims to distribute a high-quality oracle node for a data acquisition task within acceptable time through a polynomial time heuristic algorithm, avoid mismatching of the oracle node and the data acquisition task and improve the data acquisition efficiency. Therefore, the quality of the reported Internet of Things data is uneven, and the credibility of the Internet of Things data reported to the block chain is improved. And according to the deviation of the Internet of Things data, the abnormal Internet of Things data of the first Internet of Things data set is eliminated, the abnormal data and noise data in the first Internet of Things data set are eliminated, and the quality of the Internet of Things data reported to the block chain is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of electrical digital data processing, and in particular, to a method, apparatus, device, storage medium, and product for acquiring Internet of Things (IoT) data. Background Art

[0002] In recent years, blockchain technology has received increasing attention. Blockchain encodes key application logic by deploying smart contracts, enabling communicating parties to reach agreements without a trusted third party. Currently, various applications have been implemented using blockchain smart contracts, including the Internet of Things (IoT), supply chain management, transportation, healthcare, and transactions. Blockchain is a closed system and cannot directly obtain and process off-chain data. However, many smart contracts and decentralized applications need to interact with external data, such as obtaining weather data, stock prices, or sports scores. Oracle nodes, as a bridge connecting the on-chain and off-chain worlds, can provide off-chain data for smart contracts to use.

[0003] However, some smart contracts require complex calculations or process a large amount of data, while the computing power and storage resources on the chain are limited. Oracle nodes can perform these calculations off-chain and then return the calculation results to the smart contracts, thereby reducing the burden on the chain.

[0004] In blockchain, the credibility of data is crucial. The existence of oracle nodes can ensure that the data obtained from the outside is highly credible. Oracle nodes usually guarantee the integrity and accuracy of data by selecting trusted data sources and high-quality nodes. However, in existing technical solutions, the establishment of a decentralized oracle network usually has no participation threshold or a low participation threshold, which results in uneven quality among the participants of oracle network nodes and uneven quality of the data reported by oracle nodes. Summary of the Invention

[0005] The present invention provides a method, apparatus, device, storage medium, and product for acquiring Internet of Things (IoT) data, aiming to solve the defect of uneven quality of the data reported by oracle nodes in the prior art and to improve the quality of the IoT data reported to the blockchain.

[0006] In a first aspect, the present invention provides a method for obtaining Internet of Things (IoT) data, including: when a data collection task of IoT devices outside the blockchain system is recognized, allocating at least one oracle node to the data collection task according to a polynomial-time heuristic algorithm; collecting IoT data of the IoT devices based on all oracle nodes to obtain a first IoT data set, and based on the deviation of the IoT data, removing abnormal IoT data from the first IoT data set to obtain a second IoT data set; aggregating the second IoT data set to obtain first aggregated data, and uploading the first aggregated data to the blockchain system to complete the acquisition of IoT data.

[0007] In one embodiment, the blockchain system includes multiple initial oracle nodes. Allocating at least one oracle node to the data collection task according to the polynomial-time heuristic algorithm includes: calculating the inherent cost, time cost, and quality cost of the initial oracle node to complete the data collection task based on the polynomial-time heuristic algorithm; determining the total cost of the initial oracle node to complete the data collection task based on the inherent cost, time cost, and quality cost; when the total cost is higher than a preset total cost, allocating the initial oracle node to the data collection task to obtain the oracle node of the data collection task.

[0008] In one embodiment, the deviation of the IoT data is determined based on the following steps: in the first IoT data set, obtaining the median of all IoT data to obtain a first median; calculating the absolute value of the difference between each IoT data and the first median to obtain the deviation of the IoT data.

[0009] In one embodiment, based on the deviation of the IoT data, removing abnormal IoT data from the first IoT data set to obtain a second IoT data set includes: obtaining the median of the deviations of all IoT data to obtain a second median; determining a deviation threshold based on the second median; comparing the deviation of the IoT data with the deviation threshold, and when the deviation of the IoT data is greater than or equal to the deviation threshold, determining the IoT data as abnormal IoT data; removing all abnormal IoT data from the first IoT data set to obtain a second IoT data set.

[0010] In one embodiment, the data collection task is determined based on the following steps: receiving an off-chain data request sent by a user based on a user contract of the blockchain system; identifying the off-chain data request as a data collection task based on a relay contract of the blockchain system.

[0011] In one embodiment, after uploading the first aggregated data to the blockchain system to complete the acquisition of Internet of Things (IoT) data, it further includes: when a user needs to calculate the first aggregated data stored in the blockchain system, based on the oracle contract of the blockchain system, sending the first aggregated data to be calculated to the aggregator of the blockchain system; obtaining the calculation result of the aggregator for the first aggregated data to be calculated; aggregating the calculation results to obtain second aggregated data, uploading the second aggregated data to the oracle contract, and based on the oracle contract, relay contract, and user contract, sending the second aggregated data to the user.

[0012] In a second aspect, the present invention also provides an apparatus for acquiring IoT data, including: a distribution module, configured to, when identifying a data collection task for IoT devices outside the blockchain system, allocate at least one oracle node for the data collection task according to a polynomial-time heuristic algorithm; an aggregator, configured to collect IoT data of IoT devices based on all oracle nodes to obtain a first IoT data set, and based on the deviation of the IoT data, remove abnormal IoT data from the first IoT data set to obtain a second IoT data set; the aggregator is further configured to aggregate the second IoT data set to obtain first aggregated data, and upload the first aggregated data to the blockchain system to complete the acquisition of IoT data.

[0013] In a third aspect, the present invention also provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, it implements any one of the above-mentioned methods for acquiring IoT data.

[0014] In a fourth aspect, the present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements any one of the above-mentioned methods for acquiring IoT data.

[0015] In a fifth aspect, the present invention also provides a computer program product, including a computer program. When the computer program is executed by a processor, it implements any one of the above-mentioned methods for acquiring IoT data.

[0016] The method, apparatus, device, storage medium, and product for acquiring IoT data provided by the present invention, through a polynomial-time heuristic algorithm, realize the allocation of high-quality oracle nodes for data collection tasks within an acceptable time, avoid the mismatch between oracle nodes and data collection tasks, resulting in uneven quality of reported IoT data, and improve the credibility of IoT data reported to the blockchain. According to the deviation of IoT data, abnormal IoT data in the first IoT data set is removed, eliminating abnormal data and noise data in the first IoT data set, and improving the quality of IoT data reported to the blockchain. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] To more clearly illustrate the technical solutions in the present invention or the prior art, the following will briefly introduce the accompanying drawings required for the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other accompanying drawings can also be obtained based on these drawings.

[0018] Figure 1 It is one of the schematic flowcharts of the method for obtaining Internet of Things data provided by the present invention.

[0019] Figure 2 It is the second of the schematic flowcharts of the method for obtaining Internet of Things data provided by the present invention.

[0020] Figure 3 It is the schematic structural diagram of the device for obtaining Internet of Things data provided by the present invention.

[0021] Figure 4 It is the schematic structural diagram of the electronic device provided by the present invention. Detailed Embodiments

[0022] To make the objectives, technical solutions, and advantages of the present invention clearer, the following will clearly and completely describe the technical solutions in the present invention with reference to the accompanying drawings in the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. Based on the embodiments in the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the scope of protection of the present invention.

[0023] The following combines Figures 1-4 to describe the method, device, and electronic device for obtaining Internet of Things data of the present invention.

[0024] Figure 1 It is one of the schematic flowcharts of the method for obtaining Internet of Things data provided by the present invention. As Figure 1 shown, the method for obtaining Internet of Things data includes steps S100 to S300, and the specific steps are as follows.

[0025] S100: When a data collection task of an Internet of Things device outside the blockchain system is recognized, at least one oracle node is assigned to the data collection task according to the polynomial-time heuristic algorithm.

[0026] The data collection task is determined based on the following steps: receiving an off-chain data request based on the user contract of the blockchain system; identifying the off-chain data request as a data collection task based on the relay contract of the blockchain system.

[0027] The execution entity of the present invention includes a blockchain system. The blockchain system includes a smart contract, multiple initial oracle nodes, an off-chain cloud server, and an aggregator.

[0028] The smart contract is the core logic and rules for obtaining IoT data. The written smart contract code is compiled, and the compiled contract is deployed into the blockchain system. The smart contract of the present invention includes a user contract, a relay contract, and an oracle contract. Request interfaces and functions related to obtaining IoT data are defined in the smart contract. The interfaces include requesting specific types of data, specifying data sources or conditions, etc.

[0029] As Figure 2 shown, the user contract is used to receive user requests. In the Internet of Things, when a user needs to obtain off-chain information, an off-chain data request is initiated. The user contract receives the user request and calls the relay contract according to the requirements. The relay contract is used to determine whether the off-chain data request is a computing request or a data request (data collection task). If the off-chain data request is a data request (data collection task), the oracle contract is called. The oracle contract combines a polynomial-time heuristic algorithm to allocate oracle nodes outside the blockchain for the data collection task. The oracle nodes listen to and collect IoT data of IoT devices outside the blockchain system. The polynomial-time heuristic algorithm is used to find a set of oracle nodes with high quality within an acceptable time, and then execute the data collection task (execute the listening event).

[0030] The present invention receives off-chain data requests through the user contract and identifies data collection tasks through the relay contract, realizing a fine division of the obtained data collection tasks, which is beneficial to improving the accuracy and efficiency of identifying data collection tasks.

[0031] S200: Based on all oracle nodes collecting IoT data of IoT devices, a first IoT data set is obtained. Based on the deviation of the IoT data, abnormal IoT data in the first IoT data set is removed to obtain a second IoT data set.

[0032] One data collection task corresponds to at least one oracle node. Each oracle node collects IoT data of IoT devices according to the corresponding data collection task. Each oracle node sends the collected IoT data to the aggregator. The aggregator obtains a first IoT data set based on the IoT data collected by all oracle nodes. The aggregator performs subsequent processing on the first IoT data set. The IoT data collected by the oracle nodes from external data sources (such as IoT devices) may have noise and outliers. The aggregator needs to remove the noise data and abnormal data in the first IoT data set.

[0033] In the first Internet of Things (IoT) dataset, calculate the deviation of each IoT data. The deviation of the IoT data is the deviation of the IoT data relative to the median of all IoT data in the first IoT dataset.

[0034] Take the IoT data with larger deviations as abnormal IoT data (noise data or abnormal data), remove all abnormal IoT data from the first IoT dataset, and obtain a second IoT dataset based on all the remaining IoT data.

[0035] S300: Aggregate the second IoT dataset to obtain a first aggregated data, and upload the first aggregated data to the blockchain system to complete the acquisition of IoT data.

[0036] The aggregator aggregates all IoT data in the second IoT dataset. For example, perform a weighted average on all IoT data in the second IoT dataset, and use the final aggregation result as the first aggregated data. The aggregator uploads the first aggregated data to the oracle contract of the blockchain system. The oracle contract calls back the relay contract and the user contract to pass the first aggregated data to the user.

[0037] The method for acquiring IoT data provided by the embodiments of the present invention realizes the allocation of high-quality oracle nodes for data collection tasks within an acceptable time through a polynomial-time heuristic algorithm, avoiding the mismatch between oracle nodes and data collection tasks, which may lead to uneven quality of reported IoT data, and improving the credibility of IoT data reported to the blockchain. According to the deviation of the IoT data, abnormal IoT data in the first IoT dataset is removed, eliminating abnormal data and noise data in the first IoT dataset, and improving the quality of IoT data reported to the blockchain.

[0038] Based on the above embodiments, the blockchain system includes multiple initial oracle nodes. Allocating at least one oracle node for a data collection task according to the polynomial-time heuristic algorithm includes: calculating the inherent cost, time cost, and quality cost of the initial oracle node to complete the data collection task based on the polynomial-time heuristic algorithm; determining the total cost of the initial oracle node to complete the data collection task based on the inherent cost, time cost, and quality cost; when the total cost is higher than the preset total cost, allocating the initial oracle node to the data collection task to obtain the oracle node of the data collection task.

[0039] The blockchain system includes multiple initial oracle nodes. A decentralized oracle network is established in the blockchain system, and the initial oracle nodes register and join the oracle network through oracle contracts. The initial oracle nodes can be devices, sensors, or data providers with data acquisition capabilities and credibility. The initial oracle nodes submit registration requests to the oracle network, and after receiving confirmation, send registration request messages to the registration center in the oracle network, providing relevant information about the initial oracle nodes, such as node identities, public keys, etc. The registration center verifies the identities of the initial oracle nodes. For example, it verifies the authenticity and legality of the identities of the initial oracle nodes to ensure the security and credibility of the oracle network. After successful registration, the initial oracle nodes need to synchronize the data in the oracle network. Thus, they can obtain the latest status, data contracts, and relevant parameters of the oracle network, so that the initial oracle nodes can correctly provide data verification and services.

[0040] Design a polynomial-time heuristic algorithm to select trustworthy (high-quality) oracle nodes. Model the total cost for the initial oracle nodes to complete the data collection task.

[0041] Calculate the inherent cost for the initial oracle nodes to complete the data collection task, the time cost for the initial oracle nodes to complete the data collection task, and the quality cost for the initial oracle nodes to complete the data collection task. Based on the inherent cost, time cost, and quality cost, determine the total cost for the initial oracle nodes to complete the data collection task. When the total cost is higher than the preset total cost, allocate the initial oracle nodes to the data collection task to obtain the oracle nodes for the data collection task.

[0042] The inherent cost is the fee that the initial oracle nodes can receive for completing the data collection task. The inherent cost for the th initial oracle node to execute the data collection task is . The time cost is the time required for the initial oracle nodes to complete the data collection task.

[0043] ; Among them, is the time cost for the th initial oracle node to execute the data collection task, is the transmission time of the data collection task from the chain to the relay contract, is the time for the th initial oracle node to receive and execute the data collection task.

[0044] The quality cost is the accuracy of the initial oracle nodes feeding IoT data. The quality cost for the th initial oracle node to execute the data collection task is . The quality cost of the initial oracle node is evaluated based on the accuracy of the historical IoT data previously fed by the initial oracle node. For example, the historical IoT data previously fed by the initial oracle is compared with the IoT data finally adopted and submitted to the contract, and the deviation is calculated. If the deviation is smaller, it means that the accuracy of the historical IoT data is better, and the quality cost of the initial oracle node is smaller. If the deviation is larger, it means that the accuracy of the historical IoT data is worse, and the quality cost of the initial oracle node is larger.

[0045] For data suppliers, the inherent cost needs to be maximized among the inherent cost, time cost and quality cost to ensure that the initial oracle node can obtain more benefits while meeting the data collection task. The time cost and quality cost need to be minimized. Therefore, according to the polynomial time heuristic algorithm, a calculation formula for the total cost of the initial oracle node to complete the data collection task is constructed.

[0046] ; in, For the The total cost of the initial oracle nodes to complete the data collection task, is the inherent cost coefficient, is the time cost coefficient, is the quality cost coefficient, For the The inherent cost of the initial oracle nodes performing the data collection task, For the The time cost of the initial oracle node to perform the data collection task, For the The quality cost of the initial oracle node performing the data collection task.

[0047] For consumers (users), the lower the total cost, the better, but for data suppliers (data service providers), the higher the total cost, the greater the profit. This application starts from the perspective of data suppliers, solves the maximum total cost, and then seeks to maximize the profit.

[0048] When the total cost is higher than the preset total cost, the initial oracle node is assigned to the data collection task to obtain the oracle node of the data collection task. For example, the total costs of all initial oracle nodes are sorted from high to low. The preset total cost is set according to the requirements of the data collection task. The initial oracle node with a total cost higher than the preset total cost is used as the oracle node of the data collection task.

[0049] The present invention determines the total cost of an initial oracle node to complete a data collection task by calculating the inherent cost, time cost, and quality cost, achieving unified modeling of the total cost, which is beneficial to improving the accuracy of determining the oracle node for executing the data collection task.

[0050] Based on the above embodiments, the deviation of the Internet of Things data is determined according to the following steps: In the first Internet of Things data set, obtain the median of all the Internet of Things data to get the first median; calculate the absolute value of the difference between each Internet of Things data and the first median to obtain the deviation of the Internet of Things data.

[0051] In the first Internet of Things data set, obtain the median of all the Internet of Things data to get the first median. The first median is the value located at the center position in the first Internet of Things data set. For example, the first Internet of Things data set is {x1, x2,..., x i ,..., x n}}. The first median is Median1. Median1 = Median({x1, x2,..., x i ,..., x n}).

[0052] Calculate the absolute value of the difference between each Internet of Things data and the first median to obtain the deviation of the Internet of Things data.

[0053] Deviation i = |x i - Median1|; where Deviation i is the deviation of the i-th Internet of Things data in the first Internet of Things data set, Median1 is the first median, and x i is the i-th Internet of Things data in the first Internet of Things data set.

[0054] The present invention accurately obtains the central position of the data in the first Internet of Things data set by calculating the first median. By calculating the absolute value of the difference between the Internet of Things data and the first median, the deviation of the Internet of Things data is accurately measured, which is beneficial to improving the accuracy of subsequent identification of noise data and abnormal data in the first Internet of Things data set.

[0055] Based on the above embodiments, abnormal IoT data in the first IoT data set is removed based on the deviation of IoT data, and a second IoT data set is obtained, including: obtaining the median of the deviations of all IoT data to obtain a second median; determining a deviation threshold based on the second median; comparing the deviation of IoT data with the deviation threshold, and when the deviation of IoT data is greater than or equal to the deviation threshold, determining the IoT data as abnormal IoT data; removing all abnormal IoT data in the first IoT data set to obtain a second IoT data set.

[0056] In the first IoT data set, calculate the deviations of all IoT data to obtain a deviation set of IoT data {Deviation1, Deviation2,..., Deviation i ,..., Deviation n}. The deviation of IoT data is used to measure the degree of dispersion of IoT data relative to the first IoT data set. Calculate the median of the deviations of all IoT data to obtain a second median. The second median is Median2. Median2 = Median({Deviation1, Deviation2,..., Deviation i ,..., Deviation n}).

[0057] Determine a deviation threshold according to the second median Median2. For example, multiply the second median (3 times the second median) as the deviation threshold. Compare the deviation of each IoT data with the deviation threshold. If the deviation of IoT data is greater than or equal to the deviation threshold, determine the IoT data as abnormal IoT data. If the deviation of IoT data is less than the deviation threshold, determine the IoT data as normal IoT data. In the first IoT data set, remove all abnormal IoT data, and obtain a second IoT data set according to all normal IoT data.

[0058] The present invention determines a deviation threshold according to the second median, realizing the measurement of the normal fluctuation of IoT data. According to the comparison result of the deviation of IoT data and the deviation threshold, accurate identification of abnormal IoT data is realized, which is beneficial to improving the quality of the second IoT data set.

[0059] Based on the above embodiment, after uploading the first aggregated data to the blockchain system to complete the acquisition of the Internet of Things data, it also includes: when the user needs to calculate the first aggregated data stored in the blockchain system, based on the oracle contract of the blockchain system, the first aggregated data to be calculated is sent to the aggregator of the blockchain system, and the calculation result of the aggregator for the first aggregated data to be calculated is obtained; the calculation result is aggregated to obtain the second aggregated data, the second aggregated data is uploaded to the oracle contract, and the second aggregated data is sent to the user based on the oracle contract, the relay contract and the user contract.

[0060] like Figure 2 As shown in the figure, after completing the acquisition of IoT data, when the user needs to obtain the calculation result of the first aggregated data stored in the blockchain system, the user initiates a calculation request. The user contract accepts the calculation request and calls the relay contract according to the demand. The relay contract identifies the calculation request and calls the oracle contract to send the calculation request (calculation event) and the first aggregated data to be calculated to the off-chain cloud server of the blockchain system. The off-chain cloud server sends the calculation request and the first aggregated data to be calculated to the aggregator.

[0061] The aggregator calculates the first aggregated data to be calculated according to the calculation request and obtains the calculation result. The aggregator aggregates the calculation result to obtain the second aggregated data. The aggregator reports the second aggregated data to the oracle contract of the blockchain system. The oracle contract calls the relay contract and the user contract to report the second aggregated data to the user.

[0062] The present invention sends the calculation request and the first aggregated data to be calculated to the aggregator through the oracle contract, and obtains the second aggregated data, which is conducive to realizing complex calculations of on-chain data.

[0063] The present invention also provides a method for obtaining Internet of Things data. An energy management system A includes multiple energy production devices a (e.g., solar photovoltaic panels, wind turbines, etc.) and energy consumption devices b (e.g., household appliances). Users need to obtain energy production data and energy consumption data in real time for energy management and optimization. There are multiple initial oracle nodes {01, 02, 03, ..., 0n}, one of which is a solar photovoltaic panel device 0i, and the other is a household appliance smart socket 0j. The method for obtaining Internet of Things data includes the following steps.

[0064] (1) Create smart contracts for the blockchain system, including user contracts, relay contracts, and oracle contracts.

[0065] (2) Initial oracle node registration: Solar photovoltaic panel device 0i and household appliance smart socket 0j have data acquisition capabilities and credibility. 0i and 0j join the oracle network through registration requests and provide the identity information and public key of the initial oracle node.

[0066] (3) Define data request interface: Define two data request interfaces in the smart contract: obtain the power data generated by device a and obtain the power data consumed by device b. These two data request interfaces can receive data requests initiated by users.

[0067] (4) When the user wants to obtain the power data generated by device a, the user initiates an off-chain data request. The user contract receives the request and calls the relay contract. The relay contract determines that this is a data request (data collection task) and then calls the oracle contract.

[0068] (5) The oracle contract uses a polynomial time heuristic algorithm to select N oracle nodes as trusted nodes to execute data requests (data collection tasks).

[0069] (6) The oracle node (for example, 0i) obtains real-time power data (IoT data) from device a. The obtained power data is verified and processed by the oracle node, and then submitted to the aggregator.

[0070] (7) After receiving the power data, the aggregator uses the median absolute deviation method to eliminate noise data and abnormal data, and performs data aggregation to ensure the integrity and credibility of the power data.

[0071] (8) Data return to the chain: The aggregated power data is stored on the blockchain, and the oracle contract calls back the user contract to pass the acquired power data to the user. The user performs the next step of energy management and optimization based on this power data. For example, the user can adjust the usage plan of household appliances based on the power data generated by device A to maximize the use of their own energy.

[0072] The method for acquiring IoT data provided by the embodiment of the present invention, combined with the polynomial time heuristic algorithm, proposes a safe and reliable efficient oracle node selection algorithm, solves the problem of uneven node quality in heterogeneous IoT, and improves the credibility of IoT data. In view of the outlier and noise problems existing in IoT data, the present invention designs the absolute value deviation of the median as a measure of the degree of data dispersion, improves data quality, and is more robust and stable than other statistical methods such as standard deviation.

[0073] The device for acquiring Internet of Things data provided by the present invention is described below. The device for acquiring Internet of Things data described below and the method for acquiring Internet of Things data described above can be referenced to each other.

[0074] As Figure 3 shown, a device for obtaining Internet of Things (IoT) data includes: an allocation module 301, configured to, when identifying a data collection task for IoT devices outside the collection blockchain system, allocate at least one oracle node for the data collection task according to a polynomial-time heuristic algorithm.

[0075] An aggregator 302, configured to collect IoT data of IoT devices based on all oracle nodes to obtain a first IoT data set, and eliminate abnormal IoT data in the first IoT data set based on the deviation of the IoT data to obtain a second IoT data set.

[0076] The aggregator 302 is further configured to aggregate the second IoT data set to obtain a first aggregated data, and upload the first aggregated data to the blockchain system to complete the acquisition of IoT data.

[0077] The device for obtaining IoT data provided by the embodiment of the present invention realizes the allocation of high-quality oracle nodes for data collection tasks within an acceptable time through a polynomial-time heuristic algorithm, avoiding the mismatch between oracle nodes and data collection tasks, resulting in uneven quality of reported IoT data, and improving the credibility of IoT data reported to the blockchain. According to the deviation of the IoT data, abnormal IoT data in the first IoT data set is eliminated, removing abnormal data and noise data in the first IoT data set, and improving the quality of IoT data reported to the blockchain.

[0078] In one embodiment, the blockchain system includes a plurality of initial oracle nodes, and the allocation module 301 is configured to: calculate the inherent cost, time cost, and quality cost for the initial oracle nodes to complete the data collection task based on the polynomial-time heuristic algorithm; determine the total cost for the initial oracle nodes to complete the data collection task based on the inherent cost, time cost, and quality cost; and when the total cost is higher than a preset total cost, allocate the initial oracle nodes to the data collection task to obtain the oracle nodes for the data collection task.

[0079] In one embodiment, the aggregator 302 is further configured to: obtain the median of all IoT data in the first IoT data set to obtain a first median; and calculate the absolute value of the difference between each IoT data and the first median to obtain the deviation of the IoT data.

[0080] In one embodiment, the aggregator 302 is further configured to: obtain the median of the deviations of all Internet of Things data to obtain a second median; determine a deviation threshold based on the second median; compare the deviation of the Internet of Things data with the deviation threshold, and when the deviation of the Internet of Things data is greater than or equal to the deviation threshold, determine the Internet of Things data as abnormal Internet of Things data; in the first Internet of Things data set, remove all abnormal Internet of Things data to obtain a second Internet of Things data set.

[0081] In one embodiment, the allocation module 301 is further configured to: receive an off-chain data request sent by a user based on the user contract of the blockchain system; identify the off-chain data request as a data collection task based on the relay contract of the blockchain system.

[0082] In one embodiment, the allocation module 301 is further configured to: when a user needs to calculate the first aggregated data stored in the blockchain system, send the first aggregated data to be calculated to the aggregator of the blockchain system based on the oracle contract of the blockchain system. The aggregator 302 is further configured to: obtain the calculation result of the aggregator for the first aggregated data to be calculated; aggregate the calculation results to obtain second aggregated data, and upload the second aggregated data to the oracle contract. The allocation module 301 is further configured to: send the second aggregated data to the user based on the oracle contract, the relay contract, and the user contract.

[0083] Figure 4 An entity structure diagram of an electronic device is exemplified, as Figure 4 shown, the electronic device may include: a processor 410, a communication interface 420, a memory 430, and a communication bus 440. Among them, the processor 410, the communication interface 420, and the memory 430 communicate with each other through the communication bus 440. The processor 410 can call the logical instructions in the memory 430 to execute the method for obtaining Internet of Things data, and the method includes: when identifying a data collection task for collecting data of Internet of Things devices outside the blockchain system, allocate at least one oracle node for the data collection task according to the polynomial time heuristic algorithm; collect the Internet of Things data of the Internet of Things devices based on all oracle nodes to obtain a first Internet of Things data set, and remove the abnormal Internet of Things data in the first Internet of Things data set based on the deviation of the Internet of Things data to obtain a second Internet of Things data set; aggregate the second Internet of Things data set to obtain first aggregated data, and upload the first aggregated data to the blockchain system to complete the acquisition of Internet of Things data.

[0084] In addition, when the logical instructions in the above-mentioned memory 430 can be implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical discs.

[0085] On the other hand, the present invention also provides a computer program product. The computer program product includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the method for obtaining Internet of Things data provided by the above-mentioned various methods. The method includes: when identifying a data collection task for an Internet of Things device outside the blockchain system, allocating at least one oracle node to the data collection task according to a polynomial-time heuristic algorithm; collecting the Internet of Things data of the Internet of Things device based on all oracle nodes to obtain a first Internet of Things data set, and based on the deviation of the Internet of Things data, removing the abnormal Internet of Things data in the first Internet of Things data set to obtain a second Internet of Things data set; aggregating the second Internet of Things data set to obtain a first aggregated data, and uploading the first aggregated data to the blockchain system to complete the acquisition of the Internet of Things data.

[0086] On another aspect, the present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements the method for obtaining Internet of Things data provided by the above-mentioned various methods. The method includes: when identifying a data collection task for an Internet of Things device outside the blockchain system, allocating at least one oracle node to the data collection task according to a polynomial-time heuristic algorithm; collecting the Internet of Things data of the Internet of Things device based on all oracle nodes to obtain a first Internet of Things data set, and based on the deviation of the Internet of Things data, removing the abnormal Internet of Things data in the first Internet of Things data set to obtain a second Internet of Things data set; aggregating the second Internet of Things data set to obtain a first aggregated data, and uploading the first aggregated data to the blockchain system to complete the acquisition of the Internet of Things data.

[0087] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art can understand and implement it without creative efforts.

[0088] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on such an understanding, the essence of the above technical solution, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0089] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for obtaining Internet of Things data, characterized in that, Including: When a data collection task of an Internet of Things (IoT) device outside the collection blockchain system is recognized, at least one oracle node is assigned to the data collection task according to a polynomial-time heuristic algorithm; Based on all the oracle nodes, the IoT data of the IoT device is collected to obtain a first IoT data set. Based on the deviation of the IoT data, the abnormal IoT data in the first IoT data set is removed to obtain a second IoT data set; The second IoT data set is aggregated to obtain a first aggregated data, and the first aggregated data is uploaded to the blockchain system to complete the acquisition of IoT data.

2. The method for obtaining Internet of Things data according to claim 1, wherein The blockchain system includes multiple initial oracle nodes. The step of assigning at least one oracle node to the data collection task according to the polynomial-time heuristic algorithm includes: Based on the polynomial-time heuristic algorithm, calculate the inherent cost, time cost, and quality cost of the initial oracle node to complete the data collection task; based on the inherent cost, the time cost, and the quality cost, determine the total cost of the initial oracle node to complete the data collection task; when the total cost is higher than the preset total cost, assign the initial oracle node to the data collection task to obtain the oracle node of the data collection task.

3. The method for obtaining Internet of Things data according to claim 1, wherein The deviation of the IoT data is determined based on the following steps: In the first IoT data set, obtain the median of all IoT data to obtain a first median; Calculate the absolute value of the difference between each IoT data and the first median to obtain the deviation of the IoT data.

4. The method for obtaining Internet of Things data according to claim 1, wherein The step of removing the abnormal IoT data in the first IoT data set based on the deviation of the IoT data to obtain a second IoT data set includes: Obtain the median of the deviations of all the IoT data to obtain a second median; Based on the second median, determine a deviation threshold; Compare the deviation of the IoT data with the deviation threshold. When the deviation of the IoT data is greater than or equal to the deviation threshold, determine that the IoT data is the abnormal IoT data; In the first IoT data set, remove all the abnormal IoT data to obtain the second IoT data set.

5. The method for obtaining Internet of Things data according to claim 1, wherein The data collection task is determined based on the following steps: Based on the user contract of the blockchain system, receive the off-chain data request sent by the user; Based on the relay contract of the blockchain system, identify the off-chain data request as the data collection task.

6. The method for obtaining Internet of Things data according to claim 1, wherein, After uploading the first aggregated data to the blockchain system to complete the acquisition of IoT data, it further includes: When the user needs to calculate the first aggregated data stored in the blockchain system, based on the oracle contract of the blockchain system, send the first aggregated data to be calculated to the aggregator of the blockchain system; Obtain the calculation result of the aggregator for the first aggregated data to be calculated; aggregate the calculation result to obtain second aggregated data, upload the second aggregated data to the oracle contract, and based on the oracle contract, relay contract and user contract, send the second aggregated data to the user.

7. An acquisition device for Internet of Things data, characterized in that, Including: An allocation module, configured to, when identifying a data collection task for an Internet of Things device outside the blockchain system, allocate at least one oracle node to the data collection task according to a polynomial-time heuristic algorithm; An aggregator, configured to collect the Internet of Things data of the Internet of Things device based on all the oracle nodes to obtain a first Internet of Things data set, and eliminate abnormal Internet of Things data in the first Internet of Things data set based on the deviation of the Internet of Things data to obtain a second Internet of Things data set; The aggregator is further configured to aggregate the second Internet of Things data set to obtain first aggregated data, and upload the first aggregated data to the blockchain system to complete the acquisition of Internet of Things data.

8. An electronic device, comprising a memory, a processor, and a computer program stored on the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the method for acquiring Internet of Things data according to any one of claims 1 to 6.

9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method for acquiring Internet of Things data according to any one of claims 1 to 6.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the method for acquiring Internet of Things data according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Blockchain data uploading method and device based on threshold signature and oracle machine

    CN112507360A

  • Data processing method, system architecture, equipment and storage medium

    CN117591604A

  • Power reserve market privacy protection transaction method for virtual power plant

    CN119150362A

  • Systems and methods for facilitating detection of a security event associated with an IoT device

    US20210144158A1