Block chain data processing method and device, equipment and storage medium
By jointly obtaining and verifying off-chain data in the oracle network, the problem of low credibility of off-chain data in the blockchain network is solved, and the execution success rate of smart contracts and the security of blockchain are improved.
Patent Information
- Application Number
- CN202311417122.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-27
- Publication Date
- 2025-04-29
AI Technical Summary
The lack of supervision mechanisms in blockchain networks leads to low credibility of off-chain data, especially when smart contracts require off-chain data to be triggered execution.
By jointly obtaining and verifying off-chain data in the oracle network, the validity and credibility of the data are ensured, and the processed data is sent to the blockchain node to execute the smart contract.
It improves the credibility of off-chain data, reduces the risk of a single external device being maliciously attacked, and enhances the execution success rate of smart contracts and the security of blockchain.
Smart Images

Figure CN119903543A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to fields such as blockchain technology, and in particular to a blockchain data processing method, device, equipment and storage medium. Background Art
[0002] Usually, smart contracts on the blockchain have interactive needs for off-chain data. For example, smart contracts need to be triggered by off-chain data, and these off-chain data need to be read from off-chain devices to the blockchain first. However, the blockchain network is a closed-loop network, and the node devices corresponding to the blockchain cannot actively initiate network calls. As a result, the node devices corresponding to the blockchain cannot actively obtain off-chain data. At present, off-chain data is mainly obtained through external devices, but there is a lack of supervision mechanism in the process of obtaining off-chain data, resulting in low credibility of the obtained off-chain data. Summary of the invention
[0003] The embodiments of the present application provide a blockchain data processing method, apparatus, device and storage medium to improve the credibility of acquired off-chain data.
[0004] On the one hand, an embodiment of the present application provides a blockchain data processing method, including:
[0005] Obtain N pieces of oracle data about the oracle subject and attribute information corresponding to the N pieces of oracle data from the oracle contract on the first blockchain; the N pieces of oracle data are off-chain data obtained by at least two oracle nodes in the oracle network, and N is a positive integer greater than 1;
[0006] Verify the validity of the N pieces of prophecy data according to the attribute information respectively corresponding to the N pieces of prophecy data, and obtain a verification result;
[0007] When the verification result indicates that the N pieces of predicted data are valid, a processing algorithm matching the predicted subject is obtained from the oracle contract;
[0008] According to the above processing algorithm, the above N pieces of oracle data are processed to obtain processed oracle data, and the processed oracle data are sent to the node device corresponding to the second blockchain; the above node device is used to execute the smart contract on the above second blockchain according to the above processed oracle data.
[0009] An embodiment of the present application provides a blockchain data processing device, including:
[0010] A first acquisition module is used to obtain N pieces of prediction data about a prediction subject and attribute information corresponding to the N pieces of prediction data from the prediction contract on the first blockchain; the N pieces of prediction data are off-chain data obtained by at least two prediction nodes in the prediction network, and N is a positive integer greater than 1;
[0011] A verification module, used to verify the validity of the N pieces of prediction data according to the attribute information respectively corresponding to the N pieces of prediction data, and obtain a verification result;
[0012] A second acquisition module is used to acquire a processing algorithm matching the above-mentioned prediction subject from the above-mentioned oracle contract when the above-mentioned verification result indicates that the above-mentioned N prediction data are valid;
[0013] The processing module is used to process the N pieces of oracle data according to the processing algorithm to obtain processed oracle data, and send the processed oracle data to the node device corresponding to the second blockchain; the node device is used to execute the smart contract on the second blockchain according to the processed oracle data.
[0014] Optionally, the verification module includes a statistical unit, a first acquisition unit and a verification unit;
[0015] A statistical unit, used for counting K oracle nodes for providing the N pieces of oracle data according to the attribute information respectively corresponding to the N pieces of oracle data; K is a positive integer greater than 1;
[0016] The first acquisition unit is used to acquire the historical log data corresponding to the K oracle nodes respectively when K is greater than the threshold value of the number of oracle nodes;
[0017] The verification unit is used to verify the validity of the above-mentioned N prediction data according to the historical log data corresponding to the above-mentioned K oracle nodes respectively, and obtain a verification result.
[0018] Optionally, the verification unit verifies the validity of the N pieces of oracle data according to the historical log data corresponding to the K oracle nodes, and obtains a verification result, including:
[0019] According to the historical log data corresponding to the above K oracle nodes, the stability corresponding to the above K oracle nodes is determined;
[0020] Count the number of devices corresponding to the oracle nodes whose stability is greater than the stability threshold among the above K oracle nodes, as well as the total number of devices corresponding to the above K oracle nodes;
[0021] Based on the above number of devices and the above total number of devices, the validity of the above N predicted data is verified to obtain a verification result.
[0022] Optionally, the verification module verifies the validity of the N pieces of prediction data according to the attribute information respectively corresponding to the N pieces of prediction data, and obtains a verification result, including:
[0023] Determine the similarity between each two pieces of the N pieces of prediction data according to the attribute information respectively corresponding to the N pieces of prediction data;
[0024] According to the similarity between each two pieces of the N pieces of prediction data, the total similarity corresponding to the N pieces of prediction data is counted;
[0025] Based on the above total similarity, the validity of the above N predicted data is verified to obtain the verification result.
[0026] Optionally, the processing module includes a second acquisition unit, a determination unit, and a screening unit;
[0027] The second acquisition unit is used to acquire the generation time corresponding to the above N pieces of prediction data respectively;
[0028] A determination unit, used to determine the time interval between the generation time corresponding to each of the N pieces of prophecy data and the current time according to the processing algorithm;
[0029] The screening unit is used to screen out the prediction data whose time interval is less than the time interval threshold from the above-mentioned N prediction data, and process the screened prediction data to obtain the processed prediction data.
[0030] Optionally, the prediction data is about the real-time asset value of the item, and the screening unit processes the screened prediction data to obtain the processed prediction data, including:
[0031] The real-time asset values corresponding to the above-screened prediction data are averaged to obtain the average asset value;
[0032] The real-time asset value corresponding to the above-screened prediction data is subjected to difference processing with the above-screened average asset value to obtain the difference asset value corresponding to the above-screened prediction data;
[0033] The predicted data corresponding to the above-screened predicted data with the smallest difference asset value is determined as the processed predicted data.
[0034] Optionally, the processing module processes the N pieces of prediction data according to the processing algorithm to obtain the processed prediction data, including:
[0035] Obtain the time-limited submission of oracle data about the above oracle topic from the above oracle contract;
[0036] When the current time reaches the above-mentioned restricted submission time, the above-mentioned N pieces of prediction data are processed according to the above-mentioned processing algorithm to obtain processed prediction data.
[0037] Optionally, the processing module sends the processed prophecy data to a node device corresponding to the second blockchain, including:
[0038] Obtain the data volume corresponding to the predicted data after the above processing;
[0039] If the data volume is greater than the data volume threshold, the processed prophetic data is split to obtain L pieces of prophetic data; L is a positive integer greater than 1;
[0040] Perform a hash operation on the L pieces of prophecy data to obtain the hash values corresponding to the L pieces of prophecy data respectively;
[0041] According to the hash values corresponding to the above-mentioned L pieces of sub-oracle data, a first root hash value for verifying the processed oracle data is generated, and the above-mentioned L pieces of sub-oracle data and the above-mentioned first root hash value are sent to the above-mentioned node device in sequence; the above-mentioned node device is used to execute the smart contract on the above-mentioned second blockchain according to the above-mentioned merged oracle data when the merged oracle data is verified to be valid based on the above-mentioned first root hash value; the above-mentioned merged oracle data is obtained by merging the above-mentioned L pieces of sub-oracle data.
[0042] Optionally, the processing module generates a first root hash value for verifying the processed oracle data according to the hash values corresponding to the L pieces of sub-oracle data, including:
[0043] The L pieces of prophecy data are grouped to obtain P groups; P is a positive integer greater than 1;
[0044] Perform a hash operation again on the hash value corresponding to the sub-oracle data belonging to group i to obtain the hash value corresponding to the above group i; i is a positive integer less than or equal to P;
[0045] According to the hash values corresponding to the above P groups, a first root hash value is generated for verifying the processed prophecy data.
[0046] Optionally, the processing module sends the processed prophecy data to a node device corresponding to the second blockchain, including:
[0047] Performing a hash operation on the processed prophecy data to obtain a hash value of the processed prophecy data;
[0048] Generate a second root hash value for verifying the processed oracle data and the other oracle data according to the hash value of the processed oracle data and the hash value of other oracle data; the other oracle data is the oracle data in the oracle network to be transmitted to the node device;
[0049] The second root hash value, the other oracle data, and the processed oracle data are sent to the node device. The node device is also used to verify that the processed oracle data and the other oracle data are valid based on the second root hash value, and then execute the smart contract on the second blockchain according to the processed oracle data.
[0050] On one hand, an embodiment of the present application provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.
[0051] On one hand, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the following steps are implemented:
[0052] Obtain N pieces of oracle data about the oracle subject and attribute information corresponding to the N pieces of oracle data from the oracle contract on the first blockchain; the N pieces of oracle data are off-chain data obtained by at least two oracle nodes in the oracle network, and N is a positive integer greater than 1;
[0053] Verify the validity of the N pieces of prophecy data according to the attribute information respectively corresponding to the N pieces of prophecy data, and obtain a verification result;
[0054] When the verification result indicates that the N pieces of predicted data are valid, a processing algorithm matching the predicted subject is obtained from the oracle contract;
[0055] According to the above processing algorithm, the above N pieces of oracle data are processed to obtain processed oracle data, and the processed oracle data are sent to the node device corresponding to the second blockchain; the above node device is used to execute the smart contract on the above second blockchain according to the above processed oracle data.
[0056] On the one hand, an embodiment of the present application provides a computer program product, including a computer program, which implements the following steps when executed by a processor:
[0057] Obtain N pieces of oracle data about the oracle subject and attribute information corresponding to the N pieces of oracle data from the oracle contract on the first blockchain; the N pieces of oracle data are off-chain data obtained by at least two oracle nodes in the oracle network, and N is a positive integer greater than 1;
[0058] Verify the validity of the N pieces of prophecy data according to the attribute information respectively corresponding to the N pieces of prophecy data, and obtain a verification result;
[0059] When the verification result indicates that the N pieces of predicted data are valid, a processing algorithm matching the predicted subject is obtained from the oracle contract;
[0060] According to the above processing algorithm, the above N pieces of oracle data are processed to obtain processed oracle data, and the processed oracle data are sent to the node device corresponding to the second blockchain; the above node device is used to execute the smart contract on the above second blockchain according to the above processed oracle data.
[0061] In this application, the credibility of the processed prophecy data is improved through the following two methods: First, a two-layer chain structure is proposed, that is, the first layer chain is a blockchain, and the second layer chain is an oracle network, and the off-chain data is obtained through a decentralized oracle network. Specifically, multiple oracle nodes participate in the process of obtaining the processed prophecy data, that is, multiple oracle nodes jointly supervise the process of obtaining the processed prophecy data, so as to avoid the problem that a single external device is maliciously attacked during the process of obtaining off-chain data, resulting in the low credibility of the obtained off-chain data. Second, by verifying the validity of the prophecy data obtained by multiple oracle nodes, only when N prophecy data are valid, the N prophecy data are processed, and the processed prophecy data are sent to the node device corresponding to the second blockchain, further, the credibility of the obtained prophecy data is ensured, and the low credibility prophecy data is avoided from being sent to the node device corresponding to the second blockchain, thereby improving the execution success rate of smart contracts and the security of blockchain. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0063] Figure 1 It is a schematic diagram of a blockchain data processing system provided by this application;
[0064] Figure 2 It is a schematic diagram of an oracle contract in an oracle node provided by this application;
[0065] Figure 3 This is a schematic diagram of the interaction scenario between various devices in a blockchain data processing system provided by this application;
[0066] Figure 4 It is a flowchart of a blockchain data processing method provided by this application;
[0067] Figure 5 This is a schematic diagram of a scenario for verifying the validity of N pieces of prophecy data provided by this application;
[0068] Figure 6 It is a flowchart of a blockchain data processing method provided by this application;
[0069] Figure 7 This is a schematic diagram of a scenario for generating a first root hash value provided by this application;
[0070] Figure 8 This is a schematic diagram of a scenario for generating a second root hash value provided by this application;
[0071] Fig. 9 It is a structural schematic diagram of a blockchain data processing device provided in an embodiment of the present application;
[0072] Fig.10 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0073] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0074] First, we introduce the blockchain data processing system used in this solution. Figure 1 , Figure 1 A schematic diagram of the structure of a blockchain data processing system provided in an embodiment of the present application. The blockchain data processing system may include an oracle network and a blockchain network.
[0075] The blockchain network is an end-to-end decentralized network composed of multiple node devices (also called blockchain nodes). The number of node devices in the blockchain network can be deployed according to actual needs. This application does not limit the number of node devices. Figure 1The blockchain network includes four node devices as an example for explanation, and the four node devices are node device 101, node device 102, node device 103 and node device 104.
[0076] It is understandable that the functions involved in each node device in the blockchain network include:
[0077] 1) Routing: The node has the basic functions of the device and is used to support communication between node devices.
[0078] For example, Figure 1 As shown, data or blocks can be transferred between node devices through network connection. The network connection between the above-mentioned node devices can be based on node identification for data transmission. Each node device has a node identification corresponding to it, and each of the above-mentioned node devices can store the node identifications of other node devices connected to itself, so that the acquired data or generated blocks can be broadcast to other node devices according to the node identifications of other node devices. For example, node device 101 can maintain a node identification list, which stores the node names and node identifications of other node devices, as shown in Table 1:
[0079] Table 1
[0080] Node Name Node ID Node device 101 117.xxx.xxx.174 Node device 102 117.xxx.xxx.145 … … Node device 111 117.xxx.xxx.183 Node device 112 117.xxx.xxx.125 Node device 113 119..xxx.xxx.102 … …
[0081] Among them, the node identifier can be the Internet Protocol (IP) address for interconnecting networks or any other information that can be used to identify the node device in the blockchain network. Table 1 only uses the IP address as an example for explanation.
[0082] Assuming that the node identifier of node device 101 is 117.xxx.xxx.174, node device 101 can send a data synchronization request to node device 102 through 117.xxx.xxx.174, and node device 102 can know that the data synchronization request is sent by node device 101 through node identifier 117.xxx.xxx.174; similarly, node device 102 can send transaction data A to node device 101 through node identifier 117.xxx.xxx.145, and node device 101 can know that transaction data A is sent by node device 101 through node identifier 117.xxx.xxx.145, and the same is true for data transmission between other node devices, so they will not be elaborated one by one.
[0083] 2) Applications are deployed in the blockchain to implement specific businesses based on actual business needs, record data related to the implementation of functions to form record data, carry digital signatures in the record data to indicate the source of the task data, and send the record data to other node devices in the blockchain network for other node devices to add the record data to a temporary block when they successfully verify the source and integrity of the record data.
[0084] For example, the services implemented by the application include:
[0085] 2.1) Resource management service: the node device may include a resource client, which can be used to implement the resource management service function and realize the communication connection with the decentralized application client based on the resource management service function. The resource client is a tool for managing and storing user digital resources. For example, digital resources can be transferred to other accounts based on the resource client, and digital resources transferred from other accounts can be received based on the resource client. The resource client can be a hardware device or a software program.
[0086] It is understandable that with the widespread deployment of various decentralized applications on the blockchain and the increase in user activities on the blockchain, general users can use blockchain key management tools to log in when using decentralized applications. The address in the blockchain key management tool corresponds to a user on the blockchain. The decentralized application can obtain the user address from the key management tool through some interfaces, in order to solve the problem that the Dapp background cannot trust the user address used when logging in to the decentralized application.
[0087] 2.2) Shared ledger, which is used to provide functions such as storage, query and modification of account data (i.e. transaction data), and sends the record data of the operation on the account data to other nodes in the blockchain network. After other nodes verify the validity, as a response to acknowledging the validity of the account data, the record data is stored in a temporary block, and a confirmation can also be sent to the node device that initiated the operation.
[0088] For example, each node device can receive the data to be recorded when performing normal work, and maintain the shared ledger (i.e., blockchain) based on the received data to be recorded. In order to ensure the intercommunication of information within the shared ledger network, a network connection can exist between each node device in the shared ledger network, and data can be transmitted between the node devices through the above network connection. For example, when any node device in the shared ledger network receives the data to be recorded, the other node devices in the shared ledger network will verify the data to be recorded according to the consensus algorithm, and after successful verification (i.e., after consensus is reached), the data to be recorded will be stored as data in the shared ledger, so that the data stored on all node devices in the shared ledger network are consistent.
[0089] 2.3) Smart contracts are computerized protocols that can execute the terms of a contract. They are implemented by deploying code on a shared ledger that is executed when certain conditions are met. The code is used to complete automated transactions based on actual business needs, such as querying the logistics status of the goods purchased by the buyer, and transferring the buyer's digital resources to the merchant's address after the buyer signs for the goods. Of course, smart contracts are not limited to executing contracts for transactions, but can also execute contracts for processing received information. Figure 1 As shown, the oracle network is an end-to-end decentralized network composed of multiple oracle nodes. The number of oracle nodes in the oracle network can be deployed according to actual needs. This application does not limit the number of oracle nodes; Figure 1 The oracle network includes four oracle nodes as an example for explanation. The four oracle nodes are oracle node 111, oracle node 112, oracle node 113 and oracle node 114.
[0090] It should be noted that each oracle node runs an oracle, which is an application used to obtain, verify and transmit off-chain data stored in the off-chain, and send the verified off-chain data to the smart contract on the blockchain. Each oracle node device also maintains a blockchain, which is called the first blockchain for the sake of distinction. The first blockchain includes the oracle contract. Figure 2 As shown, the oracle contract records the relevant information of one or more prediction topics. Taking n prediction topics as an example, they are prediction topic 1, prediction topic 2, ..., prediction topic n; the relevant information includes at least one of the prediction topic identification, number threshold, limited submission time, prediction data, processing algorithm, etc. The prediction topic is used to reflect the main meaning of the prediction data. For example, if the prediction data is the real-time asset value of the item, the prediction topic is the asset value; when the prediction data is invoice data, the corresponding prediction topic is the invoice. The limited submission time of the prediction data is used to indicate the latest submission time of the prediction data of the prediction topic. The processing contract address can refer to the address corresponding to the smart contract that needs the prediction data of the prediction topic to trigger execution. For example, the prediction data of prediction topic 1 is used to trigger execution of smart contract 1 on the second blockchain. Then, the relevant information of prediction topic 1 includes the processing contract address of smart contract 1. The number threshold is used to indicate that the prediction data of the prediction topic is submitted to the smart contract in the second blockchain only when the number of prediction data collected is greater than or equal to the number threshold.
[0091] It should be noted that there is a network connection between the node device in the blockchain network in this application and the oracle node in the oracle network so that data can be exchanged between the node device and the oracle node.
[0092] It should be noted that the blockchain maintained by the node devices in the blockchain network can be called the first blockchain. The first blockchain can include one or more smart contracts. Different smart contracts are used to implement different functions. For example, the first blockchain may include smart contract 1 and smart contract 2. Smart contract 1 can be used to estimate the asset value of an item, and smart contract 2 can be used to realize reimbursement of invoice data.
[0093] In practice, off-chain data is usually required to trigger the execution of the smart contract in the first blockchain. For example, the real-time asset value of the item is required to trigger the execution of smart contract 1, and invoice data is required to trigger the execution of smart contract 2. Currently, off-chain data is mainly obtained through external devices, but there is a lack of supervision mechanism in the process of obtaining off-chain data, resulting in low credibility of the obtained off-chain data.
[0094] Based on this, in this application, multiple oracle nodes participate in the process of obtaining the processed oracle data, that is, multiple oracle nodes jointly supervise the process of obtaining the processed oracle data, so as to avoid the problem that a single external device is maliciously attacked during the process of obtaining off-chain data, resulting in the low credibility of the obtained off-chain data. In addition, by verifying the credibility of the oracle data obtained by multiple oracle nodes, the N oracle data are processed only when the credibility of the N oracle data is greater than the credibility threshold, and the processed oracle data is sent to the node device corresponding to the second blockchain, further, the credibility of the obtained oracle data is ensured, and the oracle data with low credibility is avoided from being sent to the node device corresponding to the second blockchain, thereby improving the execution success rate of the smart contract and the security of the blockchain.
[0095] It is understandable that node device 101, node device 102, node device 103, node device 104 and oracle node 111, oracle node 112, oracle node 113 and oracle node 114 can be an independent physical server, or a server cluster or distributed system composed of at least two physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, Content Delivery Network (CDN), and big data and artificial intelligence platforms.
[0096] In this application Figure 1 The blockchain data processing method shown can be used in scenarios such as asset value estimation of items and invoice reimbursement. Figure 3 The invoice reimbursement scenario is used as an example to illustrate. Figure 3 The node device 30a in may be Figure 1Any node device in the blockchain network, Figure 3 The oracle node 31a in can be Figure 1 Any oracle node in the oracle network. The node device 30a includes a second blockchain, which includes a smart contract for invoice reimbursement, referred to as an invoice smart contract 32a; the oracle node 31a includes a first blockchain, which includes an oracle contract 33a.
[0097] In the specific implementation, the oracle node 31a can obtain the invoice data of individuals or institutions from outside the chain through the oracle. Figure 3 The example of obtaining the invoice data of institution a is used for explanation. The oracle node 31a can obtain the invoice data of institution a from outside the chain through the oracle, and store the obtained invoice data as the oracle data of the invoice subject in the oracle contract 33a of the oracle node 31a. At the same time, the oracle node 31a can broadcast the obtained invoice data to other oracle nodes in the oracle network, so that other oracle nodes can store the received invoice data as the oracle data corresponding to the invoice subject in the oracle contracts of other oracle nodes. In addition, the oracle node 31a will also receive the invoice data about institution a obtained by other oracle nodes, and store the received invoice data as the oracle data of the invoice subject in the oracle contract 33a of the oracle node 31a, so that the oracle data of the invoice subject stored in the oracle contracts of each oracle node are consistent.
[0098] It should be noted that different oracle nodes obtain the invoice data of institution a in different ways. For example, oracle node 31a can obtain invoice data 2 about institution a from the tax agency, and other oracle nodes can obtain invoice data 1 about institution a from institution a (or institution a’s supplier, etc.).
[0099] The oracle node 31a can detect whether the predicted data of the invoice subject in the oracle contract meets the submission conditions. For example, if it is detected that the number of predicted data about the invoice subject in the oracle contract is greater than the number threshold, it is determined that the predicted data of the invoice subject meets the submission conditions; or, if it is detected that the current time reaches the restricted submission time of the invoice subject in the oracle contract, it is determined that the predicted data of the invoice subject meets the submission conditions. At the same time, other oracle nodes will also detect whether the predicted data of the invoice subject in the oracle contract meets the submission conditions and obtain the detection results. The oracle node 31a can receive the detection results sent by other oracle nodes. When most of the oracle nodes in the oracle network detect that the predicted data of the invoice subject meets the submission conditions, the oracle node 31a can obtain the attribute information corresponding to the predicted data of the invoice subject in the oracle contract, and verify the validity of the predicted data of the invoice subject in the oracle contract according to the attribute information to obtain the verification result. If the verification result indicates that the oracle data of the invoice subject in the oracle contract is not valid, it means that the source of the oracle data of the invoice subject in the oracle contract is illegal, the data has been tampered with, etc., that is, the credibility of the oracle data of the invoice subject in the oracle contract is relatively low. At this time, the oracle data of the invoice subject in the oracle contract can be refused to be sent to the node device in the blockchain network. If the verification result indicates that the oracle data of the invoice subject in the oracle contract is valid, indicating that the source of the oracle data of the invoice subject in the oracle contract is legal and the data has not been tampered with, that is, the oracle data of the invoice subject in the oracle contract is relatively credible, the oracle node 31a can use the processing algorithm corresponding to the invoice subject to process the oracle data on the invoice subject in the oracle contract to obtain processed oracle data, such as screening out oracle data with integrity from multiple oracle data of the invoice subject as processed oracle data, and sending the processed oracle data to the node device 30a. The node device 30a can broadcast the processed oracle data to other node devices in the blockchain network. The node devices in the blockchain network perform consensus processing on the processed oracle data. When the consensus is passed, the invoice smart contract 32a is executed according to the processed oracle data.
[0100] In summary, the credibility of the processed prophecy data can be improved through the following two methods: First, multiple oracle nodes participate in the process of obtaining the processed prophecy data, that is, multiple oracle nodes jointly supervise the process of obtaining the processed prophecy data, so as to avoid the problem that a single external device is maliciously attacked during the process of obtaining off-chain data, resulting in the low credibility of the obtained off-chain data. Second, by verifying the validity of the prophecy data obtained by multiple oracle nodes, only when N prophecy data are valid, the N prophecy data are processed, and the processed prophecy data are sent to the node device corresponding to the second blockchain, further, the credibility of the obtained prophecy data is ensured, and the low credibility prophecy data is avoided from being sent to the node device corresponding to the second blockchain, so as to improve the execution success rate of smart contracts and the security of blockchain.
[0101] For further information, see Figure 4 This is a flowchart of a blockchain data processing method provided by an embodiment of the present application. Figure 4 As shown, this method can be Figure 1 The method may include the following steps:
[0102] S101. Obtain N pieces of prediction data about a prediction subject and attribute information corresponding to the N pieces of prediction data from the oracle contract on the first blockchain; the N pieces of prediction data are off-chain data obtained by at least two oracle nodes in the oracle network, and N is a positive integer greater than 1.
[0103] In this application, the oracle node can obtain the off-chain data of a certain prediction topic through the oracle, and broadcast the obtained off-chain data to other oracle nodes in the oracle network, so that other oracle nodes can store the received off-chain data as the prediction data of the prediction topic in the oracle contract of other oracle nodes. The oracle node can also receive the off-chain data broadcasted by other oracle nodes, and store the received off-chain data as the prediction data of the prediction topic in the oracle contract of the oracle node, so that the prediction data stored by all oracle nodes in the oracle network are consistent.
[0104] Furthermore, the oracle node can detect whether the oracle data about the oracle subject in the oracle contract meets the submission conditions by any of the following detection methods: Detection method 1, detect whether the number of oracle data about the oracle subject in the oracle contract is greater than the number threshold, then if it is detected that the number of oracle data about the oracle subject in the oracle contract is greater than the number threshold, it is determined that the oracle data about the oracle subject in the oracle contract meets the submission conditions. Detection method 2, detect whether the current time reaches the restricted submission time, and when the current time reaches the restricted submission time, it is determined that the oracle data about the oracle subject in the oracle contract meets the submission conditions.
[0105] Then, when it is determined that the prediction data about the prediction subject in the oracle contract meets the submission conditions, the prediction data about the prediction subject is obtained from the oracle contract on the first blockchain, N prediction data are obtained, and the attribute information corresponding to the N prediction data is obtained from the oracle contract on the first blockchain.
[0106] It should be noted that the attribute information corresponding to the prophecy data includes one or more of the generation time, the node identifier of the prophecy node that obtains the prophecy data, the source address that provides the prophecy data, and the key fields in the prophecy data. The key fields in the prophecy data are specifically related to the prophecy subject. For example, if the prophecy subject is the invoice subject, the key fields include the invoice time, the invoice amount, etc. When the prophecy subject is the asset value, the key fields include the item type, the real-time asset value, etc.
[0107] It should be noted that the N pieces of prediction data have one or more of the following differences: 1. The N pieces of prediction data can be obtained from different source addresses, 2. The generation times corresponding to the N pieces of prediction data can be different, and 3. The N pieces of prediction data are obtained by multiple oracle nodes.
[0108] For example, the prediction subject is asset value, and the prediction data is the real-time asset value of the item. The item can refer to digital assets or non-digital assets. Digital assets can include digital collections, game coins, game equipment, game themes, etc. Non-digital assets include clothing, school supplies, office supplies, daily necessities, etc. The oracle node can obtain the real-time asset value of the item from source address a, and other oracle nodes can obtain the real-time asset value of the item from source address b. Alternatively, the oracle node can obtain the real-time asset value of the item in the first time period, and other oracle nodes can obtain the real-time asset value of the item in the second time period.
[0109] S102: Verify the validity of the N pieces of prediction data according to the attribute information respectively corresponding to the N pieces of prediction data to obtain a verification result.
[0110] In the present application, the oracle node can verify the validity of N pieces of prophecy data according to the attribute information respectively corresponding to the N pieces of prophecy data, and obtain a verification result, and the verification result is used to indicate that the N pieces of prophecy data are valid, or the verification result indicates that the N pieces of prophecy data are not valid. The validity of the N pieces of prophecy data means that the source of the N pieces of prophecy data is legal, has not been tampered with, is the latest updated data, and most of the prophecy data (such as more than 50%) is obtained by a highly stable oracle node, etc. One or more of the N pieces of prophecy data are not valid, which means that the source of the N pieces of prophecy data is illegal, has been tampered with, is not the latest updated data, etc. One or more of the N pieces of prophecy data are not valid. The validity of the N pieces of prophecy data may mean that all the prophecy data in the N pieces of prophecy data are valid, or the validity of the N pieces of prophecy data may mean that most of the prophecy data in the N pieces of prophecy data are valid.
[0111] In one embodiment, the validity of the N pieces of prediction data are verified based on the attribute information respectively corresponding to the N pieces of prediction data to obtain a verification result, including: counting the K oracle nodes used to provide the N pieces of prediction data based on the attribute information respectively corresponding to the N pieces of prediction data; K is a positive integer greater than 1; when K is greater than the threshold value of the number of oracle nodes, obtaining the historical log data respectively corresponding to the K oracle nodes; verifying the validity of the N pieces of prediction data based on the historical log data respectively corresponding to the K oracle nodes to obtain a verification result.
[0112] It should be noted that the threshold of the number of oracle nodes can be dynamically determined according to the security requirement level of the application scenario of the oracle subject. For example, the higher the security requirement level, the larger the threshold of the number of oracle nodes; the lower the security requirement level, the smaller the threshold of the number of oracle nodes. The threshold of the number of oracle nodes can be determined according to the number of nodes in the oracle network, or the threshold of the number of oracle nodes can be pre-set.
[0113] It should be noted that the historical log data may be the log data of the oracle node within a historical time period. The historical time period may be within the past day, the past week, the past month, etc. The historical log data may reflect the processing performance of the oracle node for off-chain data, such as processing performance including at least one of acquisition accuracy, acquisition efficiency, processing efficiency, and transmission efficiency of oracle data.
[0114] Specifically, the attribute information includes the node identifier of the oracle node that obtains the prophecy data. The oracle node can count the oracle nodes used to provide the N prophecy data according to the attribute information corresponding to the N prophecy data, and obtain K oracle nodes. That is, the total number of devices corresponding to the K oracle nodes used to provide the N prophecy data. When K is less than or equal to the threshold of the number of oracle nodes, it indicates that the N prophecy data are obtained by a small number of oracle nodes, and the credibility of the N prophecy data is relatively low. Therefore, the oracle node can wait until there are a large number of oracle nodes providing prophecy data before executing subsequent steps. When K is greater than the threshold of the number of oracle nodes, it indicates that the N prophecy data are obtained by a large number of oracle nodes, and the credibility of the N prophecy data is relatively high. Therefore, the oracle node can obtain the historical log data corresponding to the K oracle nodes from each oracle node in the oracle network, and verify the validity of the N prophecy data according to the historical log data corresponding to the K oracle nodes, and obtain the verification result. When there are a large number of oracle nodes providing oracle data, the validity of N oracle data is verified based on historical log data, avoiding the problem of low accuracy of oracle data provided by a single oracle node.
[0115] In one embodiment, the validity of the N prediction data is verified based on the historical log data corresponding to the K prediction nodes, and the verification result is obtained, including: the oracle node can determine the stability corresponding to the K oracle nodes according to the historical log data corresponding to the K oracle nodes; count the number of devices corresponding to the oracle nodes whose stability is greater than the stability threshold among the K oracle nodes, and the total number of devices corresponding to the K oracle nodes; verify the validity of the N prediction data based on the number of devices and the total number of devices to obtain a verification result.
[0116] Specifically, the oracle node can determine the stability corresponding to the K oracle nodes according to the historical log data corresponding to the K oracle nodes. For example, the higher the processing performance of the corresponding oracle node for off-chain data reflected by the historical log data corresponding to the oracle node, the higher the stability corresponding to the oracle node; the lower the processing performance of the corresponding oracle node for off-chain data reflected by the historical log data corresponding to the oracle node, the lower the stability corresponding to the oracle node. Further, the number of devices corresponding to the oracle nodes with stability greater than the stability threshold among the K oracle nodes and the total number of devices corresponding to the K oracle nodes are counted, and the device ratio between the number of devices and the total number of devices, that is, the numerator of the device ratio is the number of devices and the denominator is the total number of devices, is used to verify the validity of N pieces of oracle data according to the device ratio, and obtain a verification result. The device ratio is greater than the ratio threshold, indicating that a large number of highly stable oracle nodes obtain oracle data, and a verification result indicating that the N pieces of oracle data are valid can be generated at this time. If the device ratio is less than or equal to the ratio threshold, it indicates that a small number of highly stable oracle nodes obtain the prediction data. At this time, a verification result indicating that N prediction data are not valid can be generated, thereby improving the accuracy of the prediction data.
[0117] In one embodiment, the validity of the N prediction data is verified based on the attribute information respectively corresponding to the N prediction data to obtain a verification result, including: determining the similarity between every two prediction data in the N prediction data according to the attribute information respectively corresponding to the N prediction data; calculating the total similarity corresponding to the N prediction data according to the similarity between every two prediction data in the N prediction data; verifying the validity of the N prediction data according to the total similarity to obtain a verification result.
[0118] Specifically, when the attribute information includes the key fields of the prophecy data, such as the prophecy data of the item, the oracle node can sample the similarity algorithm, and determine the similarity between each two prophecy data in the N prophecy data according to the key fields corresponding to the N prophecy data. The similarity algorithm includes Pearson correlation coefficient, log likelihood similarity, etc. Further, the oracle node can accumulate the similarity between each two prophecy data in the N prophecy data to obtain the total similarity corresponding to the N prophecy data. If the total similarity is less than or equal to the similarity threshold, it indicates that the N prophecy data are relatively similar, and it is determined that the N prophecy data are not valid; if the total similarity is greater than the similarity threshold, it indicates that the similarity between the N prophecy data is relatively small, and it is determined that the N prophecy data are valid. By verifying the validity of the N prophecy data through the similarity between the N prophecy data, it can be avoided that the differences between the N prophecy data are relatively large, resulting in the low accuracy of the N prophecy data.
[0119] For example, Figure 5 As shown, the N pieces of oracle data are respectively oracle data 51a, oracle data 52a, oracle data 53a, ..., oracle data 5Na. The oracle node can determine the similarity between oracle data 51a and oracle data 52a based on the attribute information of oracle data 51a and the attribute information of oracle data 52a, which is recorded as similarity 1, and determine the similarity between oracle data 52a and oracle data 53a based on the attribute information of oracle data 52a and the attribute information of oracle data 53a, which is recorded as similarity 2. ..., and so on, S similarities are obtained, and the S similarities are summed to obtain the total similarity. The similarity threshold is obtained from the oracle contract. If the total similarity is greater than the similarity threshold, it is determined that the N pieces of oracle data are valid, and a verification result indicating that the N pieces of oracle data are valid is generated. If the total similarity is less than or equal to the similarity threshold, it is determined that the N pieces of oracle data are not valid, and a verification result indicating that the N pieces of oracle data are not valid is generated.
[0120] S103. When the verification result indicates that the N pieces of predicted data are valid, obtain a processing algorithm that matches the predicted subject from the oracle contract.
[0121] In the present application, when the verification result indicates that the N pieces of prediction data are valid, it indicates that the credibility of the N pieces of prediction data is relatively high. Therefore, a processing algorithm matching the prediction subject can be obtained from the oracle contract. The processing algorithm is used to indicate how to integrate and process the N pieces of prediction data, which may specifically include screening processing, weighted processing, averaging processing, etc.
[0122] It should be noted that all oracle nodes in the oracle network verify the validity of the N pieces of oracle data according to the attribute information, and obtain the verification results. The verification results will be synchronized between the oracle nodes. When the verification results of most oracle nodes in the oracle network indicate that the N pieces of oracle data are valid, step S103 is executed. In other words, multiple oracle nodes participate in the acquisition process of supervised off-chain data, which avoids malicious attacks on a single oracle node, resulting in invalid oracle data being sent to the node device corresponding to the second blockchain, thereby improving the processing security and fairness of blockchain-related services.
[0123] S104. According to the processing algorithm, the N pieces of oracle data are processed to obtain processed oracle data, and the processed oracle data are sent to a node device corresponding to the second blockchain; the node device is used to execute the smart contract on the second blockchain according to the processed oracle data.
[0124] In the present application, the oracle node can process the N pieces of oracle data according to the processing algorithm to obtain processed oracle data, and send the processed oracle data to the node device corresponding to the second blockchain. The node device is used to execute the smart contract on the second blockchain according to the processed oracle data, thereby triggering the execution of the smart contract on the chain through off-chain data, which is conducive to ensuring the normal execution of blockchain-related businesses.
[0125] In one embodiment, when the prophecy data is the invoice data of a certain institution, the prophecy machine node can detect the integrity of N prophecy data according to the fields contained in the invoice data specified in the processing algorithm, and select the prophecy data with integrity from the N prophecy data as the processed prophecy data. The prophecy data with integrity can refer to the prophecy data including the fields indicated by the processing algorithm. This can avoid the prophecy data missing some information, resulting in the prophecy data not having integrity.
[0126] In one embodiment, the above-mentioned N pieces of prediction data are processed according to the above-mentioned processing algorithm to obtain the processed prediction data, including: obtaining the restricted submission time of the prediction data on the above-mentioned prediction subject from the above-mentioned oracle contract; when the current time reaches the above-mentioned restricted submission time, the above-mentioned N pieces of prediction data are processed according to the above-mentioned processing algorithm to obtain the processed prediction data.
[0127] Specifically, the oracle node can obtain the restricted submission time of the oracle data about the oracle subject from the oracle contract. The restricted submission time can be the latest submission time. When the current time reaches the restricted submission time, the oracle node can process the N pieces of oracle data according to the processing algorithm to obtain the processed oracle data. The restricted submission time can be different from the restricted submission time of the oracle data of other oracle subjects in the oracle contract, so as to avoid a large amount of oracle data to be processed in the oracle node, which may cause network congestion in the oracle node.
[0128] In this application, the credibility of the processed prophecy data is improved by the following two methods: First, multiple oracle nodes participate in the process of obtaining the processed prophecy data, that is, multiple oracle nodes jointly supervise the process of obtaining the processed prophecy data, so as to avoid the problem that a single external device is maliciously attacked during the process of obtaining off-chain data, resulting in the low credibility of the obtained off-chain data. Second, by verifying the validity of the prophecy data obtained by multiple oracle nodes, only when N prophecy data are valid, the N prophecy data are processed, and the processed prophecy data are sent to the node device corresponding to the second blockchain, further, the credibility of the obtained prophecy data is ensured, and the prophecy data with low credibility is avoided from being sent to the node device corresponding to the second blockchain, so as to improve the execution success rate of smart contracts and the security of blockchain.
[0129] For further information, see Figure 6 This is a flowchart of a blockchain data processing method provided by an embodiment of the present application. Figure 6 As shown, this method can be Figure 1 The method may include the following steps:
[0130] S201. Obtain N pieces of prediction data about the prediction subject and attribute information corresponding to the N pieces of prediction data from the oracle contract on the first blockchain; the N pieces of prediction data are off-chain data obtained by at least two oracle nodes in the oracle network, and N is a positive integer greater than 1.
[0131] S202: Verify the validity of the N pieces of prediction data according to the attribute information respectively corresponding to the N pieces of prediction data to obtain a verification result.
[0132] S203. When the verification result indicates that the N pieces of predicted data are valid, obtain a processing algorithm that matches the predicted subject from the oracle contract.
[0133] S204: Obtain the generation time corresponding to each of the N pieces of prophecy data.
[0134] In the present application, when the real-time requirements of the prediction data of the prediction subject are relatively high, such as the prediction data is about the real-time asset value of an item, the real-time asset value may refer to the digital asset required to purchase the item, and the oracle node may obtain the generation time corresponding to each of the N prediction data from the attribute information corresponding to each of the N prediction data.
[0135] S205. Determine the time interval between the generation time corresponding to each of the N pieces of prophecy data and the current time according to the processing algorithm.
[0136] In the present application, the oracle node can perform difference processing between the generation time corresponding to each of the N pieces of oracle data and the current time according to the processing algorithm to obtain the time interval between the generation time corresponding to each of the N pieces of oracle data and the current time.
[0137] S206: Filter out the prediction data whose time interval is less than the time interval threshold from the N prediction data, and process the filtered prediction data to obtain processed prediction data.
[0138] In this application, when the time interval is larger, it indicates that the corresponding prophecy data is the prophecy data of the prophecy subject a long time ago, and the validity of the prophecy data is relatively low; when the time interval is smaller, it indicates that the corresponding prophecy data is the prophecy data of the prophecy subject most recently updated, and the validity of the prophecy data is relatively high. Therefore, the oracle node can filter out the prophecy data with a time interval less than the time interval threshold from the N prophecy data, process the filtered prophecy data, and obtain the processed prophecy data.
[0139] In one embodiment, the above-mentioned prediction data is about the real-time asset value of the item, and the above-mentioned processing of the filtered prediction data to obtain the processed prediction data includes: the oracle node averages the real-time asset value corresponding to the above-mentioned filtered prediction data to obtain the average asset value; performs difference processing on the real-time asset value corresponding to the above-mentioned filtered prediction data and the above-mentioned average asset value to obtain the difference asset value corresponding to the above-mentioned filtered prediction data; and determines the prediction data whose difference asset value corresponding to the above-mentioned filtered prediction data is the minimum value as the processed prediction data.
[0140] Specifically, the oracle node can use an average algorithm to average the real-time asset value corresponding to the selected oracle data to obtain the average asset value, and perform a difference processing between the real-time asset value corresponding to the selected oracle data and the average asset value to obtain the difference asset value corresponding to the selected oracle data; the average algorithm here includes an arithmetic average algorithm, a geometric average algorithm, a harmonic average algorithm, etc. Further, the oracle data with the minimum difference asset value corresponding to the selected oracle data is determined as the processed oracle data, which is conducive to obtaining the accuracy of the real-time asset value of the item.
[0141] For example, taking the weighted average algorithm as an example, the oracle node can obtain the stability corresponding to the filtered oracle data, determine the weights corresponding to the filtered oracle data respectively; according to the weights corresponding to the filtered oracle data respectively, the real-time asset value corresponding to the filtered oracle data is weighted averaged to obtain the average asset value. Further, the real-time asset value corresponding to the filtered oracle data and the average asset value are differenced to obtain the differential asset value corresponding to the filtered oracle data, and the oracle data with the minimum differential asset value corresponding to the filtered oracle data is determined as the processed oracle data.
[0142] In one embodiment, the above-mentioned prediction data is about the real-time asset value of the item. The above-mentioned processing of the filtered prediction data to obtain the processed prediction data includes: the oracle node can use an averaging algorithm to average the real-time asset value corresponding to the filtered prediction data to obtain the average asset value, and determine the average asset value as the processed prediction data.
[0143] S207. Send the processed oracle data to a node device corresponding to the second blockchain; the node device is used to execute the smart contract on the second blockchain according to the processed oracle data.
[0144] In one embodiment, the above-mentioned sending of the processed oracle data to the node device corresponding to the second blockchain includes: the oracle node can obtain the data volume corresponding to the processed oracle data; if the data volume is greater than the data volume threshold, the processed oracle data is split to obtain L pieces of sub-oracle data; L is a positive integer greater than 1; a hash operation is performed on the L pieces of sub-oracle data to obtain hash values corresponding to the L pieces of sub-oracle data respectively; according to the hash values corresponding to the L pieces of sub-oracle data respectively, a first root hash value for verifying the processed oracle data is generated, and the L pieces of sub-oracle data and the first root hash value are sent to the node device in sequence; the node device is used to execute the smart contract on the second blockchain according to the merged oracle data when the merged oracle data is verified to be valid based on the first root hash value; the merged oracle data is obtained by merging the L pieces of sub-oracle data.
[0145] Specifically, the oracle node can obtain the amount of data corresponding to the processed oracle data. If the amount of data is greater than the data amount threshold, it indicates that the processed oracle data includes a large amount of data. Therefore, the oracle node can split the processed oracle data to obtain L pieces of sub-oracle data; L is a positive integer greater than 1. The oracle node can use a hash algorithm to perform a hash operation on the L pieces of sub-oracle data to obtain the hash values corresponding to the L pieces of sub-oracle data. The hash algorithm can refer to any one of SHA-1, SHA-224, SHA-256, SHA-384, and SHA-512; then, according to the hash values corresponding to the L pieces of sub-oracle data, a first root hash value for verifying the processed oracle data is generated. The L pieces of sub-oracle data and the first root hash value are sent to the node device corresponding to the second blockchain in batches. The node device is used to perform a hash operation on the received L pieces of prophecy data to obtain the hash value of the L pieces of prophecy data, and generate the third root hash value corresponding to the L pieces of prophecy data according to the L pieces of prophecy data. If the third root hash value is the same as the first root hash value, it is determined that the received L pieces of prophecy data are valid, that is, the L pieces of prophecy data have not been lost or tampered with during the transmission process. At this time, the node device can merge the received L pieces of prophecy data to obtain the merged prophecy data, and execute the smart contract on the second blockchain according to the merged prophecy data. By splitting the processed prophecy data, it is avoided that the amount of data contained in the processed prophecy data is too large, which leads to network congestion, packet loss and other problems during the transmission process, thereby improving the transmission efficiency and accuracy of the prophecy data.
[0146] In one embodiment, the above-mentioned first root hash value for verifying the processed oracle data is generated according to the hash values corresponding to the above-mentioned L sub-oracle data, including: the oracle node can group the L sub-oracle data to obtain P groups; P is a positive integer greater than 1; the hash value corresponding to the sub-oracle data belonging to group i is hashed again to obtain the hash value corresponding to the group i; i is a positive integer less than or equal to P; according to the hash values corresponding to the above-mentioned P groups, the first root hash value for verifying the processed oracle data is generated.
[0147] Specifically, the oracle node can group L pieces of sub-oracle data to obtain P groups. The number of sub-oracle data in each group can be the same or different. The hash values corresponding to the sub-oracle data belonging to group i are merged to obtain a first merged hash value. The first merged hash value is hashed to obtain a hash value corresponding to group i, that is, one group corresponds to one hash value. The hash values corresponding to the P groups are merged to obtain a second merged hash value. The second merged hash value is hashed to obtain a first root hash value for verifying the processed oracle data. After multiple hash operations, the first root hash value is obtained, which is conducive to more detailed detection of whether the L pieces of sub-oracle data have abnormal conditions such as packet loss and tampering during transmission, thereby improving the transmission security of the oracle data.
[0148] For example, Figure 7 As shown, the processed oracle data is split into 4 sub-oracle data, including sub-oracle data 1, sub-oracle data 2, sub-oracle data 3 and sub-oracle data 4; the oracle node can group the 4 sub-oracle data to obtain 2 groups, namely group 1 and group 2; group 1 includes sub-oracle data 1 and sub-oracle data 2, and group 2 includes sub-oracle data 3 and sub-oracle data 4. The oracle node can perform a hash operation on sub-oracle data 1 to obtain a hash value 70a of sub-oracle data 1, perform a hash operation on sub-oracle data 2 to obtain a hash value 71a of sub-oracle data 2, extract the first four bits of data (or the last four bits of data) from hash value 70a and hash value 71a respectively, concatenate the four bits of data extracted from hash value 70a with the four bits of data extracted from hash value 71a, obtain a combined hash value corresponding to group 1, and perform a hash operation on the combined hash value corresponding to group 1 to obtain a hash value 74a corresponding to group 1. Similarly, the oracle node can perform a hash operation on the sub-oracle data 3 to obtain a hash value 72a of the sub-oracle data 3, perform a hash operation on the sub-oracle data 4 to obtain a hash value 73a of the sub-oracle data 4, extract the first four bits of data (or the last four bits of data) from the hash value 72a and the hash value 73a respectively, concatenate the four bits of data extracted from the hash value 72a with the four bits of data extracted from the hash value 73a to obtain a combined hash value corresponding to group 2, perform a hash operation on the combined hash value corresponding to group 2 to obtain a hash value 75a corresponding to group 2. Further, extract the first four bits of data from the hash value 74a and the hash value 75a respectively, concatenate the four bits of data extracted from the hash value 74a with the four bits of data extracted from the hash value 75a to obtain a second combined hash value, perform a hash operation on the second combined hash value to obtain a first root hash value for verifying the processed oracle data.
[0149] It should be noted that merging U hash values may refer to concatenating the U hash values into one hash value, or merging U hash values may refer to extracting g bits of data from the U hash values respectively and concatenating the g bits of data corresponding to the U hash values to obtain one hash value. U is a positive integer greater than 1, and g is an integer.
[0150] In one embodiment, the above-mentioned sending the processed oracle data to the node device corresponding to the second blockchain includes: performing a hash operation on the processed oracle data to obtain a hash value of the processed oracle data; generating a second root hash value for verifying the processed oracle data and the other oracle data according to the hash value of the processed oracle data and the hash value of other oracle data; the other oracle data is the oracle data in the oracle network to be transmitted to the node device; sending the second root hash value, the other oracle data and the processed oracle data to the node device, and the node device is also used to verify based on the root hash value that the processed oracle data and the other oracle data are both valid, and then execute the smart contract on the second blockchain according to the processed oracle data.
[0151] Specifically, the oracle node can use a hash algorithm to perform a hash operation on the initial oracle data to obtain a hash value of the processed oracle data, merge the hash value of the processed oracle data with the hash value of other oracle data to obtain a third merged hash value, and perform a hash operation on the third merged hash value to obtain a second root hash value for verifying the processed oracle data and the above-mentioned other oracle data. Further, the above-mentioned second root hash value, the above-mentioned other oracle data, and the above-mentioned processed oracle data are sent to the above-mentioned node device, and the node device can merge according to the hash value of the oracle data and the hash value of the processed oracle data to obtain a fourth merged hash value. The fourth merged hash value is hashed to obtain a fourth root hash value. If the second root hash value is the same as the fourth root hash value, it is determined that the processed oracle data and other oracle data are both valid, and the smart contract on the above-mentioned second blockchain is executed according to the above-mentioned processed oracle data. In other words, multiple oracle data correspond to one root hash value, and there is no need to send a root hash value for each oracle data, thereby reducing the pressure of data transmission.
[0152] For example, Figure 8As shown, the processed prophecy data is prophecy data 1, and the other prophecy data include prophecy data 2 and prophecy data 3. The prophecy machine node can perform a hash operation on prophecy data 1 to obtain a hash value 80a of prophecy data 1, perform a hash operation on prophecy data 2 to obtain a hash value 81a of prophecy data 2, and perform a hash operation on prophecy data 3 to obtain a hash value 82a of prophecy data 3. Hash value 80a is concatenated with hash value 81a to obtain a combined hash value 85a (not shown in the figure), and a hash operation is performed on combined hash value 85a to obtain a hash value 83a, and a hash operation is performed on hash value 82a to obtain a hash value 84a. Hash value 83a is concatenated with hash value 84a to obtain a third combined hash value, and a hash operation is performed on the third combined hash value to obtain a second root hash value used to verify the processed prophecy data and the above-mentioned other prophecy data.
[0153] It should be noted that the oracle node can use the public key of any node device in the blockchain network to encrypt the root hash value, obtain the ciphertext of the root hash value, and send the ciphertext of the root hash value to the node device. The root hash value may refer to the first root hash value or the second root hash value mentioned above. The second hash value is used as an example for explanation below. After the node device receives the ciphertext of the root hash value, it can use the private key corresponding to the public key of the node device to decrypt the ciphertext of the root hash value to obtain the decrypted root hash value. According to the fact that the decrypted root hash value is the same as the fourth root hash value, it is determined that the processed prophecy data and other prophecy data are valid, and the smart contract on the second blockchain is executed according to the processed prophecy data. This is conducive to improving the accuracy of the prophecy data and preventing the prophecy data from being tampered with during transmission.
[0154] In this application, the credibility of the processed prophecy data is improved by the following two methods: First, multiple oracle nodes participate in the process of obtaining the processed prophecy data, that is, multiple oracle nodes jointly supervise the process of obtaining the processed prophecy data, so as to avoid the problem that a single external device is maliciously attacked during the process of obtaining off-chain data, resulting in the low credibility of the obtained off-chain data. Second, by verifying the validity of the prophecy data obtained by multiple oracle nodes, only when N prophecy data are valid, the N prophecy data are processed, and the processed prophecy data are sent to the node device corresponding to the second blockchain, further, the credibility of the obtained prophecy data is ensured, and the prophecy data with low credibility is avoided from being sent to the node device corresponding to the second blockchain, so as to improve the execution success rate of smart contracts and the security of blockchain.
[0155] See also Fig. 9, is a schematic diagram of the structure of a blockchain data processing device provided in an embodiment of the present application. The above-mentioned blockchain-based data processing device can be a computer program (including program code) running in a network device. For example, the blockchain-based data processing device is an application software; the device can be used to execute the corresponding steps of the method provided in an embodiment of the present application. Fig. 9 As shown, the blockchain data processing device may include:
[0156] The first acquisition module 911 is used to obtain N pieces of prediction data about the prediction subject and attribute information corresponding to the N pieces of prediction data from the prediction contract on the first blockchain; the N pieces of prediction data are off-chain data obtained by at least two prediction nodes in the prediction network, and N is a positive integer greater than 1;
[0157] A verification module 912, used to verify the validity of the N pieces of prediction data according to the attribute information respectively corresponding to the N pieces of prediction data, and obtain a verification result;
[0158] The second acquisition module 913 is used to acquire a processing algorithm matching the above-mentioned prediction subject from the above-mentioned oracle contract when the above-mentioned verification result indicates that the above-mentioned N prediction data are valid;
[0159] The processing module 914 is used to process the above-mentioned N prediction data according to the above-mentioned processing algorithm to obtain processed prediction data, and send the above-mentioned processed prediction data to the node device corresponding to the second blockchain; the above-mentioned node device is used to execute the smart contract on the above-mentioned second blockchain according to the above-mentioned processed prediction data.
[0160] Optionally, the verification module 912 includes a statistical unit 91a, a first acquisition unit 92a and a verification unit 93a;
[0161] A statistical unit 91a is used to count K oracle nodes used to provide the N pieces of oracle data according to the attribute information respectively corresponding to the N pieces of oracle data; K is a positive integer greater than 1;
[0162] The first acquisition unit 92a is used to acquire the historical log data corresponding to the K oracle nodes respectively when K is greater than the threshold value of the number of oracle nodes;
[0163] The verification unit 93a is used to verify the validity of the above-mentioned N prediction data according to the historical log data corresponding to the above-mentioned K prediction machine nodes respectively, and obtain a verification result.
[0164] Optionally, the verification unit 93a verifies the validity of the N pieces of oracle data according to the historical log data corresponding to the K oracle nodes, and obtains a verification result, including:
[0165] According to the historical log data corresponding to the above K oracle nodes, the stability corresponding to the above K oracle nodes is determined;
[0166] Count the number of devices corresponding to the oracle nodes whose stability is greater than the stability threshold among the above K oracle nodes, as well as the total number of devices corresponding to the above K oracle nodes;
[0167] Based on the above number of devices and the above total number of devices, the validity of the above N predicted data is verified to obtain a verification result.
[0168] Optionally, the verification module 912 verifies the validity of the N pieces of prediction data according to the attribute information respectively corresponding to the N pieces of prediction data, and obtains a verification result, including:
[0169] Determine the similarity between each two pieces of the N pieces of prediction data according to the attribute information respectively corresponding to the N pieces of prediction data;
[0170] According to the similarity between each two pieces of the N pieces of prediction data, the total similarity corresponding to the N pieces of prediction data is counted;
[0171] Based on the above total similarity, the validity of the above N predicted data is verified to obtain the verification result.
[0172] Optionally, the processing module 914 includes a second acquisition unit 94b, a determination unit 95b and a screening unit 96b;
[0173] The second obtaining unit 94b is used to obtain the generation time corresponding to the above N pieces of prediction data respectively;
[0174] A determination unit 95b is used to determine the time interval between the generation time corresponding to each of the N pieces of predicted data and the current time according to the processing algorithm;
[0175] The screening unit 96b is used to screen out the prediction data whose time interval is less than the time interval threshold from the above-mentioned N prediction data, and process the screened prediction data to obtain the processed prediction data.
[0176] Optionally, the prediction data is about the real-time asset value of the item, and the screening unit 96b processes the screened prediction data to obtain the processed prediction data, including:
[0177] The real-time asset values corresponding to the above-screened prediction data are averaged to obtain the average asset value;
[0178] The real-time asset value corresponding to the above-screened prediction data is subjected to difference processing with the above-screened average asset value to obtain the difference asset value corresponding to the above-screened prediction data;
[0179] The predicted data corresponding to the above-screened predicted data with the smallest difference asset value is determined as the processed predicted data.
[0180] Optionally, the processing module 914 processes the N pieces of prediction data according to the processing algorithm to obtain processed prediction data, including:
[0181] Obtain the time-limited submission of oracle data about the above oracle topic from the above oracle contract;
[0182] When the current time reaches the above-mentioned restricted submission time, the above-mentioned N pieces of prediction data are processed according to the above-mentioned processing algorithm to obtain processed prediction data.
[0183] Optionally, the processing module 914 sends the processed prophecy data to a node device corresponding to the second blockchain, including:
[0184] Obtain the data volume corresponding to the predicted data after the above processing;
[0185] If the data volume is greater than the data volume threshold, the processed prophetic data is split to obtain L pieces of prophetic data; L is a positive integer greater than 1;
[0186] Perform a hash operation on the L pieces of prophecy data to obtain the hash values corresponding to the L pieces of prophecy data respectively;
[0187] According to the hash values corresponding to the above-mentioned L pieces of sub-oracle data, a first root hash value for verifying the processed oracle data is generated, and the above-mentioned L pieces of sub-oracle data and the above-mentioned first root hash value are sent to the above-mentioned node device in sequence; the above-mentioned node device is used to execute the smart contract on the above-mentioned second blockchain according to the above-mentioned merged oracle data when the merged oracle data is verified to be valid based on the above-mentioned first root hash value; the above-mentioned merged oracle data is obtained by merging the above-mentioned L pieces of sub-oracle data.
[0188] Optionally, the processing module 914 generates a first root hash value for verifying the processed oracle data according to the hash values corresponding to the L pieces of oracle data, including:
[0189] The L pieces of prophecy data are grouped to obtain P groups; P is a positive integer greater than 1;
[0190] Perform a hash operation again on the hash value corresponding to the sub-oracle data belonging to group i to obtain the hash value corresponding to the above group i; i is a positive integer less than or equal to P;
[0191] According to the hash values corresponding to the above P groups, a first root hash value is generated for verifying the processed prophecy data.
[0192] Optionally, the processing module 914 sends the processed prophecy data to a node device corresponding to the second blockchain, including:
[0193] Performing a hash operation on the processed prophecy data to obtain a hash value of the processed prophecy data;
[0194] Generate a second root hash value for verifying the processed oracle data and the other oracle data according to the hash value of the processed oracle data and the hash value of other oracle data; the other oracle data is the oracle data in the oracle network to be transmitted to the node device;
[0195] The second root hash value, the other oracle data, and the processed oracle data are sent to the node device. The node device is also used to verify that the processed oracle data and the other oracle data are valid based on the second root hash value, and then execute the smart contract on the second blockchain according to the processed oracle data.
[0196] In this application, the credibility of the processed prophecy data is improved by the following two methods: First, multiple oracle nodes participate in the process of obtaining the processed prophecy data, that is, multiple oracle nodes jointly supervise the process of obtaining the processed prophecy data, so as to avoid the problem that a single external device is maliciously attacked during the process of obtaining off-chain data, resulting in the low credibility of the obtained off-chain data. Second, by verifying the validity of the prophecy data obtained by multiple oracle nodes, only when N prophecy data are valid, the N prophecy data are processed, and the processed prophecy data are sent to the node device corresponding to the second blockchain, further, the credibility of the obtained prophecy data is ensured, and the prophecy data with low credibility is avoided from being sent to the node device corresponding to the second blockchain, so as to improve the execution success rate of smart contracts and the security of blockchain.
[0197] See also Fig.10 , is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. Fig.10As shown, the above-mentioned computer device 1000 may refer to a terminal or a server, including: a processor 1001, a network interface 1004 and a memory 1005. In addition, the above-mentioned computer device 1000 may also include: a user interface 1003, and at least one communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. Among them, in some embodiments, the user interface 1003 may include a display screen (DiSPlay), a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or it may be a non-volatile memory (non-volatileMeMory), such as at least one disk storage. The memory 1005 may also be optionally at least one storage device away from the aforementioned processor 1001. As Fig.10 As shown, the memory 1005 as a computer-readable storage medium may include an operating system, a network communication module, a user interface module, and a computer program.
[0198] exist Fig.10 In the computer device 1000 shown, the network interface 1004 can provide a network communication function; the user interface 1003 is mainly used to provide an input interface; and the processor 1001 can be used to call a computer program stored in the memory 1005 to execute:
[0199] Obtain N pieces of oracle data about the oracle subject and attribute information corresponding to the N pieces of oracle data from the oracle contract on the first blockchain; the N pieces of oracle data are off-chain data obtained by at least two oracle nodes in the oracle network, and N is a positive integer greater than 1;
[0200] Verify the validity of the N pieces of prophecy data according to the attribute information respectively corresponding to the N pieces of prophecy data, and obtain a verification result;
[0201] When the verification result indicates that the N pieces of predicted data are valid, a processing algorithm matching the predicted subject is obtained from the oracle contract;
[0202] According to the above processing algorithm, the above N pieces of oracle data are processed to obtain processed oracle data, and the processed oracle data are sent to the node device corresponding to the second blockchain; the above node device is used to execute the smart contract on the above second blockchain according to the above processed oracle data.
[0203] Optionally, the processor 1001 calls a computer program stored in the memory 1005 to execute, according to the attribute information respectively corresponding to the N pieces of prediction data, to verify the validity of the N pieces of prediction data, and obtain a verification result, including:
[0204] According to the attribute information corresponding to the above N pieces of prophecy data, K oracle nodes used to provide the above N pieces of prophecy data are counted; K is a positive integer greater than 1;
[0205] When K is greater than the threshold of the number of oracle nodes, obtain the historical log data corresponding to the above K oracle nodes respectively;
[0206] According to the historical log data corresponding to the above K oracle nodes, the validity of the above N oracle data is verified to obtain the verification result.
[0207] Optionally, the processor 1001 calls a computer program stored in the memory 1005 to execute the historical log data corresponding to the K oracle nodes to verify the validity of the N pieces of oracle data, and obtain a verification result, including:
[0208] According to the historical log data corresponding to the above K oracle nodes, the stability corresponding to the above K oracle nodes is determined;
[0209] Count the number of devices corresponding to the oracle nodes whose stability is greater than the stability threshold among the above K oracle nodes, as well as the total number of devices corresponding to the above K oracle nodes;
[0210] Based on the above number of devices and the above total number of devices, the validity of the above N predicted data is verified to obtain a verification result.
[0211] Optionally, the processor 1001 calls a computer program stored in the memory 1005 to execute, according to the attribute information respectively corresponding to the N pieces of prediction data, to verify the validity of the N pieces of prediction data, and obtain a verification result, including:
[0212] Determine the similarity between each two pieces of the N pieces of prediction data according to the attribute information respectively corresponding to the N pieces of prediction data;
[0213] According to the similarity between each two pieces of the N pieces of prediction data, the total similarity corresponding to the N pieces of prediction data is counted;
[0214] Based on the above total similarity, the validity of the above N predicted data is verified to obtain the verification result.
[0215] Optionally, the processor 1001 calls a computer program stored in the memory 1005 to execute the processing algorithm to process the N pieces of prediction data to obtain the processed prediction data, including:
[0216] Get the generation time corresponding to the above N pieces of prophecy data respectively;
[0217] According to the above processing algorithm, determine the time interval between the generation time corresponding to each of the N pieces of predicted data and the current time;
[0218] From the above N pieces of prediction data, the prediction data whose time interval is less than the time interval threshold are screened out, and the screened prediction data are processed to obtain the processed prediction data.
[0219] Optionally, the above-mentioned prediction data is about the real-time asset value of the item. Optionally, the processor 1001 calls the computer program stored in the memory 1005 to execute processing on the screened prediction data to obtain the processed prediction data, including:
[0220] The real-time asset values corresponding to the above-screened prediction data are averaged to obtain the average asset value;
[0221] The real-time asset value corresponding to the above-screened prediction data is subjected to difference processing with the above-screened average asset value to obtain the difference asset value corresponding to the above-screened prediction data;
[0222] The predicted data corresponding to the above-screened predicted data with the smallest difference asset value is determined as the processed predicted data.
[0223] Optionally, the processor 1001 calls a computer program stored in the memory 1005 to execute the processing algorithm to process the N pieces of prediction data to obtain the processed prediction data, including:
[0224] Obtain the time-limited submission of oracle data about the above oracle topic from the above oracle contract;
[0225] When the current time reaches the above-mentioned restricted submission time, the above-mentioned N pieces of prediction data are processed according to the above-mentioned processing algorithm to obtain processed prediction data.
[0226] Optionally, the processor 1001 calls a computer program stored in the memory 1005 to execute sending the processed oracle data to a node device corresponding to the second blockchain, including:
[0227] Obtain the data volume corresponding to the predicted data after the above processing;
[0228] If the data volume is greater than the data volume threshold, the processed prophetic data is split to obtain L pieces of prophetic data; L is a positive integer greater than 1;
[0229] Perform a hash operation on the L pieces of prophecy data to obtain the hash values corresponding to the L pieces of prophecy data respectively;
[0230] According to the hash values corresponding to the above-mentioned L pieces of sub-oracle data, a first root hash value for verifying the processed oracle data is generated, and the above-mentioned L pieces of sub-oracle data and the above-mentioned first root hash value are sent to the above-mentioned node device in sequence; the above-mentioned node device is used to execute the smart contract on the above-mentioned second blockchain according to the above-mentioned merged oracle data when the merged oracle data is verified to be valid based on the above-mentioned first root hash value; the above-mentioned merged oracle data is obtained by merging the above-mentioned L pieces of sub-oracle data.
[0231] Optionally, the processor 1001 calls a computer program stored in the memory 1005 to execute, according to the hash values corresponding to the L pieces of sub-oracle data, respectively, to generate a first root hash value for verifying the processed oracle data, including:
[0232] The L pieces of prophecy data are grouped to obtain P groups; P is a positive integer greater than 1;
[0233] Perform a hash operation again on the hash value corresponding to the sub-oracle data belonging to group i to obtain the hash value corresponding to the above group i; i is a positive integer less than or equal to P;
[0234] According to the hash values corresponding to the above P groups, a first root hash value is generated for verifying the processed prophecy data.
[0235] Optionally, the processor 1001 calls a computer program stored in the memory 1005 to execute sending the processed oracle data to a node device corresponding to the second blockchain, including:
[0236] Performing a hash operation on the processed prophecy data to obtain a hash value of the processed prophecy data;
[0237] Generate a second root hash value for verifying the processed oracle data and the other oracle data according to the hash value of the processed oracle data and the hash value of other oracle data; the other oracle data is the oracle data in the oracle network to be transmitted to the node device;
[0238] The second root hash value, the other oracle data, and the processed oracle data are sent to the node device. The node device is also used to verify that the processed oracle data and the other oracle data are valid based on the second root hash value, and then execute the smart contract on the second blockchain according to the processed oracle data.
[0239] In this application, the credibility of the processed prophecy data is improved by the following two methods: First, multiple oracle nodes participate in the process of obtaining the processed prophecy data, that is, multiple oracle nodes jointly supervise the process of obtaining the processed prophecy data, so as to avoid the problem that a single external device is maliciously attacked during the process of obtaining off-chain data, resulting in the low credibility of the obtained off-chain data. Second, by verifying the validity of the prophecy data obtained by multiple oracle nodes, only when N prophecy data are valid, the N prophecy data are processed, and the processed prophecy data are sent to the node device corresponding to the second blockchain, further, the credibility of the obtained prophecy data is ensured, and the prophecy data with low credibility is avoided from being sent to the node device corresponding to the second blockchain, so as to improve the execution success rate of smart contracts and the security of blockchain.
[0240] In addition, it should be pointed out here that: the embodiment of the present application also provides a computer-readable storage medium, and the computer-readable storage medium stores a computer program executed by the blockchain data processing device mentioned above, and the computer program includes program instructions. When the processor executes the program instructions, it can execute the description of the blockchain data processing method in the corresponding embodiment above, so it will not be repeated here. In addition, the description of the beneficial effects of the same method will not be repeated. For technical details not disclosed in the computer-readable storage medium embodiment involved in this application, please refer to the description of the method embodiment of this application.
[0241] As an example, the above program instructions may be deployed on a computer device for execution, or deployed on at least two computer devices at one location for execution, or executed on at least two computer devices distributed at at least two locations and interconnected through a communication network. At least two computer devices distributed at at least two locations and interconnected through a communication network may constitute a blockchain network.
[0242] The computer-readable storage medium may be the blockchain data processing device provided in any of the aforementioned embodiments or the central storage unit of the computer device, such as a hard disk or a central storage of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (SMART Media card, SMC), a secure digital (Secure digital, SD) card, a flash memory card (flaSh card), etc. equipped on the computer device. Further, the computer-readable storage medium may also include both the central storage unit of the computer device and an external storage device. The computer-readable storage medium is used to store the computer program and other programs and data required by the computer device. The computer-readable storage medium may also be used to temporarily store data that has been output or is to be output.
[0243] The terms "first", "second", etc. in the description, claims, and drawings of the embodiments of the present application are used to distinguish between contents in different media, rather than to describe a specific order. In addition, the terms "including" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, device, product, or equipment that includes a series of steps or units is not limited to the listed steps or modules, but may optionally include steps or modules that are not listed, or may optionally include other step units inherent to these processes, methods, devices, products, or equipment.
[0244] The collection and processing of relevant data in this application (such as the initial behavioral characteristics corresponding to the user's interaction behavior, and the user's object characteristics, etc.) should be strictly in accordance with the requirements of relevant national laws and regulations when applied in instances, and the informed consent or separate consent of the personal information subject should be obtained. Subsequent data use and processing should be carried out within the scope of authorization of laws and regulations and the personal information subject.
[0245] The embodiment of the present application also provides a computer program product, including a computer program, which, when executed by a processor, implements the description of the blockchain data processing method and decoding method in the corresponding embodiment above, so it will not be repeated here. In addition, the description of the beneficial effects of the same method will not be repeated. For technical details not disclosed in the embodiment of the computer program product involved in this application, please refer to the description of the method embodiment of this application.
[0246] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0247] The method and related apparatus provided by the embodiment of the present application are described with reference to the method flow chart and / or structural diagram provided by the embodiment of the present application. Specifically, each process and / or box in the method flow chart and / or structural diagram, as well as the combination of the processes and / or boxes in the flow chart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable network connection device to generate a machine, so that the instructions executed by the processor of the computer or other programmable network connection device generate instructions for implementing the process in the process. Figure 1 A process or multiple processes and / or structures Figure 1 These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable network-connected device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a product including an instruction device, which implements the functions specified in the process. Figure 1 A process or multiple processes and / or structures Figure 1 These computer program instructions can also be loaded onto a computer or other programmable network connected device, so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide for implementing the process. Figure 1 A flow or multiple flows and / or structures illustrate the steps of the functions specified in one block or multiple blocks.
[0248] The above disclosure is only the preferred embodiment of the present application, which certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.
Claims
1. A blockchain data processing method, characterized in that: include: Obtaining N pieces of oracle data about the oracle subject and attribute information corresponding to the N pieces of oracle data from the oracle contract on the first blockchain; the N pieces of oracle data are off-chain data obtained by at least two oracle nodes in the oracle network, and N is a positive integer greater than 1; Verify the validity of the N pieces of prophecy data according to the attribute information respectively corresponding to the N pieces of prophecy data, and obtain a verification result; When the verification result indicates that the N pieces of predicted data are valid, obtaining a processing algorithm matching the predicted subject from the oracle contract; According to the processing algorithm, the N pieces of oracle data are processed to obtain processed oracle data, and the processed oracle data are sent to a node device corresponding to the second blockchain; the node device is used to execute the smart contract on the second blockchain according to the processed oracle data.
2. The method according to claim 1, characterized in that The verifying the validity of the N pieces of prophecy data according to the attribute information respectively corresponding to the N pieces of prophecy data to obtain the verification result includes: According to the attribute information corresponding to the N pieces of prophecy data, K prophecy machine nodes for providing the N pieces of prophecy data are counted; K is a positive integer greater than 1; When K is greater than the threshold of the number of oracle nodes, obtain the historical log data corresponding to the K oracle nodes respectively; According to the historical log data corresponding to the K oracle nodes respectively, the validity of the N oracle data is verified to obtain a verification result.
3. The method according to claim 2, characterized in that The validating the N pieces of prophecy data according to the historical log data respectively corresponding to the K prophecy machine nodes to obtain the verification result includes: Determine the stability corresponding to the K oracle nodes according to the historical log data corresponding to the K oracle nodes respectively; Count the number of devices corresponding to the oracle nodes whose stability is greater than the stability threshold among the K oracle nodes, and the total number of devices corresponding to the K oracle nodes; According to the number of devices and the total number of devices, the validity of the N pieces of prediction data are verified to obtain a verification result.
4. The method according to claim 1, characterized in that The verifying the validity of the N pieces of prophecy data according to the attribute information respectively corresponding to the N pieces of prophecy data to obtain the verification result includes: Determine the similarity between every two pieces of the N pieces of prophetic data according to the attribute information respectively corresponding to the N pieces of prophetic data; According to the similarity between every two pieces of the N pieces of prediction data, the total similarity corresponding to the N pieces of prediction data is counted; According to the total similarity, the validity of the N pieces of prediction data are verified to obtain a verification result.
5. The method according to claim 1, characterized in that The processing of the N pieces of prophecy data according to the processing algorithm to obtain the processed prophecy data includes: Obtain the generation time corresponding to each of the N pieces of prophecy data; According to the processing algorithm, determine the time interval between the generation time corresponding to each of the N pieces of prophecy data and the current time; From the N pieces of prediction data, prediction data with a time interval less than a time interval threshold are screened out, and the screened prediction data are processed to obtain processed prediction data.
6. The method according to claim 5, characterized in that The predicted data is about the real-time asset value of the item. The screened predicted data is processed to obtain the processed predicted data, including: Averaging the real-time asset values corresponding to the filtered prediction data to obtain an average asset value; Performing a difference processing on the real-time asset value corresponding to the filtered prediction data and the average asset value to obtain a difference asset value corresponding to the filtered prediction data; The predicted data corresponding to the filtered predicted data and having the smallest difference asset value is determined as the processed predicted data.
7. The method according to claim 1, characterized in that The processing of the N pieces of prophecy data according to the processing algorithm to obtain the processed prophecy data includes: Obtaining from the oracle contract a time-limited submission of oracle data about the oracle subject; When the current time reaches the restricted submission time, the N pieces of predicted data are processed according to the processing algorithm to obtain processed predicted data.
8. The method according to claim 1, characterized in that The sending the processed prophecy data to a node device corresponding to the second blockchain includes: Obtaining the data volume corresponding to the processed predicted data; If the data volume is greater than the data volume threshold, the processed prophetic data is split to obtain L pieces of prophetic data; L is a positive integer greater than 1; Performing a hash operation on the L pieces of sub-prophecy data to obtain hash values corresponding to the L pieces of sub-prophecy data respectively; According to the hash values corresponding to the L pieces of sub-oracle data, a first root hash value for verifying the processed oracle data is generated, and the L pieces of sub-oracle data and the first root hash value are sent to the node device in sequence; the node device is used to execute the smart contract on the second blockchain according to the merged oracle data when the validity of the merged oracle data is verified based on the first root hash value; the merged oracle data is obtained by merging the L pieces of sub-oracle data.
9. The method according to claim 8, characterized in that The step of generating a first root hash value for verifying the processed prophecy data according to the hash values corresponding to the L pieces of prophecy data respectively comprises: The L pieces of prophecy data are grouped to obtain P groups; P is a positive integer greater than 1; Perform a hash operation again on the hash value corresponding to the sub-prophecy data belonging to group i to obtain the hash value corresponding to the group i; i is a positive integer less than or equal to P; According to the hash values corresponding to the P groups respectively, a first root hash value for verifying the processed prophecy data is generated.
10. The method according to claim 1, characterized in that The sending the processed prophecy data to a node device corresponding to the second blockchain includes: Performing a hash operation on the processed prophecy data to obtain a hash value of the processed prophecy data; Generate a second root hash value for verifying the processed oracle data and the other oracle data according to the hash value of the processed oracle data and the hash value of the other oracle data; the other oracle data is the oracle data in the oracle network to be transmitted to the node device; The second root hash value, the other oracle data, and the processed oracle data are sent to the node device. The node device is also used to verify based on the second root hash value that the processed oracle data and the other oracle data are both valid, and then execute the smart contract on the second blockchain according to the processed oracle data.
11. A blockchain data processing device, characterized in that: include: A first acquisition module is used to obtain N pieces of prediction data about a prediction subject and attribute information corresponding to the N pieces of prediction data from the prediction contract on the first blockchain; the N pieces of prediction data are off-chain data obtained by at least two prediction nodes in the prediction network, and N is a positive integer greater than 1; A verification module, used to verify the validity of the N pieces of prediction data according to the attribute information respectively corresponding to the N pieces of prediction data, and obtain a verification result; A second acquisition module is used to acquire a processing algorithm matching the predicted subject from the oracle contract when the verification result indicates that the N predicted data are valid; A processing module is used to process the N pieces of oracle data according to the processing algorithm to obtain processed oracle data, and send the processed oracle data to a node device corresponding to the second blockchain; the node device is used to execute the smart contract on the second blockchain according to the processed oracle data.
12. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 10 are implemented.
13. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 10 are implemented.
14. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 10 are implemented.