Decentralization oracle machine service system and method for real-time perception data
By adopting the DPS-BFT consensus protocol and composite truth value discovery algorithm in the Internet of Things scenario, the real-time and accuracy of sensor data processing in the Internet of Things scenario is solved, and the oracle service is ensured. System availability.
Patent Information
- Application Number
- CN202411507287.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-28
- Publication Date
- 2025-02-07
- Estimated Expiration
- 2044-10-28
AI Technical Summary
The prior art is difficult to meet sensor data processing that meets both real-time and accuracy requirements in the Internet of Things scenario, and oracle service nodes may dynamically join or leave the network, resulting in activity problems.
A decentralized oracle service method for real-time perceived data is proposed, using DPS-BFT consensus protocol and composite truth value discovery algorithm to obtain sensor-aware data, update the node network status, select a new leadership node, and process sensor data to Obtain accurate oracle truth reasoning data.
It realizes the provision of accurate and real-time sensor data to smart contracts, resists dynamic manipulation by Byzantine opponents, and solves the activity problem, ensuring the continuous availability of oracle service systems.
Smart Images

Figure CN119402500A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of blockchain technology, and in particular to a decentralized oracle service method, electronic device, and readable storage medium for real-time perception data. Background Art
[0002] The Internet of Things (IoT) is continuously expanding its application areas. It connects physical devices equipped with sensors through networks to enable seamless communication and data exchange. These sensors include smart home appliances, industrial machines, and wearable devices. However, the rapid implementation and widespread deployment of the IoT has also gradually raised concerns about inter-sensor trust, privacy leaks, and security vulnerabilities. To address these issues, blockchain-based smart contracts are being used to mitigate the risks of privacy intrusion and security vulnerabilities. This is because smart contracts can securely and automatically execute agreements between untrusted sensors, while also offering features such as code immutability, access control, and security auditing.
[0003] Seamless interaction between smart contracts and real-world sensors is crucial for the widespread adoption of blockchain-based IoT systems. For example, agricultural insurance smart contracts collect weather data from field sensors and automatically compensate for crop losses caused by severe weather. Logistics smart contracts use IoT trackers on goods to monitor their location and automatically issue payments upon successful delivery. While smart contracts offer many benefits for these applications, they lack the ability to actively interact with real-world sensors.
[0004] To achieve this goal, oracle services (i.e., third-party services, also known as data feeds) are used to provide real-world data to smart contracts. Existing research primarily adopts a decentralized service model to prevent single points of failure. In short, they use specialized on-chain contracts to aggregate data from multiple independent nodes (which collectively maintain the oracle service system) and then transmit the data to the target contract. However, data sources may provide low-quality data or even Byzantine data (i.e., unreliable or erroneous data generated by malicious or faulty nodes). Such data sources, known as Byzantine sources, can lead to flaws in smart contract execution results. Furthermore, oracle service nodes may manipulate data from data sources, known as Byzantine nodes, compromising the consistency and deterministic results of smart contracts. Current research on oracle services primarily focuses on data authentication and data verification. The former uses a Trusted Execution Environment (TEE), TLS Notary proofs, or zero-knowledge proofs to transmit unaltered data from authenticated websites to smart contracts. The latter uses voting mechanisms or truth discovery mechanisms to extract the most accurate data from potentially conflicting data sources.
[0005] However, in IoT scenarios, massive amounts of IoT sensors of varying quality generate streaming data of varying quality, which changes constantly over time. Existing truth-discovery mechanisms cannot simultaneously meet both accuracy and real-time requirements. Secondly, oracle service nodes may dynamically join or leave the network, and the existing static Byzantine Fault Tolerant (BFT) consensus may encounter liveness issues. Liveness issues occur when some nodes join or leave the network, causing the entire network to temporarily stall or even fail to reach a new consensus due to dynamic node adjustments before reaching a new consensus. This makes it impossible to guarantee the continued availability of the oracle service system. Summary of the Invention
[0006] In view of this, the embodiments of the present application propose a decentralized oracle service system and method for real-time perception data, aiming to provide accurate and real-time sensor data to smart contracts, ensuring that the DPS-BFT consensus protocol can resist the dynamic manipulation of oracle service nodes and data sources by Byzantine opponents, and solving the liveness problem.
[0007] To achieve the above-mentioned objectives, an embodiment of the present application provides a decentralized oracle service method for real-time perception data, including: obtaining sensor perception data; determining whether the network status request of each node in the pre-built oracle service system model has timed out; if the network status request has timed out, updating the network status of each of the service nodes based on the network status discovery algorithm in the DPS-BFT consensus protocol, and updating the leader node based on the reliable view change algorithm in the DPS-BFT consensus protocol to obtain the nodes that have reached a consensus on the network status, wherein each of the nodes includes a leader node and a service node; processing the sensor perception data in each of the nodes based on the composite truth value discovery algorithm to obtain oracle truth value inference data.
[0008] Optionally, the sensor perception data in each of the nodes is processed based on a composite truth value discovery algorithm to obtain oracle truth value inference data, including: aggregating the sensor perception data in each of the data sources based on the leader node in the pre-built oracle service system model to obtain aggregated data; distributing the aggregated data to the service nodes in the oracle service system model; processing each of the aggregated data through the composite truth value discovery algorithm run by each node to obtain the corresponding predicted truth value of the perception data and the weighted predicted truth value of the data source.
[0009] Optionally, the composite truth value discovery algorithm running on each node processes each of the aggregated data to obtain a corresponding perception data predicted truth value and a weighted predicted truth value of the data source, including: determining node data of each node based on the aggregated data; at a first moment, processing each of the node data based on a first formula to obtain a first weight, and processing the first weight and each of the node data based on a second formula to obtain a first truth value, wherein the expression of the first formula is:
[0010]
[0011] in, Represents the data about object o generated by data source s at timestamp t, represents the true estimate of object o at timestamp t, denotes that the data source s provides sensor data about the object o (otherwise 0), d(·,·) measures the distance between the true estimate of the object and the monitoring data of the object provided by the data source, and f(·) is a monotonically decreasing function, represents the weight of the data source s evaluated by the oracle service node u at timestamp t; the expression of the second formula is:
[0012]
[0013] in, Represents the data about object o generated by data source s at timestamp t, represents the weight of the data source s evaluated by the oracle service node u at timestamp t, indicates that the data source s provides sensor data about the object o (otherwise 0), represents the true estimate of object o at timestamp t. At the second moment, the first weight is processed based on the third formula to obtain a second weight, and the second weight and the first true value are processed based on the second formula to obtain a second true value, wherein the second moment is greater than the first moment and the second moment is adjacent to the first moment, and the expression of the third formula is:
[0014]
[0015] Among them, α represents the shape parameter (affecting the characteristics of the probability density function), β represents the scale parameter (affecting the scale of the distribution), and γ represents the proportional factor of the error weight. represents the detection error of data source s on object o at timestamp t, T represents the current timestamp, Represents the weight of the data source s evaluated by the current timestamp oracle service node u. Determine whether the absolute difference between the first weight and the second weight at two adjacent moments is less than a preset threshold. If so, use the second true value as the perception data predicted true value and the second weight as the data source weight predicted true value. Otherwise, use the second true value as the node data and continue to execute subsequent steps until the absolute difference between the first weight and the second weight at two adjacent moments is less than a preset threshold. The expression of the preset threshold is:
[0016]
[0017] in, represents the absolute difference in weights of data source s at adjacent timestamps, It represents the number of elements in the data source set, and ε represents the unit error threshold.
[0018] Optionally, the network status discovery algorithm in the DPS-BFT consensus protocol is used to update the network status of each of the service nodes, including: broadcasting a network status request message in each of the nodes based on the network status discovery algorithm, wherein each of the nodes includes an active node and a newly joined node; receiving a network status response message replied by other nodes through each of the nodes, and judging the validity of the network status of other nodes based on a preset number of delivery request messages, wherein the network status response message includes a network status index, a network status and a node request list, the network status includes a collection of the active nodes and the newly joined nodes, and the delivery request message is stored in the node request list; if the network status of other nodes is valid, judging the validity of each of the nodes to be updated Whether the network status index of the point is equal to the network status index of other nodes; if the network status index is equal to that of other nodes, it is determined that the network status maintained by each of the nodes to be updated is expired, and the network status of each of the nodes to be updated is updated to the network status of other nodes; the update message is broadcast to the other nodes through each of the nodes to be updated, wherein the update message includes the network status index and node symbol of the node to be updated, and update reply messages from other nodes are received, wherein the update reply message includes a request list, the request list includes the node request list, the inference request list and the delivery request list, and the delivery request message is stored in the delivery request list; based on the delivery request list, each of the service nodes that reaches a consensus on the network status is obtained.
[0019] Optionally, after determining whether the network status index of each of the nodes to be updated is equal to the network status index of other nodes, the decentralized oracle service method for real-time perception data also includes: if the network status index is equal to the network status index of other nodes, determining that the leader node is manipulated or offline, and selecting a new leader node from each of the nodes based on the reliable view change algorithm.
[0020] Optionally, selecting a new leader node from each of the nodes based on the reliable view change algorithm includes: changing the first view number of the leader node to a second view number, and broadcasting a first view change request to the other nodes through the leader node, wherein the first view change request includes the second view number, the first network state, the first network state index, and the first request list; receiving a view switch request message from the other nodes through the leader node, wherein the view switch request message includes the second network state index, the second network state, the second request list, and the third view number; if the first network state index is greater than the second network sequence number, broadcasting the view switch request message to the other nodes through the leader node to obtain the latest view number and network state of the other nodes; or if the first network state index is less than the second network sequence number, updating the first network state with the second network state to obtain the latest view number and network state of the other nodes; and determining the leader node that reaches consensus based on the latest view number and network state of the node after the modulo operation.
[0021] Optionally, before changing the first view number of the leader node to the second view number, the decentralized oracle service method for real-time perception data also includes: based on the new leader node receiving a preset number of view switching request messages, broadcasting a start view change message to other nodes through the new leader node to obtain a request message to be delivered.
[0022] To achieve the above-mentioned purpose, an embodiment of the present application also provides a decentralized oracle service system for real-time perception data, including: a data acquisition module for acquiring sensor perception data; a node consensus reaching module for determining whether the network status request of each node in the pre-built oracle service system model has timed out. If the network status request has timed out, the network status of each of the service nodes is updated based on the network status discovery algorithm in the DPS-BFT consensus protocol, and the leader node is updated based on the reliable view change algorithm in the DPS-BFT consensus protocol to obtain the nodes that have reached consensus on the network status, wherein each of the nodes includes a leader node and a service node; a data inference module for processing the sensor perception data in each of the nodes based on a composite truth value discovery algorithm to obtain oracle truth value inference data.
[0023] To achieve the above-mentioned objectives, an embodiment of the present application also provides a terminal / electronic device / server, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the decentralized oracle service method for real-time perception data provided in any of the above-mentioned embodiments.
[0024] To achieve the above-mentioned purpose, an embodiment of the present application also provides a computer-readable storage medium storing a computer program, characterized in that when the computer program is executed by a processor, it can implement the decentralized oracle service method for real-time perception data provided by any of the above-mentioned embodiments.
[0025] The embodiments of the present application propose a decentralized oracle service method, electronic device and readable storage medium for real-time perception data, which obtains sensor perception data; determines whether the network status request of each node in the pre-built oracle service system model has timed out. If the network status request has timed out, the network status of each service node is updated based on the network status discovery algorithm in the DPS-BFT consensus protocol, and the leader node is updated based on the reliable view change algorithm in the DPS-BFT consensus protocol to obtain each node that has reached a consensus on the network status, wherein each node includes a leader node and a service node; based on the composite truth value discovery algorithm, the sensor perception data stored in each node that has reached a consensus on the network status is processed to obtain oracle truth value inference data, and the composite truth value discovery algorithm is used to realize real-time and accurate truth value inference of IoT sensor streaming data. The present invention also designs a DPS-BFT consensus protocol to allow service nodes to freely join or leave in a partially synchronous Byzantine network without affecting the overall performance of the network. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 This is a flowchart of a decentralized oracle service method for real-time perception data provided in one embodiment of the present application;
[0027] Figure 2 This is a schematic diagram of a decentralized oracle service method for real-time perception data provided in one embodiment of the present application;
[0028] Figure 3 This is a schematic diagram of the liveness problem of a decentralized oracle service method for real-time perception data provided in one embodiment of the present application;
[0029] Figure 4 This is a structural diagram of a decentralized oracle service system for real-time perception data provided in one embodiment of the present application. DETAILED DESCRIPTION
[0030] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, each embodiment of the present application will be described in detail below with reference to the accompanying drawings. However, it will be understood by those skilled in the art that in each embodiment of the present application, many technical details are proposed to enable the reader to better understand the present application. However, even without these technical details and various changes and modifications based on the following embodiments, the technical solutions claimed in the present application can be implemented. The division of the following embodiments is for convenience of description and should not constitute any limitation on the specific implementation of the present application. The various embodiments can be combined and referenced with each other under the premise of no contradiction.
[0031] This invention aims to extend the application of decentralized oracle service systems to blockchain-based IoT systems, enabling smart contracts to proactively access accurate, real-time sensor data. Therefore, this invention designs a decentralized oracle service system for real-time sensor data. In short, multiple service nodes independently verify the authenticity of sensor data, identify the most accurate data through a truth discovery mechanism, reach consensus on the final data, and transmit it to the smart contract, thereby ensuring the authenticity and validity of the input data for the automatically executed program in the smart contract. To implement the oracle service system, this invention first develops a dynamic decentralized oracle service system model. Furthermore, to accurately infer the real-time truth of streaming data from IoT sensors, this invention proposes a Composite Truth Discovery Algorithm (CompositeTD). Finally, to allow service nodes to freely join or leave the partially synchronous Byzantine network without affecting network performance, this invention develops a Dynamic Partially Synchronous Byzantine Fault Tolerant (DPS-BFT) consensus protocol. This paper provides rigorous theoretical proof and experimental analysis to ensure that the CompositeTD algorithm meets the accuracy and real-time requirements in IoT scenarios, guarantees that the DPS-BFT consensus protocol can resist the dynamic manipulation of oracle service nodes and data sources by Byzantine adversaries, and solves the liveness problem.
[0032] Oracle Service: This paper, as the core of this paper, first uses the existing Chainlink product as an example to describe the operational process of the oracle service system. In Chainlink, smart contracts trigger data requests on-chain through specific events, typically by calling Chainlink contracts. The contract includes a request to Chainlink, specifying the desired data type and target data source. Chainlink maintains a decentralized oracle network comprised of all available oracle service nodes, from which a leader node is elected. Oracle nodes access external APIs or data sources to obtain real-time data based on requests. For example, they might call the APIs of financial market data providers. Oracle nodes typically obtain data from multiple independent data sources to reduce single points of failure and improve accuracy. After obtaining data, they perform preliminary validation to ensure data validity and accuracy. The leader node aggregates data from multiple regular oracle service nodes and uses methods such as weighted average or median to generate the final result. The oracle service node submits this aggregated data back to the smart contract via the Chainlink contract. After receiving data, the smart contract performs corresponding operations according to predefined logic, such as updating status, executing transactions, or triggering events.
[0033] Truth Discovery: Truth discovery falls under the umbrella of multi-source data aggregation. It aims to identify the most accurate data from multiple potentially conflicting data sources by assessing the reliability of the data sources and the consistency of the data they provide. This is more accurate than simple weighted averages or medians. At a timestamp, the oracle node collects the perception data and uses truth discovery to derive the true value of the detected object and the weight of the data source, i.e., and , where the truth of the object is derived using the data source weight and sensor data at the timestamp. The distance between the true estimate of the object and the object monitoring data provided by the source is a monotonically decreasing function.
[0034] Partially Synchronous Byzantine Fault-Tolerant Consensus: A consensus algorithm for distributed systems whose core goal is to ensure consensus is achieved even when a certain percentage of nodes may be faulty or malicious. Practical Byzantine Fault Tolerance (PBFT), a typical example, assumes a partially synchronous environment, where network message delivery may be delayed, but all functioning nodes are able to communicate with each other and ultimately reach consensus within a reasonable timeframe. The PBFT workflow consists of three main phases: First, the client sends a Request message to the leader node, which broadcasts a "Pre-Prepare" message to all nodes. Second, all nodes verify the message and broadcast "Prepare" messages until at least 100 nodes have received the same message. Finally, all nodes broadcast a "Commit" message. Once all nodes have reached consensus, the request is executed and the state is updated, ensuring consensus is achieved even in the presence of faulty or malicious nodes.
[0035] In order to solve the above problems, the present invention invented a decentralized oracle service system for real-time perception data, which enables smart contracts to actively obtain data from IoT sensors in an almost real network environment. The present invention first develops a dynamic decentralized oracle service system model. As the set of all oracle service nodes. Oracle service nodes are referred to as nodes. At any given timestamp, the network state is represented as That is, the set of active nodes in the network (which is The network state is indexed by c, and the initial state is c = 0. In a dynamic partially synchronous network, each node maintains its own network state and may not be able to synchronize with other nodes in time. Therefore, they have no idea about the current network state. The perception may be different.
[0036] The present invention further clarifies the concept of network status:
[0037] Definition 1: If node u has updated the network state to But the network status has not been updated to Where c′>c, then the current network state of node u is
[0038] Definition 2: The current network status of the system is If and only if there is a correct node that updates the network state to And no correct node updates the network status to Where c′>c.
[0039] In order to formulate a dynamic decentralized oracle service system model, the present invention converts the static partially synchronous Byzantine fault-tolerant consensus into a dynamic partially synchronous Byzantine fault-tolerant consensus. It is assumed that the number of nodes joining or leaving the network is finite, there is an unknown upper limit on message delay, and messages between nodes are eventually delivered within a finite delay. The dynamic partially synchronous Byzantine fault-tolerant consensus of the dynamic decentralized oracle service system model of the present invention has two key components: view and network state. The former represents a specific configuration in which a specific leader node is responsible for managing the consensus process, and the latter represents a set of active nodes over a period of time. The nodes are responsible for transmitting real-time streaming data from real-world sensors to smart contracts. Specifically, given a set of IoT objects and data source collections Each data source s represents a physical device equipped with multiple sensors that can monitor multiple IoT objects in real time. Representation Source Data about an object o generated at timestamp t. At any given timestamp, the object may be monitored by some sources (denoted as ). The nodes in the network reach a consensus on the real condition of the object (such as temperature and humidity) in real time at timestamp t. The authenticity and integrity of the message can be further guaranteed through TLS communication or other tools.
[0040] The embodiments of this application propose a decentralized oracle service method for real-time sensory data, which can be applied to electronic devices, where the electronic device can be a terminal or a server. This embodiment and the following embodiments are described using a server as an example. The implementation details of the decentralized oracle service method for real-time sensory data proposed in this embodiment are described in detail below. The following content is only provided for ease of understanding and is not required for the implementation of this solution.
[0041] The specific process of the decentralized oracle service method for real-time perception data proposed in this embodiment can be as follows: Figure 1 As shown, decentralized oracle service methods can include:
[0042] S10, obtaining sensor perception data;
[0043] Each data source s represents a physical device equipped with multiple sensors that can monitor multiple IoT objects in real time. i Can access different data sources (i.e. ) and obtain sensory data in Indicates that data source s provides sensor data about object o (otherwise 0). In other words, each data source s can provide sensor data about some IoT object at timestamp t in a streaming format (a continuous stream of data generated and processed in real time).
[0044] S20. Determine whether the network status request of each node in the pre-built oracle service system model has timed out. If the network status request has timed out, update the network status of each service node based on the network status discovery algorithm in the DPS-BFT consensus protocol, and / or update the leader node based on the reliable view change algorithm in the DPS-BFT consensus protocol, to obtain the nodes that have reached a consensus on the network status.
[0045] The oracle service system model is an abbreviation for the dynamic decentralized oracle service system model (the abbreviation will be used in the following content). The pre-built oracle service system model first checks whether the network status request of each node has timed out before being activated. If it has not timed out, it means that the current network status of each node is synchronized. In other words, the network status has reached a consensus.
[0046] If the network status request of each node times out, the DPS-BFT consensus protocol is activated. This protocol ensures the scalability, stability, and reliability of the oracle service system even if malicious nodes and data sources are mixed in.
[0047] It should be noted that in a decentralized system based on the Byzantine fault-tolerant consensus mechanism, when nodes join or leave, the system usually needs to be reconfigured, which may cause the throughput to drop to 0; otherwise, activity problems may occur. Figure 3 As shown, the present invention first analyzes the potential liveness issues in the consensus protocol:
[0048] Liveness issue 1 (the network state maintained by the oracle service node may be inconsistent): When the network state is c=1, node u4 requests to join the network, and then u2 and u3 update the network state from c=1 to c=2, but u1 does not update the network state in time and remains in the network state of c=1.
[0049] Activeness Problem 2 (View Switching May Fail): When c=2, node u4 will become the new leader node (according to the rule, the node will switch to ). However, node u1 is still in the network state c=1 and is unaware that u4 has joined the network. In this case, u4 expects to receive The message starts a new view as the leader node, but u1 believes it is the new leader node and does not send a message to u4. As a result, the view switch fails and the oracle service system cannot process any messages.
[0050] This paper designs a DPS-BFT consensus protocol that forces oracle service nodes to execute a network state discovery mechanism to update the network state. A reliable view change mechanism is used at the leader node to replace the leader node. This protocol ensures the scalability, stability, and reliability of the oracle service system, even with the infiltration of malicious nodes and data sources.
[0051] In an embodiment of the present invention, step S20 may specifically include the following specific execution process, including:
[0052] S21. Broadcasting a network status request message to each node based on a network status discovery algorithm, wherein each node includes an active node and a newly joined node;
[0053] Specifically, each round of consensus consists of a batch of requests (including truth-value reasoning requests and node requests), and node requests (join / leave requests) are processed after truth-value reasoning requests. This mechanism requires each node to maintain an ordered request list (Request List, RList), which contains delivered requests. Only when more than two-thirds of the nodes agree on the request is it considered delivered, that is, each delivered request is considered delivered. Node signatures (network status is The present invention introduces a node request list (OList), which only contains node requests sorted by network status number c. i Before updating the network status, the active nodes in the network use a temporary set (Temporary Set) to store the nodes that request to join. In other words, even if a node joins or leaves, the number of Byzantine nodes in the current network remains the same. The quorum remains Right now The value of is greater than 2 / 3, which means that even if nodes join or leave, more than two-thirds of node requests are still considered delivered. Nodes in the Temporary Set are not officially added to the network until the network status is updated from c to c+1. The network status discovery mechanism includes the following steps:
[0054] For example, if node u i If the processing request times out, its network state may have expired. Because, for each request, u i Need to collect Signature to pass the request, but some active nodes (in u i It seems that) may have left the network, resulting in insufficient arbitration nodes to reach consensus. Any node u iBroadcast (including newly joined nodes in the temporary concentration)<request_netstat,c> To get the current network status.
[0055] S22. Each node receives a network status response message replied by other nodes, and determines the validity of the network status of other nodes based on a preset number of delivery request messages, wherein the network status response message includes a network status index, a network status, and a node request list, the network status includes a set of active nodes and newly joined nodes, and the delivery request message is stored in the node request list;
[0056] For example, node u i After broadcasting the request, replies will be received from other nodes Among them, c' represents the network status of the corresponding node, netstat represents the network status response message, Indicates the network status of the remaining nodes, OList′ indicates the node request list of the remaining nodes. i Determine network status based on a preset number of delivery request messages If it is valid, The delivery request message based on the preset number means that each delivered request in the delivery request message stored in OList′ is considered as the latest network state. Number of node signatures.
[0057] S23. If the network status of the other nodes is valid, determine whether the network status index of each node to be updated is equal to the network status index of the other nodes; if the network status index of the other nodes is equal, determine that the network status maintained by each node to be updated is expired, and update the network status of each node to be updated to the network status of the other nodes;
[0058] It should be noted that the node to be updated can be any one of all nodes in a certain network state. In order to better illustrate the problem, this application divides all nodes into nodes to be updated and other nodes.
[0059] Among them, node u i The latest network status number c′ is selected. If c=c′, it is determined that the network status maintained by each node to be updated is expired, and the network status of each node to be updated is updated to the network status of other nodes.
[0060] S24. Broadcast an update message to other nodes through each node to be updated, wherein the update message includes the network status index and node symbol of the node to be updated, and receive update reply messages from other nodes, wherein the update reply message includes a first request list, the first request list includes a node request list, an inference request list, and a delivery request list, and the delivery request list stores the delivery request message;
[0061] For example, u i Need to broadcast<update,c,s,i> , where s is a stable checkpoint and waits for replies from other nodes<update_reply,RList,j> , RList represents the first request list, i and j represent the identifier of the node sending the broadcast message and the identifier of the node replying to the broadcast message respectively.
[0062] S25. Obtain the service nodes that have reached a consensus on the network status based on the delivery request list.
[0063] Specifically, u i Based on the delivery request list messages, and finally confirm the consensus result from the timed-out request to the latest request, thus catching up with other nodes.
[0064] In an embodiment of the present invention, after step S23, the decentralized oracle service method for real-time perception data further includes:
[0065] S26. If the network status index is equal to that of other nodes, it is determined that the leader node is manipulated or offline, and a new leader node is selected from each node based on a reliable view change algorithm.
[0066] In this application, the oracle service method requires the leader node to be honest and always keep the latest network status. When the leader node is manipulated or the response times out, a reliable view change algorithm can be used to change the leader node.
[0067] Specifically, step S26 may include the following execution process:
[0068] S261: Change the first view number of the leader node to the second view number, and broadcast a first view change request to other nodes through the leader node, where the first view change request includes the second view number, the first network state, the first network state index, and the second request list;
[0069] Among them, node u i Switch the view number from the first view number v to the second view number v+1, and broadcast the view change request at the same time
[0070] S262. Receive, through the leader node, a view switching request message from another node, where the view switching request message includes a second network state index, a second network state, a second request list, and a third view number. If the first network state index is greater than the second network sequence number, broadcast the view switching request message to the other nodes through the leader node to obtain the latest view number and network state of the other nodes. Alternatively, if the first network state index is less than the second network sequence number, update the first network state with the second network state to obtain the latest view number and network state of the other nodes.
[0071] For example, node u i Received from node u j View switching request If c>c′, it means that node u i The network status is the latest, you need to send j View switching request Broadcast to Otherwise, it means that the node u j The network status of node u is the latest. i Update the network status and rebroadcast the view switch request to active nodes.
[0072] S263. Determine the leader node that reaches consensus based on the latest view number and network status of the node after the modulo operation.
[0073] Specifically, Be elected as the new leader node.
[0074] In an embodiment of the present invention, before step S261, the decentralized oracle service method for real-time perception data further includes:
[0075] S260: According to the preset number of view switching request messages received by the new leader node, a view change start message is broadcast to other nodes through the new leader node to obtain a request message to be delivered.
[0076] For example, when the new leader node receives When a view switch request is made, it broadcasts<new_view,v,c,VC> To start a new view, VC represents a view change message from another node and represents a pending request.
[0077] S30. Process the sensor perception data stored in each node that reaches a consensus on the network status based on the composite truth value discovery algorithm to obtain the oracle truth value inference data.
[0078] It is important to note that this paper exploits the advantages of iterative and incremental truth discovery to develop a Composite Truth Discovery Algorithm (CompositeTD) for accurate, real-time truth inference of IoT objects. Furthermore, unlike existing truth discovery research, this paper considers scenarios where a powerful adversary can arbitrarily manipulate some oracle service nodes and data sources.
[0079] (a) Iterative truth discovery algorithm:
[0080] Each oracle service node will alternately estimate the IoT object's true value and the data source weight until convergence. The workflow of iterative truth value discovery is as follows. At timestamp t, each node u obtains the value from the accessible data source. Receiving sensor data and will Sent to the leader node, which aggregates the sensor data and distributes the aggregated sensor data through the DPS-BFT protocol The consistency and liveness characteristics of the DPS-BFT protocol ensure that all nodes eventually obtain the sensor data of IoT objects from all data sources at timestamp t, i.e. The principle of truth value discovery is to give higher weight to data sources that frequently provide reliable data. The true value of an object is obtained by weighted aggregation of the weights of fixed data sources, that is, The weight of the data source is obtained by weighted aggregation of the true value of the fixed object, that is, where d(·,·) can be instantiated as any distance function and f(·) is a monotonically decreasing function, which means and true value estimation The greater the distance between them, the smaller the weight assigned to the data source s. Each oracle service node alternates between estimating the object's true value and the data source's weight until convergence. However, it must alternate between estimating the object's true value and the data source's weight at each timestamp until convergence, resulting in significant computational overhead and latency.
[0081] (b) Incremental-based truth discovery algorithm:
[0082] Unlike iterative methods, incremental truth discovery does not require iterative convergence. Instead, it uses prior knowledge of source weights and errors to build a probabilistic model. By combining sensor data with existing knowledge, the true value of the object and the weight of the source are continuously updated. The detection error of the data source s for the object o at time stamp t is expressed as Satisfies normal distribution In addition, the present invention defines To represent the detection error set of data source s at timestamp t. It represents the detection error set of data source s from time stamp 1 to T. The present invention proves that: given the true value of each object (Timestamp 1~T) and probability distribution of error In this case, minimizing the detection error generated by all data sources is equivalent to The maximum likelihood estimation problem of . Next, the present invention sets satisfies the gamma distribution, that is Where α is the shape parameter and β is the scale parameter. The prior distribution of the data source s at the latest timestamp T satisfies Finally, we can get The maximum a posteriori estimate of : This shows that the true value of an object at timestamp t+1 can be inferred based on the maximum a posteriori estimate of the source weight at the previous timestamp, without requiring iterative computation. Incremental methods are efficient but inaccurate because they struggle to adapt to changes in the distribution of the object's true value or data source. Errors in earlier stages propagate and accumulate, causing accuracy to gradually decrease over time. Therefore, they may not meet the accuracy requirements of the IoT.
[0083] In real-world scenarios, data source weights tend to be relatively stable over long periods of time. Incremental truth discovery can accurately obtain object ground truths in real time. However, when data source weights fluctuate significantly, iterative truth discovery has been shown to be more accurate than incremental truth discovery. Therefore, this paper further proposes CompositeTD to meet both accuracy and real-time requirements.
[0084] In the embodiment of the present invention, reference Figure 2 , step S30 may specifically include the following execution process:
[0085] S31, based on the leader node in the pre-built oracle service system model, aggregating sensor perception data in each data source to obtain aggregated data;
[0086] Since the sensor data collected by each node is different, data aggregation is required. In order to improve efficiency, the present invention considers aggregation centered on the leader node, where the node sends the received data to the leader node, which is responsible for aggregating and sending the aggregated sensor data to the leader node. Distribute to other nodes. At the same time, the quality of each data source may be different, and some may even provide Byzantine data. Therefore, the present invention allows nodes to independently execute the CompositeTD algorithm to distribute data and the prior weights of the data sources As input, the true value of the IoT detection object is derived and the weight of the data source
[0087] S32. Distribute aggregated data to service nodes in the oracle service system model;
[0088] For example, each node will derive the result Broadcasting will also receive the broadcast content of other nodes
[0089] S33. Process each aggregated data through the composite truth value discovery algorithm run by each node, and obtain the corresponding perception data prediction truth value and the weighted prediction truth value of the data source.
[0090] Specifically, the true value of the object and the weight of the data source are detected by the composite truth discovery algorithm to reach a consensus, and finally the
[0091] Specifically, step S33 may include the following execution process:
[0092] S331. Determine node data of each node based on the aggregated data;
[0093] S332: At a first moment, the data of each node is processed based on a first formula to obtain a first weight, and the first weight and the data of each node are processed based on a second formula to obtain a first true value, wherein the expression of the first formula is:
[0094]
[0095] in, Represents the data about object o generated by data source s at timestamp t, represents the true estimate of object o at timestamp t, denotes that the data source s provides sensor data about the object o (otherwise 0), d(·) measures the distance between the true estimate of the object and the monitoring data of the object provided by the data source, and f(·) is a monotonically decreasing function, Represents the weight of the data source s evaluated by the oracle service node u at timestamp t.
[0096] The expression of the second formula is:
[0097]
[0098] in, Represents the data about object o generated by data source s at timestamp t, represents the weight of the data source s evaluated by the oracle service node u at timestamp t, indicates that the data source s provides sensor data about the object o (otherwise 0), represents the true estimate of object o at timestamp t.
[0099] S333. At a second moment, process the first weight based on the third formula to obtain a second weight, and process the second weight and the first truth value based on the second formula to obtain a second truth value, wherein the second moment is greater than the first moment and the second moment is adjacent to the first moment, and the expression of the third formula is:
[0100]
[0101] Among them, α represents the shape parameter (affecting the characteristics of the probability density function), β represents the scale parameter (affecting the scale of the distribution), and γ represents the proportional factor of the error weight. represents the detection error of data source s on object o at timestamp t, T represents the current timestamp, Represents the weight of the data source s evaluated by the current timestamp oracle service node u;
[0102] S334: Determine whether the absolute difference between the first weight and the second weight at two adjacent moments is less than a preset threshold. If so, use the second true value as the perception data predicted true value and the second weight as the weight predicted true value of the data source. Otherwise, use the second true value as the node data and continue to perform subsequent steps until the absolute difference between the first weight and the second weight at two adjacent moments is less than the preset threshold. The expression of the preset threshold is:
[0103]
[0104] in, represents the absolute difference in weights of data source s at adjacent timestamps, It represents the number of elements in the data source set, and ε represents the unit error threshold.
[0105] For example, in order to implement CompositeTD, it is crucial to accurately evaluate the fluctuation of data source weights. The present invention defines the evolution of data source weights as It represents the absolute difference in the weight of the data source at adjacent timestamps. To determine whether the weight of the data source fluctuates suddenly. When the timestamp t = 1 or the data source weight evolution exceeds the threshold CompositeTD alternate execution and Until convergence to obtain accurate source weights. At the next timestamp, the latest source weights are used to deduce the truth of the object And obtain the maximum a posteriori estimate of the data source weight
[0106] Since the sensor data of most IoT objects usually evolve smoothly, the present invention uses the historical true value of the object as a virtual data source with a fixed weight to capture the smoothness characteristics.
[0107] This paper theoretically demonstrates that CompositeTD can use an initial iterative approach to derive data source weights as a prior distribution, thereby obtaining accurate object truth at successive timestamps without requiring iterative computation. Furthermore, it can detect fluctuations in source weights during Byzantine attacks through source weight evolution, then alternately derive the object's true value and data source weights until convergence to obtain accurate results. Therefore, CompositeTD simultaneously meets the accuracy and real-time requirements of IoT scenarios.
[0108] Based on the above embodiments, this application also proposes a decentralized oracle service system for real-time perception data. Figure 4 The oracle service system 100 may include a data acquisition module 101, a node consensus module 102 and a data reasoning module 103, wherein the data acquisition module 101 is used to obtain sensor perception data; the node consensus module 102 is used to determine whether the network status request of each node in the pre-built oracle service system model has timed out. If the network status request has timed out, the network status of each service node is updated based on the network status discovery algorithm in the DPS-BFT consensus protocol, and the leader node is updated based on the reliable view change algorithm in the DPS-BFT consensus protocol to obtain the nodes that have reached a consensus on the network status, wherein each node includes a leader node and a service node; the data reasoning module 103 is used to process the sensor perception data stored in each node that has reached a consensus on the network status based on the composite truth value discovery algorithm to obtain oracle truth value reasoning data.
[0109] It is not difficult to find that this embodiment is a system embodiment corresponding to the above-mentioned method embodiment, and this embodiment can be implemented in conjunction with the above-mentioned method embodiment. The relevant technical details and technical effects mentioned in the above-mentioned embodiments are still valid in this embodiment, and to reduce repetition, they are not repeated here. Accordingly, the relevant technical details mentioned in this embodiment can also be applied to the above-mentioned embodiments.
[0110] It is worth mentioning that all modules involved in this embodiment are logical modules. In actual applications, a logical unit can be a physical unit, a part of a physical unit, or a combination of multiple physical units. In addition, to highlight the innovation of this application, this embodiment does not introduce units that are not closely related to solving the technical problems proposed by this application. However, this does not mean that other units do not exist in this embodiment.
[0111] Based on the above embodiments, the present application also proposes an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the decentralized oracle service method for real-time perception data provided by any of the aforementioned embodiments.
[0112] The memory and processor are connected using a bus, which can include any number of interconnected buses and bridges. The bus connects various circuits of one or more processors and memories. The bus can also connect various other circuits such as peripheral devices, voltage regulators, and power management circuits. These are all well known in the art and therefore will not be described further in this article. The bus interface provides an interface between the bus and the transceiver. The transceiver can be a single component or multiple components, such as multiple receivers and transmitters, providing a unit for communicating with various other devices on a transmission medium. Data processed by the processor is transmitted on a wireless medium via an antenna. Furthermore, the antenna also receives data and transmits it to the processor.
[0113] The processor is responsible for managing the bus and general processing, and can also provide various functions, including timing, peripheral interfaces, voltage regulation, power management, and other control functions. Memory can be used to store data used by the processor when performing operations.
[0114] Based on the above embodiments, the present application also proposes a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it can implement the decentralized oracle service method for real-time perception data provided by any of the above embodiments.
[0115] Those skilled in the art will understand that all or part of the steps in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a program, which is stored in a storage medium and includes a number of instructions for causing a device (which can be a single-chip microcomputer, chip, etc.) or a processor to execute all or part of the steps in the various embodiments of the present application. The aforementioned storage medium includes: a USB flash drive, a mobile hard disk, a ROM (Read-Only Memory), a RAM (Random Access Memory), a magnetic disk, or an optical disk, etc., various media that can store program code.
[0116] Those skilled in the art will appreciate that the above embodiments are specific embodiments for implementing the present application, and that in actual applications, various changes may be made thereto in form and detail without departing from the spirit and scope of the present application.
Claims
1. A decentralized oracle service method for real-time perception data, characterized in that: include: Acquire sensor perception data; Determine whether the network status request of each node in the pre-built oracle service system model has timed out, wherein each of the nodes includes a leader node and a service node. If the network status request times out, the network status of each of the service nodes is updated based on the network status discovery algorithm in the DPS-BFT consensus protocol, and / or the leader node is updated based on the reliable view change algorithm in the DPS-BFT consensus protocol, so as to obtain the nodes that have reached a consensus on the network status; The sensor perception data in each of the nodes is processed based on a composite truth value discovery algorithm to obtain oracle truth value inference data.
2. According to claim 1, a decentralized oracle service method for real-time perception data is characterized in that: The method of processing the sensor perception data in each of the nodes based on the composite truth value discovery algorithm to obtain oracle truth value reasoning data includes: Aggregating sensor perception data in each data source based on the leader node in the pre-built oracle service system model to obtain aggregated data; Distributing the aggregated data to service nodes in the oracle service system model; The aggregated data is processed by a composite truth value discovery algorithm run by each node to obtain the predicted truth value of the perception data and the weighted predicted truth value of the data source.
3. According to claim 2, a decentralized oracle service method for real-time perception data is characterized in that: The composite truth value discovery algorithm executed by each node processes the aggregated data to obtain the predicted truth value of the perception data and the weighted predicted truth value of the data source, including: Determine node data of each node based on the aggregated data; At a first moment, each node data is processed based on a first formula to obtain a first weight, and the first weight and the node data are processed based on a second formula to obtain a first true value, wherein the expression of the first formula is: in, represents the data about object o generated by data source s at timestamp t, represents the true estimate of object o at timestamp t, denotes that the data source s provides sensor data about the object o, d(·,·) measures the distance between the true estimate of the object and the monitoring data of the object provided by the data source, and f(·) is a monotonically decreasing function. Represents the weight of the data source s evaluated by the oracle service node u at timestamp t. The expression of the second formula is: in, represents the data about object o generated by data source s at timestamp t, represents the weight of the data source s evaluated by the oracle service node u at timestamp t, Indicates that data source s provides sensor data about object o, represents the true estimate of object o at timestamp t. At a second moment, the first weight is processed based on a third formula to obtain a second weight, and the second weight and the first truth value are processed based on the second formula to obtain a second truth value, wherein the second moment is greater than the first moment, and the second moment is adjacent to the first moment, wherein the expression of the third formula is: Among them, α represents the shape parameter, β represents the scale parameter, and γ represents the proportional factor of the error weight. represents the detection error of data source s on object o at timestamp t, T represents the current timestamp, Represents the weight of the data source s evaluated by the current timestamp oracle service node u. It is determined whether the absolute difference between the first weight and the second weight at two adjacent moments is less than a preset threshold. If it is less than the preset threshold, the second true value is used as the perception data prediction true value, and the second weight is used as the weight prediction true value of the data source. Otherwise, the second true value is used as the node data, and subsequent steps are continued until the absolute difference between the first weight and the second weight at two adjacent moments is less than the preset threshold, wherein the expression of the preset threshold is: in, represents the absolute difference in weights of data source s at adjacent timestamps, It represents the number of elements in the data source set, and ε represents the threshold of unit error.
4. According to claim 1, a decentralized oracle service method for real-time perception data is characterized in that: The network status discovery algorithm based on the DPS-BFT consensus protocol updates the network status of each of the service nodes, including: Broadcasting a network status request message in each node based on a network status discovery algorithm, wherein each of the nodes includes an active node and a newly joined node; Receiving, by each of the nodes, a network status response message replied by the other nodes, and judging the validity of the network status of the other nodes based on a preset number of delivery request messages, wherein the network status response message includes a network status index, a network status and a node request list, the network status includes a set of the active nodes and the newly joined nodes, and the delivery request message is stored in the node request list; If the network status of the other nodes is valid, determining whether the network status index of each node to be updated is equal to the network status index of the other nodes; If the network status index is equal to that of the other nodes, it is determined that the network status maintained by each of the nodes to be updated is expired, and the network status of each of the nodes to be updated is updated to the network status of the other nodes; Broadcasting the update message to other nodes through each node to be updated, wherein the update message carries the network status index and node symbol of the node to be updated, and receiving update reply messages from other nodes, wherein the update reply message carries a request list, the request list carries the node request list, the inference request list and the delivery request list, and the delivery request message is stored in the delivery request list; The service nodes that reach a consensus on the network status are obtained based on the delivery request list.
5. A decentralized oracle service method for real-time perception data according to claim 4, characterized in that: After determining whether the network status index of each of the nodes to be updated is equal to the network status index of other nodes, the decentralized oracle service method for real-time perception data further includes: If the network status index is equal to that of other nodes, it is determined that the leader node is manipulated or offline, and a new leader node is selected from each of the nodes based on the reliable view change algorithm.
6. A decentralized oracle service method for real-time perception data according to claim 5, characterized in that: The selecting a new leader node from each of the nodes based on the reliable view change algorithm comprises: Changing the first view number of the leader node to a second view number, and broadcasting a first view change request to other nodes through the leader node, wherein the first view change request carries the second view number, the first network state, the first network state index and the first request list; Receiving, through the leader node, a view switching request message from another node, wherein the view switching request message carries a second network state index, a second network state, a second request list, and a third view number; If the first network status index is greater than the second network sequence number, broadcasting the view switching request message to the other nodes through the leader node to obtain the latest view number and network status of the other nodes; If the first network state index is less than the second network sequence number, the first network state is updated using the second network state to obtain the latest view number and network state of the other nodes; Based on the latest view number and network status of the node after the modulo operation, the leader node that reaches consensus is determined.
7. According to claim 5, a decentralized oracle service method for real-time perception data is characterized in that: Before changing the first view number of the leader node to the second view number, the decentralized oracle service method for real-time perception data further includes: According to the new leader node receiving a preset number of view switching request messages, a view change start message is broadcasted to other nodes through the new leader node to obtain a request message to be delivered.
8. A decentralized oracle service system for real-time perception data, characterized in that: include: A data acquisition module is used to acquire sensor perception data; A node consensus reaching module is used to determine whether the network status request of each node in the pre-built oracle service system model has timed out, wherein each of the nodes includes a leader node and a service node. If the network status request has timed out, the network status of each of the service nodes is updated based on the network status discovery algorithm in the DPS-BFT consensus protocol, and the leader node is updated based on the reliable view change algorithm in the DPS-BFT consensus protocol, so as to obtain the nodes that have reached a consensus on the network status; The data inference module is used to process the sensor perception data in each of the nodes based on a composite truth value discovery algorithm to obtain oracle truth value inference data.
9. An electronic device, characterized in that: include: at least one processor; and, a memory communicatively coupled to the at least one processor; In which, the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute a decentralized oracle service method for real-time perception data as described in any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, it can implement a decentralized oracle service method for real-time perception data as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Improved single-node abnormity active recovery method based on PBFT algorithm
CN110460484A
Efficient crowd sensing data stream privacy protection truth value discovery method
CN112787809A
Blockchain-based consensus group main node determination method, device and system
CN113079139A
Safe and verifiable data truth value discovery method in mobile crowd sensing
CN114362917A
Block chain oracle machine network, data interaction method, equipment and medium
CN115314496A