A decentralized oracle service system and method for real-time perception data
By combining the DPS-BFT consensus protocol and the composite truth discovery algorithm, the accuracy and real-time issues of oracle service systems in the Internet of Things are solved, enabling real-time and accurate inference of sensor data, resisting Byzantine attacks, and ensuring the stability and availability of the system.
Patent Information
- Application Number
- CN202411507287.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-28
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2044-10-28
AI Technical Summary
Existing oracle service systems cannot simultaneously meet the requirements of accuracy and real-time performance in IoT scenarios, and they also suffer from Byzantine node manipulation and activity issues, which affect the execution results of smart contracts and system availability.
It adopts a decentralized oracle service approach for real-time sensing data, updates the network state and leader node through the DPS-BFT consensus protocol, and processes sensor data with a composite truth discovery algorithm to ensure the accuracy and real-time nature of the data, while allowing service nodes to freely join or leave the network.
It enables real-time and accurate truth inference of IoT sensor data, resists dynamic manipulation by Byzantine adversaries, solves the liveness problem, and ensures the scalability and stability of the system.
Smart Images

Figure CN119402500B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to the field of blockchain technology, and in particular to a decentralized oracle service method for real-time perception data, an electronic device and a readable storage medium. BACKGROUND
[0002] The Internet of Things is expanding its application field by interconnecting physical devices with sensors through a network to achieve seamless communication and data exchange. These sensors come from smart home appliances, industrial machines, and wearable devices. However, the rapid landing and widespread deployment of the Internet of Things have gradually raised concerns about mutual trust between sensors, privacy leakage, and security vulnerabilities. To address these issues, smart contracts based on blockchain technology are used to reduce the risk of privacy intrusion and security vulnerabilities. This is because smart contracts can securely and automatically execute protocols between untrusted sensors, while having features such as code immutability, access control, and security auditing.
[0003] Seamless interaction between smart contracts and real-world sensors is very important for promoting the application of blockchain-based Internet of Things systems. For example, an agricultural insurance smart contract collects weather data from field sensors and automatically pays for crop losses caused by bad weather; a logistics smart contract uses Internet of Things trackers on goods to monitor their location, so that payment can be automatically made after successful delivery. Although smart contracts can provide many benefits for these applications, they cannot actively interact with real-world sensors.
[0004] To achieve this goal, an oracle service (i.e., a third-party service, also known as a data feed service) is used to provide real-world data to smart contracts. Existing research mainly adopts a decentralized service model to prevent single-point failures. In short, they use special on-chain contracts to aggregate data from multiple independent nodes (which jointly 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 incorrect data produced by malicious or faulty nodes), which is referred to as a Byzantine source, and it can cause defects in the execution results of smart contracts. At the same time, oracle service nodes may manipulate data from data sources, which are referred to as Byzantine nodes, which will compromise the consistent and deterministic results of smart contracts. Current research on oracle services mainly involves data authentication and data verification. The former transfers unaltered data from authenticated websites to smart contracts through Trusted Execution Environment, TLSNotary proof, or zero-knowledge proof; the latter extracts the most accurate data from potentially conflicting data sources through a voting mechanism or a truth discovery mechanism.
[0005] However, in the Internet of Things scenario, a large number of Internet of Things sensors with different qualities generate stream data with different qualities, and the data changes over time, and the existing true value discovery mechanism cannot meet the accuracy and real-time requirements at the same time. Secondly, the oracle service node may dynamically join or leave the network, and the existing static Byzantine Fault Tolerant (BFT) consensus may encounter liveness problems. The liveness problem refers to the fact that when part of the nodes join or leave the network, the entire network may temporarily stop or even fail to reach a consensus before reaching a new consensus due to dynamic adjustment of the nodes, thereby failing to guarantee the continuous availability of the oracle service system. SUMMARY
[0006] Therefore, 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, ensure that the DPS-BFT consensus protocol can resist the dynamic manipulation of the oracle service node and data source by the Byzantine adversary, and solve the liveness problem.
[0007] To achieve the above-mentioned purpose, the embodiments of the present application provide a decentralized oracle service method for real-time perception data, comprising: acquiring sensor perception data; judging whether the network state request of each node in the pre-constructed oracle service system model is timed out, if the network state request is timed out, updating the network state of each service node based on the network state 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 each node whose network state reaches a consensus, wherein each node includes a leader node and a service node; processing the sensor perception data in each node based on a composite true value discovery algorithm to obtain oracle true value reasoning data.
[0008] Optionally, the processing of the sensor perception data in each node based on the composite true value discovery algorithm to obtain oracle true value reasoning data comprises: aggregating the sensor perception data in each data source based on the leader node in the pre-constructed oracle service system model to obtain aggregated data; distributing the aggregated data to the service nodes in the oracle service system model; processing each aggregated data by a composite true value discovery algorithm running in each node to correspondingly obtain a perception data prediction true value and a data source weight prediction true value.
[0009] Optionally, the composite truth discovery algorithm running at each node processes each of the aggregated data to obtain a perception data predicted truth value and a data source weight predicted truth value, comprising: determining node data of each node based on the aggregated data; at a first time, 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 an expression of the first formula is:
[0010]
[0011] wherein, represents data generated by data source s about object o at time stamp t, represents a true estimate of object o at time stamp t, represents that data source s provides sensor data about 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 monotonic decreasing function, represents the weight of data source s evaluated by oracle service node u at time stamp t; and an expression of the second formula is:
[0012]
[0013] wherein, represents data generated by data source s about object o at time stamp t, represents the weight of data source s evaluated by oracle service node u at time stamp t, represents that data source s provides sensor data about object o (otherwise 0), represents a true estimate of object o at time stamp t. At a second time, processing the first weight based on a third formula to obtain a second weight, and processing the second weight and the first truth value based on the second formula to obtain a second truth value, wherein the second time is greater than the first time, and the second time is adjacent to the first time, and an expression of the third formula is:
[0014]
[0015] wherein, α represents a shape parameter (affecting the characteristics of the probability density function), β represents a scale parameter (affecting the scale of the distribution), and γ represents a proportion factor of error weight, represents the detection error of object o by data source s at time stamp t, and T represents the current time stamp, represents the weight of data source s evaluated by the current timestamp oracle service node u. It is judged whether the absolute difference between the first weight and the second weight of two adjacent time instants is less than a preset threshold value. If it is less than the preset threshold value, the second true value is taken as the perception data prediction true value, and the second weight is taken as the weight prediction true value of the data source. Otherwise, the second true value is taken as the node data, and the subsequent steps are continued to be executed until the absolute difference between the first weight and the second weight of two adjacent time instants is less than the preset threshold value, wherein the expression of the preset threshold value is:
[0016]
[0017] wherein, represents the absolute difference of the weight of data source s on adjacent time stamps, represents the number of elements of the data source set, and ε represents the threshold value of the unit error.
[0018] Optionally, the network state discovery algorithm based on the DPS-BFT consensus protocol updates the network state of each service node, including: broadcasting a network state request message in each node based on the network state discovery algorithm, wherein each node includes an active node and a newly joined node; receiving a network state response message replied by other nodes through each node, and judging the network state validity of other nodes based on a preset number of delivery request messages, wherein the network state response message includes a network state index, a network state and a node request list, the network state includes a set of the active node and the newly joined node, and the delivery request message is stored in the node request list; if the network state of other nodes is valid, it is judged whether the network state index of each to-be-updated node is equal to the network state index of other nodes; if it is equal to the network state index of other nodes, it is determined that the network state maintained by each to-be-updated node is expired, and the network state of each to-be-updated node is updated to the network state of other nodes; broadcasting the update message of each to-be-updated node to other nodes, wherein the update message includes the network state index and the node symbol of the to-be-updated node, and receiving the update reply message of other nodes, wherein the update reply message includes a request list, the request list includes the node request list, an inference request list and a delivery request list, and the delivery request message is stored in the delivery request list; based on the delivery request list, each service node reaching consensus on the network state is obtained.
[0019] Optionally, after judging whether the network state index of each of the to-be-updated nodes is equal to the network state index of other nodes, the decentralized oracle service method for real-time perception data further comprises: if the network state index of each of the to-be-updated nodes is equal to the network state index of other nodes, determining that the leader node is manipulated or offline, and selecting a new leader node in each of the nodes based on the reliable view change algorithm.
[0020] Optionally, the selecting a new leader node in 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 comprises the second view number, a first network state, a first network state index and the first request list; receiving a view switching request message of other nodes through the leader node, wherein the view switching request message comprises 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, broadcasting the view switching request message to other nodes through the leader node to obtain the latest view number and network state of other nodes; or if the first network state index is less than the second network sequence number, updating the first network state by using the second network state to obtain the latest view number and network state of other nodes; and determining a leader node reaching consensus based on the latest view number and network state of the nodes 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 further comprises: according to 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 to-be-delivered request message.
[0022] To achieve the above object, embodiments of the present application further provide a decentralized oracle service system for real-time perception data, comprising: a data acquisition module configured to acquire sensor perception data; a node consensus reaching module configured to judge whether a network state request of each node in a pre-constructed oracle service system model is timed out, and if the network state request is timed out, update a network state of each of the service nodes based on a network state discovery algorithm in a DPS-BFT consensus protocol, and update the leader node based on a reliable view change algorithm in the DPS-BFT consensus protocol to obtain each of the nodes reaching consensus in network state, wherein each of the nodes comprises a leader node and a service node; and a data reasoning module configured to process the sensor perception data in each of the nodes based on a composite truth value discovery algorithm to obtain oracle truth value reasoning data.
[0023] To achieve the above object, the embodiment of the present application further provides a terminal / electronic device / server, comprising: at least one processor; and a memory connected with the at least one processor in communication; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the real-time perception data-oriented decentralized oracle service method provided by any of the above embodiments.
[0024] To achieve the above object, the embodiment of the present application further provides a computer readable storage medium storing a computer program, wherein the computer program is executed by a processor to implement the real-time perception data-oriented decentralized oracle service method provided by any of the above embodiments.
[0025] The embodiment of the present application provides a real-time perception data-oriented decentralized oracle service method, an electronic device and a readable storage medium. The method comprises the following steps: obtaining sensor perception data; judging whether a network state request of each node in a pre-constructed oracle service system model is timed out; if the network state request is timed out, updating a network state of each service node based on a network state discovery algorithm in a DPS-BFT consensus protocol, and updating a leader node based on a reliable view change algorithm in the DPS-BFT consensus protocol to obtain each node in which the network state reaches a consensus, wherein the each node comprises the leader node and the service node; and processing the sensor perception data stored in each node in which the network state reaches the consensus based on a composite truth value discovery algorithm to obtain oracle truth reasoning data. The composite truth value discovery algorithm is used to realize real-time and accurate truth inference on Internet of Things sensor streaming data. The present application further designs a DPS-BFT consensus protocol, which allows service nodes to freely join or leave in a partial synchronous Byzantine network without affecting the overall performance of the network. BRIEF DESCRIPTION OF DRAWINGS
[0026] Figure 1 is a flowchart of the real-time perception data-oriented decentralized oracle service method provided in an embodiment of the present application;
[0027] Figure 2 is a principle diagram of the real-time perception data-oriented decentralized oracle service method provided in an embodiment of the present application;
[0028] Figure 3 is an activity problem schematic diagram of the real-time perception data-oriented decentralized oracle service method provided in an embodiment of the present application;
[0029] Figure 4 is a structure diagram of the real-time perception data-oriented decentralized oracle service system provided in an embodiment of the present application. Detailed Implementation
[0030] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the various embodiments of this application will be described in detail below with reference to the accompanying drawings. However, those skilled in the art will understand that many technical details have been provided in the various embodiments of this application to help readers better understand this application. However, the technical solutions claimed in this application can be implemented even without these technical details and various changes and modifications based on the following embodiments. The division of the various embodiments below is for the convenience of description and should not constitute any limitation on the specific implementation of this application. The various embodiments can be combined with and referenced by each other without contradiction.
[0031] This invention aims to extend decentralized oracle service systems to blockchain-based Internet of Things (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 data from sensors, identify the most accurate data through a truth discovery mechanism, reach a consensus on the final data, and transmit it to the smart contract, thereby ensuring the authenticity and validity of the input data for the automated execution program in the smart contract. To implement the oracle service system, this invention first develops a dynamic decentralized oracle service system model. Furthermore, to perform accurate real-time truth inference on streaming data from IoT sensors, this invention proposes a Composite TruthDiscovery Algorithm (CompositeTD). Finally, to allow service nodes to freely join or leave partially synchronous Byzantine networks without affecting network performance, this invention develops a Dynamic Partially Synchronous Byzantine Fault Tolerant (DPS-BFT) consensus protocol. This invention 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 dynamic manipulation of oracle service nodes and data sources by Byzantine adversaries, and solves the liveness problem.
[0032] Oracle service: As the core of the present application, the present application first takes the existing Chainlink product as an example to introduce the running process of the oracle service system. In Chainlink, smart contracts trigger data requests on the chain through specific events, which is usually achieved by calling Chainlink's contract. The contract contains a request to Chainlink, specifying the required data type and target data source. Chainlink has a decentralized oracle network, all available oracle service nodes are in this network, and a node is elected as the leader node from it. Oracle nodes access external APIs or data sources to obtain real-time data according to the request. For example, they may call the API of a financial market data provider. Oracle nodes usually obtain data from multiple independent data sources to reduce the risk of single point failure and improve accuracy, and after obtaining the data, they will perform preliminary verification to ensure the validity and accuracy of the data. The leader node is responsible for collecting data from multiple ordinary oracle service nodes, and uses weighted average or median, etc. to obtain the final result. Oracle service nodes submit the aggregated data back to the smart contract through the Chainlink contract. After the smart contract receives the data, it performs corresponding operations according to the predefined logic, such as updating the state, executing transactions or triggering events.
[0033] Truth discovery: Truth discovery belongs to the category of multi-source data aggregation, which aims to identify the most accurate data from multiple data sources that may exist conflicts by evaluating the reliability of the data source and the consistency of the data it provides. This is more accurate than simply using weighted average or median. In the timestamp, the oracle node collects perception data, which will use truth discovery to derive the truth of the detected object and the weight of the data source, that is, and, where the truth of the object is derived using the data source weight and sensor data at the timestamp, and the distance between the true estimate of the object and the object monitoring data provided by the source is a monotonically decreasing function.
[0034] Partial synchronous Byzantine fault tolerance consensus protocol: a consensus algorithm for distributed systems, the core goal is to ensure that when a certain proportion of nodes may fail or behave maliciously, consensus can still be reached. Practical Byzantine Fault Tolerance (PBFT) as a typical representative, usually assumes that there is a "partially synchronous" environment, that is, the message transmission of the network may be delayed, but within a reasonable time, all normal nodes can communicate with each other and eventually reach consensus. The PBFT workflow includes three main stages: first, the client sends the Request message to the leader node, and the leader node broadcasts the "Pre-Prepare" message to all nodes; second, all nodes broadcast the "Prepare" message after verifying the message, until at least one same message is received; finally, all nodes broadcast the "Commit" message, and after reaching the same confirmation, execute the request and update the state, which ensures that consensus can still be reached in the presence of faulty or malicious nodes.
[0035] The present application solves the above problems by providing a decentralized oracle service system for real-time perception data, which enables smart contracts to actively obtain data from Internet of Things sensors in a nearly real network environment. The present application first formulates a dynamic decentralized oracle service system model. The model defines a set of all oracle service nodes as . The oracle service node is referred to as a node. At any given timestamp, the network state is represented as , which is the set of active nodes in the network (it is a subset of ). 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, their knowledge of the current network state may be different.
[0036] The present application further defines the concept of network state:
[0037] Definition 1: If node u has updated the network state to but has not updated the network state to where c'>c, the current network state of node u is
[0038] Definition 2: The current network state 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 state to where c'>c.
[0039] In order to formulate a dynamic decentralized oracle service system model, the static partial synchronous Byzantine fault tolerant consensus is converted into a dynamic partial synchronous Byzantine fault tolerant consensus. It is assumed that the number of nodes joining or leaving the network is limited, there is an unknown upper limit of message delay, and the messages between nodes are eventually transmitted within a limited delay. The dynamic partial synchronous Byzantine fault tolerant consensus of the dynamic decentralized oracle service system model of the application 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 the set of active nodes within a period of time. Nodes are responsible for transmitting real-time streaming data from real-world sensors to smart contracts. Specifically, given a set of Internet of Things objects And a set of data sources Each data source s represents a physical device equipped with multiple sensors that can monitor multiple Internet of Things objects in real time. Indicates the source Data about object o generated at timestamp t. At any given timestamp, the object may be monitored by some sources (denoted as ). The nodes in reach consensus on the real situation of the object (such as temperature and humidity) at timestamp t in real time. The authenticity and integrity of the messages can be further guaranteed through TLS communication or other tools.
[0040] The decentralized oracle service method for real-time perception data proposed in the embodiment of the application can be applied to an electronic device, wherein the electronic device can be a terminal or a server. The server is taken as an example for description in the embodiment and each of the following embodiments. The implementation details of the decentralized oracle service method for real-time perception data proposed in the embodiment are described in detail below. The following content only provides implementation details for easy understanding, and is not necessary for implementing the scheme.
[0041] The specific process of the decentralized oracle service method for real-time perception data proposed in the embodiment can be as shown in Figure 1 The decentralized oracle service method can include:
[0042] S10, acquiring sensor perception data;
[0043] Each data source s represents a physical device equipped with multiple sensors that can monitor multiple Internet of Things objects. Each node u i can access different data sources (i.e. ) and acquire perception data wherein The data source s provides sensor data about the object o (0 otherwise). In other words, each data source s can provide sensor data about certain IoT objects in a stream format (continuous data stream generated and processed in real time) at a timestamp t.
[0044] S20, judging whether the network state request of each node in the pre-constructed oracle service system model is timed out, if the network state request is timed out, updating the network state of each service node based on the network state discovery algorithm in the DPS-BFT consensus protocol, and / or updating the leader node based on the reliable view change algorithm in the DPS-BFT consensus protocol, to obtain each node whose network state reaches consensus;
[0045] The oracle service system model is a dynamic decentralized oracle service system model (hereinafter referred to as the simplified form). The pre-constructed oracle service system model first checks whether the network state request of each node is timed out before being enabled. If not, it means that the network state of each node has been synchronized, in other words, the network state has reached consensus.
[0046] If the network state request of each node is timed out, the DPS-BFT consensus protocol needs to be started. Through this protocol, even if malicious nodes and data sources are mixed in, the scalability, stability and reliability of the oracle service system can be ensured.
[0047] It should be noted that in a decentralized system based on a Byzantine fault-tolerant consensus mechanism, when a node joins or leaves, the system usually needs to be reconfigured, which may cause the throughput to drop to 0; otherwise, the liveness problem may occur. As shown in Figure 3 , the present application first analyzes the potential liveness problem in the consensus protocol:
[0048] Liveness problem 1 (the network state maintained by the oracle service node may be inconsistent): in the network state of c = 1, node u4 requests to join the network, 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 still stays in the network state of c = 1.
[0049] Liveness problem 2 (view switching may fail): in c = 2, node u4 is about to become a new leader node (according to the rule, the node will switch to ). However, the network state of node u1 is still in c = 1 and does not realize that u4 has joined the network. In this case, u4 expects to receive messages to start a new view as a leader node, but u1 thinks it is the new leader node and does not send messages to u4. As a result, the view switching fails and the oracle service system cannot process any messages.
[0050] The present application designs a DPS-BFT consensus protocol, which forces the oracle service node to perform a network state discovery mechanism to update the network state. The leader node replaces the leader node by using a reliable view change mechanism. Through the protocol, the scalability, stability and reliability of the oracle service system can be ensured even if malicious nodes and data sources are mixed.
[0051] In the embodiments of the present application, step S20 can specifically include the following specific execution process, including:
[0052] S21, broadcast a network state request message in each node based on a network state discovery algorithm, wherein each node includes an active node and a newly joined node;
[0053] Specifically, each round of consensus is composed of a batch of requests, including truth reasoning requests and node requests. The node requests (join / leave requests) are processed after the truth reasoning requests. This mechanism requires each node to maintain an ordered request list (Request List, RList) containing delivered requests. Only when more than two-thirds of the nodes agree on the request, the request is considered to be delivered, that is, each delivered request is signed by nodes (the network state is ). The present application introduces a node request list (Node Request List, OList), which only contains node requests sorted by network state number c. Any node u i can prove its network state to other nodes through OList. Before updating the network state, 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 nodes join or leave, the number of Byzantine nodes in the current network is The quorum is still that is, the value is greater than 2 / 3, that is, even if nodes join or leave, more than two-thirds of the node requests are considered to be delivered. Until the network state is updated from c to c+1, the nodes in the Temporary Set are officially joined to the network. The network state discovery mechanism includes the following steps:
[0054] Exemplarily, if the node u i handles the request timeout, its network state may be expired. Because, for each request, u i needs to collect signatures to deliver the request, but some active nodes (in the view of u i ) may have left the network, resulting in no enough arbitrator nodes to reach consensus. Any node u iBroadcast <request_netstat, c> to get the current network state.
[0055] S22, receiving the network state response message replied by other nodes through each node, and judging the validity of the network state of other nodes based on a preset number of delivery request messages, wherein the network state response message comprises a network state index, a network state and a node request list, the network state comprises a set of active nodes and newly added nodes, and the delivery request message is stored in the node request list;
[0056] Exemplarily, the node u i After broadcasting the request, replies from the remaining nodes will be received Wherein, c' represents the network state of the corresponding node, netstat represents the network state response message, represents the network state of the remaining nodes, and OList' represents the node request list of the remaining nodes. The node u i Judges the validity of the network state based on a preset number of delivery request messages If valid, the is considered as the current newer network state. Based on a preset number of delivery request messages means that each delivered request in the delivery request message stored in OList' is signed by A number of nodes.
[0057] S23, if the network state of other nodes is valid, it is judged whether the network state index of each to-be-updated node is equal to the network state index of other nodes; if equal to the network state index of other nodes, it is determined that the network state maintained by each to-be-updated node is expired, and the network state of each to-be-updated node is updated to the network state of other nodes;
[0058] It should be noted that the to-be-updated node can be any one of all nodes in a certain network state, and the present application divides all nodes into to-be-updated nodes and other nodes for better explanation.
[0059] Wherein, the node u i Selects the latest network state number c', if c=c', it is determined that the network state maintained by each to-be-updated node is expired, and the network state of each to-be-updated node is updated to the network state of other nodes.
[0060] S24, broadcasting an update message through each to-be-updated node to other nodes, wherein the update message comprises a network state index and a node symbol of the to-be-updated node, and receiving an update reply message of other nodes, wherein the update reply message comprises a first request list, the first request list comprises a node request list, an inference request list and a delivery request list, and the delivery request list stores the delivery request message;
[0061] Exemplarily, u i A broadcast <update, c, s, i> is required, where s is a stable checkpoint, and a reply <update_reply, RList, j> is waited from other nodes, RList represents the first request list, and i and j represent the identification of the node sending the broadcast message and the identification of the node replying the broadcast message respectively.
[0062] S25, obtaining the network state of each service node based on the delivery request list to reach consensus.
[0063] Specifically, u i Based on the Message in the delivery request list, the consensus result from the timeout request to the latest request can be finally confirmed, so as to catch up with other nodes.
[0064] In the embodiment of the application, after step S23, the decentralized oracle service method for real-time perception data further comprises:
[0065] S26, if the network state 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 in each node based on a reliable view change algorithm.
[0066] In the present application, the oracle service method requires the leader node to be honest and keep the latest network state at all times, and when the leader node is manipulated or responds to timeout, a reliable view change algorithm can be used to change the leader node.
[0067] Specifically, step S26 can specifically include the following execution process:
[0068] S261, changing the first view number of the leader node to the second view number, and broadcasting a first view change request to 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 second request list;
[0069] Wherein, node u i Switching the view number from the first view number v to the second view number v+1, while broadcasting the view change request
[0070] S262. Receive view switching request messages from other nodes through the leader node, wherein 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 number, broadcast the view switching request message to other nodes through the leader node to obtain the latest view number and network state of other nodes; or if the first network state index is less than the second network number, update the first network state using the second network state to obtain the latest view number and network state of 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 If the network status is up-to-date, then the data from node u needs to be sent. j View switching request Broadcast to The node in. Otherwise, it means node u j The network status is up-to-date, node u i Update the network status and rebroadcast the view switch request to the active nodes.
[0072] S263. Based on the latest view number of the node after the modulo operation and the network status, determine the leader node that has reached a consensus.
[0073] Specifically, He was elected as the new leadership node.
[0074] In an embodiment of the present invention, prior to step S261, the decentralized oracle service method for real-time sensing data further includes:
[0075] S260. Based on the number of view switching request messages received by the new leader node, the new leader node broadcasts the start view change message to other nodes and obtains the delivery request message.
[0076] For example, when a new leader node receives When a view switching request is made, he broadcasts...<new_view,v,c,VC> To launch a new view, where VC represents view change messages from other nodes and represents pending requests.
[0077] S30. Based on the composite truth discovery algorithm, sensor perception data stored in each node that has reached a consensus on the network state is processed to obtain oracle truth inference data.
[0078] It should be noted that the present application explores the advantages of iteration and increment-based true value discovery to develop a composite true value discovery algorithm (Composite Truth Discovery Algorithm, Composite TD) to accurately and timely infer the true value of the Internet of Things object. In addition, unlike existing true value discovery research, the present application considers the scenario where a strong adversary randomly manipulates part of the predictor service node and data source.
[0079] (a) Iteration-based true value discovery algorithm:
[0080] Each predictor service node will alternately estimate the true value of the Internet of Things object and the weight of the data source until convergence. The workflow of iterative true value discovery is as follows. At time stamp t, each node u receives sensor data from accessible data sources Receive sensor data and sends it to the leader node, which aggregates the sensor data and distributes the aggregated sensor data through the DPS-BFT protocol The consistency and liveness features of the DPS-BFT protocol ensure that all nodes eventually obtain sensor data of the Internet of Things object from all data sources at time stamp t, i.e. The principle of true value discovery is to give higher weight to data sources that often provide reliable data. The true value of the object is obtained by weighted aggregation of the weights of the fixed data sources, i.e. And the weight of the data source is obtained by weighted aggregation of the true value of the fixed object, i.e. Where d(·,·) can be instantiated as any distance function, and f(·) is a monotonic decreasing function, which means that The greater the distance between the true value estimate and the true value, the smaller the weight given to the data source s. Each predictor service node alternately estimates the object true value and the data source weight until convergence. However, it needs to alternately estimate the object true value and the data source weight at each time stamp until convergence, resulting in huge computation and delay.
[0081] (b) Increment-based true value discovery algorithm:
[0082] Unlike the iteration-based method, the increment-based true value discovery does not require iterative convergence, but uses prior knowledge of source weights and errors to build a probability model. By combining sensor data with existing knowledge, the true value of the object and the weight of the source are constantly updated. The detection error of data source s at time stamp t for object o is represented as satisfies the normal distribution In addition, the present application defines to represent the set of detection errors of data source s at time stamp t. This represents the detection error set of data source s from timestamp 1 to T. This invention proves that, given the truth values 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. Next, this invention sets... It satisfies the gamma distribution, that is Where α is the shape parameter and β is the scale parameter. The prior distribution of data source s at the latest timestamp T satisfies Finally, we can get Maximum a posteriori estimate: Therefore, the true value of an object at timestamp t+1 can be inferred from the maximum a posteriori estimate of the source weights of the previous timestamp, without iterative computation. Incremental methods are efficient but inaccurate because they struggle to adapt to changes in the distribution of object truth values or data sources, and errors in the early stages propagate and accumulate, causing accuracy to gradually decline over time. Therefore, it may not meet the accuracy requirements of the Internet of Things (IoT).
[0083] In real-world scenarios, the weights of data sources tend to remain relatively stable over extended periods, allowing incremental truth discovery to obtain accurate object truth values in real time. However, when the weights of the data source fluctuate significantly, iterative truth discovery has proven to be more accurate than incremental truth discovery. Therefore, this invention further proposes CompositeTD to meet both accuracy and real-time requirements.
[0084] In an embodiment of the present invention, reference is made to... Figure 2 Step S30 may specifically include the following execution process:
[0085] S31. Aggregated data is obtained by aggregating sensor-sensed data from various data sources based on the leader node in the pre-built oracle service system model.
[0086] Since each node collects different sensor data, data aggregation is necessary. To improve efficiency, this invention considers aggregation centered on a leader node, where nodes send received data to the leader node, which is responsible for aggregation and processing the aggregated sensor data. The data is then distributed to other nodes. However, the quality of each data source may vary, with some even providing Byzantine data. Therefore, this invention allows nodes to independently execute the CompositeTD algorithm to distribute the data. Prior weights of the data source As input, the truth value of the IoT-detected object is derived. Weights of data sources
[0087] S32, distribute the aggregated data to the service nodes in the oracle service system model;
[0088] Exemplarily, each node will derive the result Broadcasting, while also receiving the broadcast content of the remaining nodes
[0089] S33, process each aggregated data by the composite truth discovery algorithm running on each node, to obtain the predicted truth value of the perception data and the predicted truth value of the weight 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
[0091] Specifically, step S33 can specifically include the following execution process:
[0092] S331, determine the node data of each node based on the aggregated data;
[0093] S332, at the first time, process the node data based on the first formula to obtain the first weight, and process the first weight and the node data based on the second formula to obtain the first true value, wherein the expression of the first formula is:
[0094]
[0095] wherein, represents the data generated by the data source s about the object o at the time stamp t, represents the true estimate of the object o at the time stamp t, represents 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 monotone decreasing function, represents the weight of the data source s evaluated by the oracle service node u at the time stamp t.
[0096] The expression of the second formula is:
[0097]
[0098] wherein, represents the data generated by the data source s about the object o at the time stamp t, represents the weight of the data source s evaluated by the oracle service node u at the time stamp t, represents that the data source s provides sensor data about the object o (otherwise 0), represents the true estimate of the object o at the time stamp t.
[0099] S333. At the second time point, the first weight is processed based on the third formula to obtain the second weight. The second weight and the first true value are then processed based on the second formula to obtain the second true value. The second time point is greater than the first time point, and the second time point is adjacent to the first time point. The expression of the third formula is:
[0100]
[0101] Where α 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 scaling factor of the error weights. This represents the detection error of data source s for object o at timestamp t, where T represents the current timestamp. This represents the weight of the data source s obtained 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 time points is less than a preset threshold. If it is less than the preset threshold, use the second true value as the predicted true value of the perceived data and use the second weight as the predicted true value of the data source weights. Otherwise, use the second true value as node data and continue executing subsequent steps until the absolute difference between the first weight and the second weight at two adjacent time points is less than the preset threshold. The expression for the preset threshold is:
[0103]
[0104] in, This represents the absolute difference in weight between adjacent timestamps of data source s. This represents the number of elements in the data source set, and ε represents the threshold for unit error.
[0105] For example, in order to implement CompositeTD, accurately assessing the fluctuations in data source weights is crucial. This invention defines the evolution of data source weights. It represents the absolute difference in data source weights between adjacent timestamps. Utilizing This is used to determine if the weight of the data source suddenly fluctuates significantly. This occurs when the timestamp t=1 or the data source weight evolution exceeds a threshold. CompositeTD executes alternately. and Continue until convergence is achieved to obtain accurate source weights. At the next timestamp, use the latest source weights to deduce the true nature of the object. And obtain the maximum a posteriori estimate of the data source weights.
[0106] Since the sensor data of most IoT objects usually evolves smoothly, the invention takes the history true values of the objects as virtual data sources with fixed weights to capture the smoothness
[0107] The CompositeTD can derive the weights of data sources as the prior distribution in the initial iteration, and then obtain the accurate object truth in continuous timestamps without iterative computation. Moreover, it can detect the fluctuation of source weights when a Byzantine attack occurs through the evolution of source weights, and then alternately derive the true values of objects and the weights of data sources until convergence to obtain accurate results. Therefore, the CompositeTD meets the accuracy and real-time requirements in the Internet of Things scenario.
[0108] On the basis of the above-mentioned embodiments, the application further provides a decentralized oracle service system for real-time perception data, referring to Figure 4 The oracle service system 100 can include a data acquisition module 101, a node consensus reaching module 102, and a data reasoning module 103, wherein the data acquisition module 101 is configured to acquire sensor perception data; the node consensus reaching module 102 is configured to determine whether the network state request of each node in the pre-constructed oracle service system model is timed out, and if the network state request is timed out, update the network state of each service node based on the network state discovery algorithm in the DPS-BFT consensus protocol, and update the leader node based on the reliable view change algorithm in the DPS-BFT consensus protocol, to obtain each node reaching consensus on the network state, wherein each node includes a leader node and a service node; and the data reasoning module 103 is configured to process the sensor perception data stored in each node reaching consensus on the network state based on the composite truth value discovery algorithm, to obtain oracle true value reasoning data.
[0109] It is not difficult to find that the present embodiment is a system embodiment corresponding to the above-mentioned method embodiment, and the present embodiment can be implemented in cooperation with the above-mentioned method embodiment. The related technical details and technical effects mentioned in the above-mentioned embodiments are still valid in the present embodiment. In order to reduce repetition, they will not be described here. Accordingly, the related technical details mentioned in the present embodiment can also be applied in the above-mentioned embodiments.
[0110] It is worth mentioning that each module involved in the present embodiment is a logical module. In actual application, a logical unit can be a physical unit, a part of a physical unit, or a combination of multiple physical units. In addition, in order to highlight the innovative part of the present application, units not closely related to solving the technical problems proposed in the present application are not introduced in the present embodiment, but this does not mean that there are no other units in the present embodiment.
[0111] On the basis of the above-mentioned embodiments, the application further provides an electronic device, comprising: at least one processor; and a memory connected with the at least one processor in communication; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method for a decentralized oracle service for real-time perception data provided by any of the preceding embodiments.
[0112] The memory and the processor are connected in a bus mode, and the bus can include any number of interconnected buses and bridges, and the bus connects various circuits of the one or more processors and the memory together. The bus can also connect various other circuits such as peripheral devices, voltage regulators, and power management circuits, and the like, which are well known in the art, and thus will not be further described herein. The bus interface provides an interface between the bus and the transceiver. The transceiver can be one element or multiple elements, such as multiple receivers and transmitters, which provide a unit for communicating with various other devices on a transmission medium. Data processed by the processor is transmitted on a wireless medium through the antenna, and further, the antenna also receives data and transmits the data to the processor.
[0113] The processor is responsible for managing the bus and general processing, and can also provide various functions, including timing, peripheral interface, voltage regulation, power management, and other control functions. The memory can be used to store data used by the processor in performing operations.
[0114] On the basis of the above-mentioned embodiments, the application further provides a computer-readable storage medium storing a computer program, which, when executed by a processor, can implement the method for a decentralized oracle service for real-time perception data provided by any of the preceding embodiments.
[0115] Those skilled in the art can understand that all or part of the steps of the methods in the above-mentioned embodiments can be completed by programs instructing relevant hardware, the programs are stored in a storage medium, and include a plurality of instructions for causing a device (which can be a single-chip microcomputer, a chip, or the like) or a processor to execute all or part of the steps of the methods of the embodiments of the application. The foregoing storage medium includes: a U disk, a mobile hard disk, a ROM (Read-Only Memory), a RAM (Random Access Memory), a magnetic disk or an optical disk, and various storage medium capable of storing program codes.
[0116] Those skilled in the art can understand that the above-mentioned embodiments are specific embodiments for implementing the application, and in actual applications, various changes can be made in form and details without departing from the spirit and scope of the application.
Claims
1. A method for a decentralized oracle service for real-time perception data, characterized in that, The method comprises: acquiring sensor perception data; determining whether a network state request of each node in a pre-constructed oracle service system model is timed out, wherein each node comprises a leader node and a service node, if the network state request is timed out, updating a network state of each service node based on a network state discovery algorithm in a DPS-BFT consensus protocol, and / or updating a leader node based on a reliable view change algorithm in the DPS-BFT consensus protocol, to obtain each node in which a network state consensus is reached; processing the sensor perception data in each node based on a composite truth discovery algorithm to obtain oracle truth reasoning data; the processing of the sensor perception data in each node based on the composite truth discovery algorithm to obtain the oracle truth reasoning data comprises: aggregating sensor perception data in each data source based on the leader node in the pre-constructed oracle service system model to obtain aggregated data; distributing the aggregated data to the service nodes in the oracle service system model; processing the aggregated data through a composite truth discovery algorithm running in each node, to correspondingly obtain a perception data prediction truth value and a data source weight prediction truth value; the processing of the aggregated data through the composite truth discovery algorithm running in each node to correspondingly obtain the perception data prediction truth value and the data source weight prediction truth value comprises: determining node data of each node based on the aggregated data; at a first time, processing each node data based on a first formula to obtain a first weight, and processing the first weight and the node data based on a second formula to obtain a first truth value, wherein an expression of the first formula is: in, Indicates data source timestamp The generated object Data, Representation Object timestamp A true estimate Indicates data source Provided information about the object Sensor data, The distance between the true estimate of the measured object and the monitoring data of the object provided by the data source. It is a monotonically decreasing function. Indicates oracle service node timestamp Data sources obtained from the evaluation The weights; an expression of the second formula is: wherein, represents a data source at a time stamp generated about an object , represents an oracle service node at a time stamp evaluating a weight of the resulting data source , represents a data source providing sensor data about an object , represents an object at a time stamp a true estimate of; at a second time, processing the first weight based on a third formula to obtain a second weight, and processing the second weight and the first truth value based on the second formula to obtain a second truth value, wherein the second time is greater than the first time, and the second time is adjacent to the first time, wherein an expression of the third formula is: wherein, denotes a shape parameter, denotes a scale parameter, denotes a proportionality factor for the error weight, denotes a data source at a timestamp to an object a detection error, denotes a current timestamp, denotes a current timestamp oracle service node evaluating the resulting data source weight; determining whether an absolute difference value of the first weight and the second weight at adjacent two times is less than a preset threshold value, if less than the preset threshold value, taking the second truth value as a perception data prediction truth value, and taking the second weight as a data source weight prediction truth value, otherwise, taking the second truth value as node data, and continuing to execute subsequent steps until the absolute difference value of the first weight and the second weight at adjacent two times is less than the preset threshold value, wherein an expression of the preset threshold value is: wherein, denotes a data source the absolute difference of the weights on adjacent timestamps, denotes the number of elements of the set of data sources, denotes a threshold value for a unit error. 2.The real-time perception data oriented decentralized oracle service method according to claim 1, characterized in that, the updating of the network state of each service node based on the network state discovery algorithm in the DPS-BFT consensus protocol comprises: broadcasting a network state request message in each node based on the network state discovery algorithm, wherein each node comprises an active node and a newly joined node; receiving, by each of the nodes, network state response messages returned by other nodes, and judging network state validity of the other nodes based on a preset number of delivery request messages, wherein the network state response message comprises a network state index, a network state, and a node request list, the network state comprises the set of active nodes and the set of newly added nodes, and the delivery request message is stored in the node request list; if the network state of the other nodes is valid, judging whether the network state index of each to-be-updated node is equal to the network state index of the other nodes; if the network state index of each to-be-updated node is equal to the network state index of the other nodes, determining that the network state maintained by each of the to-be-updated nodes is expired, and updating the network state of each of the to-be-updated nodes to the network state of the other nodes; broadcasting, by each of the to-be-updated nodes, an update message to the other nodes, wherein the update message carries the network state index and the node symbol of the to-be-updated node, and receiving an update reply message of the other nodes, wherein the update reply message carries a request list, and the request list carries the node request list, an inference request list, and a delivery request list, and the delivery request list stores the delivery request message; based on the delivery request list, obtaining each service node that reaches consensus on the network state.
3. The method of claim 2, wherein, After judging whether the network state index of each of the to-be-updated nodes is equal to the network state index of the other nodes, the real-time perception data-oriented decentralized oracle service method further comprises: if the network state index of each of the to-be-updated nodes is equal to the network state index of the other nodes, determining that the leader node is manipulated or offline, and selecting a new leader node in each of the nodes based on the reliable view change algorithm.
4. The method of claim 3, wherein, The selecting a new leader node in 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, by the leader node, a first view change request to the other nodes, wherein the first view change request carries the second view number, a first network state, a first network state index, and a first request list; receiving, by the leader node, a view switching request message of the other nodes, 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 state index is greater than the second network state index, broadcasting, by the leader node, the view switching request message to the other nodes, to obtain the latest view number and the network state of the other nodes; if the first network state index is less than the second network state index, updating the first network state by using the second network state, to obtain the latest view number and the network state of the other nodes; based on the latest view number and the network state of the nodes after the modulo operation, determining the leader node that reaches consensus.
5. The method of claim 4, wherein, Before changing the first view number of the leader node to the second view number, the real-time perception data-oriented decentralized oracle service method further comprises: According to the new leader node receives a preset number of view switching request messages, a view change start message is broadcasted to other nodes by the new leader node, and a delivery request message is obtained.
6. A decentralized oracle service system for real-time perception data, characterized in that, The real-time perception data-oriented decentralized oracle service method according to any one of claims 1-5, comprising: a data acquisition module configured to acquire sensor perception data; a node consensus achieving module configured to determine whether a network state request of each node in a pre-constructed oracle service system model is timed out, wherein the nodes include a leader node and service nodes, and if the network state request is timed out, updating a network state of each service node based on a network state discovery algorithm in a DPS-BFT consensus protocol, and updating the leader node based on a reliable view change algorithm in the DPS-BFT consensus protocol to obtain each node with a consensus network state; a data reasoning module configured to process the sensor perception data in each node based on a composite truth value discovery algorithm to obtain oracle truth value reasoning data.
7. An electronic device, comprising: comprising: at least one processor; and a memory connected to the at least one processor in communication; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the real-time perception data-oriented decentralized oracle service method according to any one of claims 1-5.
8. A computer readable storage medium storing a computer program, characterized in that, The computer program is executed by the processor to implement the real-time perception data-oriented decentralized oracle service method according to any one of claims 1-5.
Citation Information
Patent Citations
Byzantine fault-tolerant consensus method and system in supply chain traceability
CN116260826A