Data processing method, system, apparatus, device, and storage medium
By using smart contracts in the blockchain system to transfer data processing requests to external computer devices for processing, the problems of high data processing pressure and low efficiency in the blockchain system are solved, and more efficient and reliable data processing is achieved.
Patent Information
- Application Number
- CN202210770957.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-30
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2042-06-30
AI Technical Summary
Blockchain systems face significant data processing pressure and low processing efficiency.
By using smart contracts, node devices in the blockchain system can transfer data processing requests to computer devices outside the blockchain system for processing and reach a consensus on the results, thereby reducing the data processing pressure within the system.
It improves data processing efficiency, reduces the risk of errors, and enhances the accuracy and reliability of data processing.
Smart Images

Figure CN117376371B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to the technical field of computer, and particularly relate to a data processing method, system, device, equipment and storage medium. BACKGROUND
[0002] With the rapid development of blockchain technology, the blockchain technology is widely applied to various businesses. Among them, the node device in the blockchain system can process the data in the blockchain system, such as hash calculation, signature verification and key verification.
[0003] However, due to the large amount of data processing tasks carried by the blockchain system, the data processing pressure is large, and the data processing efficiency is low. SUMMARY
[0004] Embodiments of the present application provide a data processing method, system, device, equipment and storage medium, which can improve the data processing efficiency. The technical solution is as follows:
[0005] On the one hand, a data processing method is provided, which is executed by any node device in a blockchain system, and the node device stores a smart contract; the method comprises:
[0006] obtaining target data, and in a case where a processing mode corresponding to the target data belongs to an off-chain processing mode, generating a data processing request corresponding to the target data, the off-chain processing mode being a processing mode by a computer device outside the blockchain system;
[0007] sending, by the smart contract, the data processing request to the computer device outside the blockchain system, the smart contract being provided with an interface for interacting with the computer device outside the blockchain system, and the computer device being provided with processing resources for processing data for the smart contract;
[0008] receiving a data processing result obtained by the computer device based on the data processing request;
[0009] performing consensus on the data processing result to obtain a first consensus processing result.
[0010] Optionally, the data processing request comprises target data and a target program identifier, and the target program identifier indicates a computing program for processing the target data.
[0011] The sending, by the smart contract, of the data processing request to the computer device outside the blockchain system comprises:
[0012] The smart contract sends the data processing request to the computer device in a case where the target program identifier is identified as a registered program identifier.
[0013] Optionally, the number of computer devices outside the blockchain system is a plurality, the data processing result received by the node device is a data processing result returned by a plurality of computer devices, and the consensus of the data processing result is a first consensus processing result, including:
[0014] The data processing result with the highest number of occurrences in the plurality of data processing results is determined as the first consensus processing result; or,
[0015] The data processing result with the number of occurrences reaching a third threshold in the plurality of data processing results is determined as the first consensus processing result; or,
[0016] The data processing result is a numerical value, and the plurality of data processing results are weighted and fused to obtain the first consensus processing result.
[0017] Optionally, in a case where the processing mode corresponding to the target data belongs to an off-chain processing mode, the data processing request corresponding to the target data is generated, including:
[0018] In a case where the processing mode corresponding to the target data belongs to the off-chain processing mode, a target program identifier corresponding to the processing mode is queried, the target program identifier indicating a computing program for processing the processing mode;
[0019] Based on the target data and the target program identifier, the data processing request is generated.
[0020] On the other hand, a data processing method is provided, which is executed by any computer device outside the blockchain system, and the method includes:
[0021] Receiving a data processing request corresponding to target data sent by a target node device through a smart contract, the target node device being any node device in a plurality of node devices in the blockchain system, the smart contract providing an interface for interacting with a computer device outside the blockchain system, the computer device providing processing resources for processing data for the smart contract, the data processing request being generated by the target node device in a case where a processing mode corresponding to the target data is an off-chain processing mode, the off-chain processing mode being a processing mode performed by a computer device outside the blockchain system;
[0022] Determining a data processing result in response to the data processing request;
[0023] The data processing result is sent to the target node device, which is configured to receive the data processing result sent by the computer device, and to obtain a first consensus processing result by performing consensus on the data processing result.
[0024] Optionally, the data processing request comprises target data and a target program identifier; and the oracle computing device is configured to determine the data processing result in response to the data processing request, comprising:
[0025] The oracle computing device is configured to call a computing program indicated by the target program identifier to process the target data and obtain the data processing result in response to the data processing request.
[0026] Optionally, the oracle control device is configured to send the data processing result to the target node device, comprising:
[0027] The oracle control device is configured to convert the data processing result into a target format supported by the smart contract.
[0028] The oracle control device is configured to send the converted data processing result to a smart contract in the target node device.
[0029] Optionally, the oracle control device is configured to determine the data processing result in response to the data processing request, comprising:
[0030] The data processing request is a hash processing request for target data, and the oracle control device is configured to perform hash processing on the target data and obtain hash data in response to the data processing request; or
[0031] The data processing request is a verification request for target data, and the oracle control device is configured to perform verification on the target data and obtain a verification result in response to the data processing request; or
[0032] The data processing request is an encryption request for target data, and the oracle control device is configured to perform encryption on the target data and obtain encrypted data in response to the data processing request.
[0033] In another aspect, a data processing system is provided, comprising a plurality of node devices in a blockchain system and a computer device outside the blockchain system, the node devices storing a smart contract, the smart contract being provided with an interface for interacting with the computer device outside the blockchain system, and the computer device providing the smart contract with processing resources for processing data.
[0034] A target node device of the plurality of node devices is configured to acquire target data, and generate a data processing request corresponding to the target data in a case where a processing manner corresponding to the target data is an off-chain processing manner, the off-chain processing manner being a processing manner performed by a computer device outside the blockchain system;
[0035] The target node device is further configured to send the data processing request to the computer device through the smart contract.
[0036] The plurality of computer devices are configured to determine a data processing result in response to the data processing request, and return the data processing result to the target node device.
[0037] The target node device is further configured to receive the data processing result returned by the computer device.
[0038] The target node device is further configured to perform consensus on the data processing result to obtain a first consensus processing result.
[0039] In another aspect, a data processing apparatus is provided, which is applied to any node device in a blockchain system, and the node device stores a smart contract; the apparatus comprises:
[0040] A request sending module is configured to acquire target data, and generate a data processing request corresponding to the target data in a case where a processing manner corresponding to the target data is an off-chain processing manner, the off-chain processing manner being a processing manner performed by a computer device outside the blockchain system.
[0041] The request sending module is further configured to send the data processing request to the computer device outside the blockchain system through the smart contract, the smart contract being provided with an interface for interacting with the computer device outside the blockchain system, and the computer device being provided with processing resources for processing data for the smart contract.
[0042] A result receiving module is configured to receive a data processing result obtained by the computer device based on the data processing request.
[0043] A consensus module is configured to perform consensus on the data processing result to obtain a first consensus processing result.
[0044] Optionally, the smart contract comprises a business smart contract and an oracle smart contract, the oracle smart contract being provided with an interface for interacting with the computer device outside the blockchain system, and the computer device being provided with processing resources for processing data for the oracle smart contract; the request sending module is configured to:
[0045] The data processing request is sent to the oracle smart contract through the business smart contract.
[0046] The data processing request is received through the oracle smart contract, and the data processing request is sent to the computer device.
[0047] Optionally, the consensus module comprises:
[0048] The first consensus unit is configured to perform consensus on the data processing result through the oracle smart contract to obtain a second consensus processing result, and send the second consensus processing result to the business smart contract.
[0049] The second consensus unit is configured to receive the second consensus processing result through the business smart contract, perform consensus on the second consensus processing result, and obtain the first consensus processing result.
[0050] Optionally, the number of computer devices outside the blockchain system is a plurality, and the data processing result received by the node device is a plurality of data processing results returned by the computer devices; the consensus module is configured to:
[0051] determine the data processing result with the highest occurrence frequency in the plurality of data processing results as the first consensus processing result; or
[0052] determine the data processing result with the occurrence frequency reaching a third threshold in the plurality of data processing results as the first consensus processing result; or
[0053] The data processing result is a numerical value, and the plurality of data processing results are weighted and fused to obtain the first consensus processing result.
[0054] Optionally, the apparatus further comprises:
[0055] The prediction module is configured to call a data prediction model to predict the target data to obtain a target prediction result, the target prediction result being used to indicate whether the processing mode corresponding to the target data belongs to the off-chain processing mode.
[0056] Optionally, the apparatus further comprises a training module, and the training module is configured to:
[0057] According to historical processing records, obtain positive sample data and corresponding first sample labels, and negative sample data and corresponding second sample labels, the first sample labels indicating that the processing mode corresponding to the positive sample data belongs to the off-chain processing mode, and the second sample labels indicating that the processing mode corresponding to the negative sample data does not belong to the off-chain processing mode;
[0058] invoke the data prediction model to respectively predict the positive sample data and the negative sample data, and obtain a first prediction result and a second prediction result;
[0059] Based on the first sample label and the first prediction result, and the second sample label and the second prediction result, the data prediction model is trained to increase the similarity between the first prediction result obtained by invoking the trained data prediction model and the first sample label, and to increase the similarity between the second prediction result and the second sample label.
[0060] Optionally, the apparatus further comprises a determination module, configured to:
[0061] In a case where the amount of calculation of the target data is greater than a first threshold, it is determined that the processing mode corresponding to the target data belongs to the off-chain processing mode.
[0062] In a case where the data amount of the target data is greater than a second threshold, it is determined that the processing mode corresponding to the target data belongs to the off-chain processing mode.
[0063] In a case where the business party to which the target data belongs is a target business party, it is determined that the processing mode corresponding to the target data belongs to the off-chain processing mode.
[0064] In a case where the data type of the target data belongs to a preset data type, it is determined that the processing mode corresponding to the target data belongs to the off-chain processing mode.
[0065] Optionally, the request sending module is configured to:
[0066] In a case where the processing mode corresponding to the target data belongs to the off-chain processing mode, the target program identifier corresponding to the processing mode is queried, the target program identifier indicating a calculation program used for processing of the processing mode.
[0067] Based on the target data and the target program identifier, the data processing request is generated.
[0068] Optionally, the data processing request comprises target data and a target program identifier, the target program identifier indicating a calculation program used for processing of the target data.
[0069] The request sending module is configured to, in a case where the target program identifier is a registered program identifier, send the data processing request to the computer device.
[0070] On the other hand, a data processing apparatus is provided, which is applied to any computer device outside a block chain system, and the apparatus comprises:
[0071] The request receiving module is configured to receive a data processing request corresponding to target data sent by a target node device through a smart contract, the target node device being any one of a plurality of node devices in the blockchain system, the smart contract being provided with an interface for interacting with a computer device outside the blockchain system, the computer device being provided with a processing resource for processing data for the smart contract, the data processing request being generated by the target node device in a case where a processing mode corresponding to the target data is an off-chain processing mode, the off-chain processing mode being a processing mode performed by the computer device outside the blockchain system.
[0072] The processing module is configured to determine a data processing result in response to the data processing request.
[0073] The result sending module is configured to send the data processing result to the target node device, and the target node device is configured to receive the data processing result sent by the computer device, and perform consensus on the data processing result to obtain a first consensus processing result.
[0074] Optionally, the computer device includes an oracle control device and an oracle computing device; the request receiving module in the oracle control device is configured to receive the data processing request.
[0075] The processing module includes a first sending unit in the oracle control device and a processing unit in the oracle computing device; the first sending unit is configured to send the data processing request to the oracle computing device; and the processing unit is configured to determine the data processing result in response to the data processing request.
[0076] The result sending module includes a second sending unit in the oracle computing device and a third sending unit in the oracle control device; the second sending unit is configured to send the data processing result to the oracle control device; and the third sending unit is configured to send the data processing result to the target node device.
[0077] Optionally, the data processing request includes target data and a target program identifier; and the processing unit is configured to call a computing program indicated by the target program identifier to process the target data to obtain the data processing result in response to the data processing request.
[0078] Optionally, the third sending unit is configured to:
[0079] convert the data processing result into a target format, the target format being a format supported by the smart contract;
[0080] send the converted data processing result to a smart contract in the target node device.
[0081] Optionally, the computer device stores an external processing interface provided by another device other than the computer device, and the processing module is configured to, in response to the data processing request, invoke the external processing interface to process the target data to obtain the data processing result.
[0082] Optionally, the processing module is configured to:
[0083] The data processing request is a hash processing request for target data, and in response to the data processing request, the target data is subjected to hash processing to obtain hash data; or
[0084] The data processing request is a verification request for target data, and in response to the data processing request, the target data is subjected to verification to obtain a verification result; or
[0085] The data processing request is an encryption request for target data, and in response to the data processing request, the target data is subjected to encryption to obtain encrypted data.
[0086] In another aspect, a computer device is provided, which includes a processor and a memory, and the memory stores at least one computer program, which is loaded and executed by the processor to implement the operations performed by the data processing method according to the above aspect.
[0087] In another aspect, a computer readable storage medium is provided, which stores at least one computer program, which is loaded and executed by a processor to implement the operations performed by the data processing method according to the above aspect.
[0088] In another aspect, a computer program product is provided, which includes a computer program, which is loaded and executed by a processor to implement the operations performed by the data processing method according to the above aspect.
[0089] In the embodiments of the present application, in the case where off-chain processing of target data is required, a node device in a blockchain system requests a computer device outside the blockchain system to process a data processing request corresponding to the target data through a smart contract, so that the data processing request is transferred from the blockchain system to the outside of the blockchain system for processing, thereby reducing the data processing pressure of the blockchain system and facilitating the improvement of data processing efficiency. Moreover, the data processing result processed by the computer device is subjected to consensus by the node device to obtain a consensus processing result, thereby reducing the error risk and improving the accuracy and credibility of data processing. BRIEF DESCRIPTION OF DRAWINGS
[0090] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative effort on the basis of these drawings.
[0091] Figure 1 is a schematic diagram of an implementation environment of a data processing method provided by the embodiments of the present application;
[0092] Figure 2 is a structural schematic diagram of a blockchain system provided by the embodiments of the present application;
[0093] Figure 3 is a schematic diagram of a block structure provided by the embodiments of the present application;
[0094] Figure 4 is a flowchart of a data processing method provided by the embodiments of the present application;
[0095] Figure 5 is a flowchart of another data processing method provided by the embodiments of the present application;
[0096] Figure 6 is a flowchart of another data processing method provided by the embodiments of the present application;
[0097] Figure 7 is a flowchart of another data processing method provided by the embodiments of the present application;
[0098] Figure 8 is a flowchart of another data processing method provided by the embodiments of the present application;
[0099] Figure 9 is a flowchart of another data processing method provided by the embodiments of the present application;
[0100] Figure 10 is a flowchart of another data processing method provided by the embodiments of the present application;
[0101] Figure 11 is a flowchart of another data processing method provided by the embodiments of the present application;
[0102] Figure 12 is a structural schematic diagram of a data processing device provided by the embodiments of the present application;
[0103] Figure 13 is a structural schematic diagram of another data processing device provided by the embodiments of the present application;
[0104] Figure 14 FIG. 3 is a structural schematic diagram of another data processing apparatus provided by an embodiment of the present application;
[0105] Figure 15 FIG. 3 is a structural schematic diagram of another data processing apparatus provided by an embodiment of the present application;
[0106] Figure 16 FIG. 4 is a structural schematic diagram of a terminal provided by an embodiment of the present application;
[0107] Figure 17 FIG. 5 is a structural schematic diagram of a server provided by an embodiment of the present application. DETAILED DESCRIPTION
[0108] In order to make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the following will further describe the embodiments of the present application with reference to the accompanying drawings.
[0109] It can be understood that the terms "first", "second", and the like used in the present application can be used herein to describe various concepts, but unless specifically stated, these concepts are not limited by these terms. These terms are only used to distinguish one concept from another concept. For example, without departing from the scope of the present application, a first prediction result can be referred to as a second prediction result, and similarly, a second prediction result can be referred to as a first prediction result.
[0110] Wherein, at least one refers to one or more than one, for example, at least one node device can be one node device, two node devices, three node devices, or any integer greater than or equal to one node device. A plurality of refers to two or more than two, for example, a plurality of node devices can be two node devices, three node devices, or any integer greater than or equal to two node devices. Each refers to each of at least one, for example, each node device refers to each node device in a plurality of node devices, if the plurality of node devices is 3 node devices, each node device refers to each node device in the 3 node devices.
[0111] It can be understood that in the embodiments of the present application, data related to user information and the like are involved, when the above embodiments of the present application are applied to specific products or technologies, the user's permission or consent is required, and the collection, use and processing of related data need to comply with relevant laws, regulations and standards of relevant countries and regions.
[0112] In order to facilitate the understanding of the embodiments of the present application, the following related terms are explained first:
[0113] 1. Blockchain: A novel application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and cryptographic algorithms. Essentially, a blockchain is a decentralized database, a chain of data blocks linked together using cryptographic methods. Each block contains information about a network transaction, used to verify the validity of the information (anti-counterfeiting) and generate the next block. Each block contains a timestamp and a link to the previous block. In a narrow sense, blockchain is a chain-like data structure that combines data blocks sequentially according to time, and is a distributed ledger that is cryptographically guaranteed to be immutable and unforgeable; that is, data in a blockchain is irreversible once recorded.
[0114] 2. Smart Contract: A smart contract is a computer protocol designed to disseminate, verify, or execute contracts in an informational manner. In a blockchain system, each node automatically executes a contract program based on specific conditions. It can manipulate data stored on the chain and is a crucial way for users to interact with the blockchain and utilize it to implement business logic. The purpose of smart contracts is to provide a more secure method than traditional contracts and reduce other transaction costs associated with contracts. It allows for trusted transactions without a third party, and these transactions are traceable and irreversible.
[0115] 3. Oracles are mechanisms for writing data from outside the blockchain into the blockchain. They can be mainly classified in the following ways: (1) The source of the data source is software, hardware, or people; (2) The flow of data: from the contract to the outside world or from the outside world to the contract; (3) Trust: centralized or decentralized oracle.
[0116] Oracles can be categorized into several types according to the above classifications. For example, if an oracle's data comes from an online website, according to the above classifications, the oracle's data source is software, the oracle's data flow is from the external world to the contract, and the oracle is a centralized oracle.
[0117] (1) Software Oracle: Software oracles obtain data sources through online software. The data sources may be databases, services, websites, or network data. For example, they may obtain exchange rates, digital asset prices, or real-time flight information from the network.
[0118] (2) Hardware Oracle: Hardware oracles obtain data sources through hardware devices. The data sources may be electronic sensors, IoT (Internet of Things) devices, QR codes, robots or other information reading devices. Hardware oracles are crucial for “translating” information in the real world so that this information can be understood by smart contracts.
[0119] (3) Human Oracle: Human Oracle is a kind of oracle that uses people with specific knowledge or skills as oracles, who can convert various information in the real world into a format that smart contracts can understand. The data source is people with specific knowledge or skills. Human Oracle can not only reply to some deterministic data information, but also to some uncertain information, such as "whether team A can defeat team B".
[0120] (4) Computing Oracle: Computing Oracle is a kind of oracle that uses specific computing programs off-chain as oracles, and the data source is specific computing programs off-chain. Some complex calculations consume a lot of resources on-chain, so intensive calculations are moved to off-chain oracles, and on-chain contracts only get the results of computing oracles.
[0121] (5) Input or Output Oracle: Input Oracle converts external world data into smart contracts, and Input Oracle transmits smart contract data to the external world. For example, Input Oracle transmits the environmental temperature obtained by a sensor to a smart contract, and Output Oracle transmits the payment result of on-chain funds to an external machine to unlock a smart lock.
[0122] (6) Specific Contract Oracle: Specific Contract Oracle is a kind of oracle customized for smart contracts, and the data source is a specific oracle that only serves this smart contract and can meet the specific data needs of different smart contracts.
[0123] (7) Consensus Oracle: Consensus Oracle is a kind of oracle that obtains data sources from multiple parties, and the data source is the result of consensus among multiple parties. Consensus Oracle reduces security risks by increasing the number of participants.
[0124] 4. Sub-chain expansion scheme: The main blockchain expansion scheme on the blockchain is a centralized sub-chain expansion scheme and a decentralized sub-chain expansion scheme based on zero-knowledge proof. The centralized sub-chain expansion scheme is to use a third party to package and submit the transaction proof on the sub-chain to the main chain (block header, etc.). The decentralized sub-chain expansion scheme based on zero-knowledge proof generates a proof by running the transaction process of the sub-chain through a zero-knowledge proof algorithm, and submits it to the main chain for verification. If the verification is passed, the transaction of the sub-chain can be anchored to the main chain, realizing the authentication process of the main chain to the sub-chain transaction.
[0125] Figure 1 An implementation environment of a data processing method provided by an embodiment of the present application is shown in the schematic diagram Figure 1The implementation environment includes a plurality of node devices 101 (two node devices are taken as examples in the figure) in a blockchain system and a plurality of computer devices 102 (two computer devices are taken as examples in the figure) outside the blockchain system, which can be oracle devices. Any node device 101 in the blockchain system and any computer device 102 outside the blockchain system can execute one or more steps of the data processing method provided in the embodiments of the present application.
[0126] Each node device 101 stores a smart contract, and the node device 101 obtains target data to be processed through the smart contract. In the case that the target data needs to be processed off-chain, the node device 101 generates a data processing request corresponding to the target data and sends the data processing request to at least one computer device 102 outside the blockchain system. Each computer device 102 determines a data processing result in response to the data processing request and returns the data processing result to the smart contract in the node device 101. The node device 101 further performs consensus on the received plurality of data processing results through the smart contract to obtain a consensus processing result.
[0127] In a possible implementation manner, the node device 101 or the computer device 102 can be a server. The server can be a physical server, a server cluster composed of a plurality of physical servers, or a distributed system. The server can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. In another possible implementation manner, the node device 101 or the computer device 102 can be a terminal. The terminal can be a smartphone, a tablet computer, a notebook computer, or a desktop computer.
[0128] Referring to Figure 2 , Figure 2 is a structural schematic diagram of a blockchain system provided in the embodiments of the present application. The blockchain system includes a plurality of node devices and terminals, and the terminals are connected to the node devices. A point-to-point (P2P, Peer To Peer) network is formed between the node devices. The P2P protocol is an application layer protocol running on the transmission control protocol (TCP, Transmission Control Protocol). In the blockchain system, any computing device such as a server or a terminal can join and become a node device.
[0129] The functions involved by the node devices in the blockchain system include:
[0130] 1) Routing, a basic function of a node device, used to support communication between node devices.
[0131] In addition to the routing function, the node device can also have the following functions:
[0132] 2) Application, used to be deployed in the blockchain, to implement specific business according to actual business needs, record data related to the implementation function to form record data, carry a digital signature in the record data to represent the source of the task data, send the record data to other node devices in the blockchain system, and add the record data to the temporary block when the other node devices verify the source and integrity of the record data successfully.
[0133] Referring to Figure 3 , Figure 3 is a schematic diagram of a block structure provided by an embodiment of the present application, each block includes a hash value of a transaction record stored in the block (the hash value of the block) and a hash value of a previous block, and each block is connected by a hash value to form a blockchain. In addition, the block can also include information such as a timestamp when the block is generated.
[0134] The data processing method provided by the embodiment of the present application can be applied to any scenario that needs to process data in the blockchain system.
[0135] For example, the embodiment of the present application is applied to a scenario of encrypting data. When the node device in the blockchain system obtains target data through a smart contract, if it is necessary to encrypt the target data, the smart contract sends an encryption request for the target data to a computer device outside the blockchain system, and then the computer device encrypts the target data to obtain an encryption result and returns the encryption result to the smart contract in the node device. Therefore, the node device can receive the encryption result sent by the computer device through the smart contract, and then the node device performs consensus on the received encryption result through the smart contract, thereby obtaining a consensus encryption result, and taking the consensus encryption result as the encryption result corresponding to the target data. In this scenario, the node device transfers the encryption task in the blockchain system to outside the blockchain, thereby reducing the data processing pressure of the blockchain system, and by performing consensus on the encryption result of the computer device through the node device, the accuracy and credibility of the final consensus encryption result can also be ensured.
[0136] Figure 4 is a flowchart of a data processing method provided by an embodiment of the present application, which is executed by any node device in the blockchain system, and the node device stores a smart contract, referring to Figure 4 , the method comprises:
[0137] 401、The node device obtains target data, and generates a data processing request corresponding to the target data in a case where a processing manner corresponding to the target data belongs to an off-chain processing manner.
[0138] The target data can be data sent to the node device by other devices, or data submitted by a user of the node device, or data generated when the smart contract processes according to business processing logic. After the node device obtains the target data, the node device determines whether a processing manner corresponding to the target data is an off-chain processing manner. The processing manner corresponding to the target data refers to a manner used to process the target data, and the off-chain processing manner refers to processing by a computer device outside the blockchain system.
[0139] If the processing manner corresponding to the target data belongs to the off-chain processing manner, it is indicated that the computer device needs to be requested to process the target data, and therefore the node device generates the data processing request corresponding to the target data. The data processing request includes the target data, and the data processing request is used to request processing of the target data.
[0140] 402、The node device sends, through the smart contract, the data processing request to the computer device outside the blockchain system.
[0141] The blockchain system includes a plurality of node devices. The blockchain system can be a consortium chain system, a public chain system, or a private chain system. In addition, there is a computer device outside the blockchain system, which does not belong to the devices in the blockchain system. The node device in the blockchain system stores a smart contract. The smart contract provides an interface for interacting with the computer device outside the blockchain system. The computer device provides processing resources for the smart contract to process data. For example, the smart contract includes an oracle smart contract, the computer device outside the blockchain is an oracle device, the oracle smart contract provides an interface for interacting with the oracle device, and the oracle device provides processing resources for the oracle smart contract to process data.
[0142] The node device sends the data processing request to the computer device outside the blockchain through the smart contract to request the computer device to process the target data. Alternatively, the node device broadcasts the data processing request to the computer device outside the blockchain system. The computer device outside the blockchain system periodically or in real time detects the data processing request sent by the node device in the blockchain system.
[0143] 403、The node device receives data processing results obtained by the computer device based on the data processing request.
[0144] The computer device, after obtaining the data processing request sent by the node device, processes based on the data processing request to obtain a data processing result, and returns the data processing result to the smart contract of the node device, so that the node device can receive the data processing result of the computer device.
[0145] 404、The node device performs consensus on the data processing result to obtain a first consensus processing result.
[0146] After obtaining the data processing result of the computer device, the node device performs consensus on the data processing result to obtain a first consensus processing result, and takes the consensus processing result as the final processing result corresponding to the data processing request, thereby ensuring the reliability of data processing by performing consensus on the data processing result provided outside the blockchain system.
[0147] In the method provided by the embodiments of the present application, in the case of needing to perform off-chain processing on the target data, the node device in the blockchain system requests the computer device outside the blockchain system to process the data processing request corresponding to the target data through the smart contract, thereby transferring the data processing request from inside the blockchain system to outside the blockchain system for processing, reducing the data processing pressure of the blockchain system, and being conducive to improving the data processing efficiency. Moreover, the data processing result processed by the computer device is subjected to consensus by the node device to obtain a consensus processing result, thereby reducing the error risk and improving the accuracy and credibility of data processing.
[0148] Figure 5 is a flowchart of another data processing method provided by the embodiments of the present application, which is executed by any computer device outside the blockchain system, and the method comprises the following steps of Figure 5
[0149] 501、The computer device receives a data processing request corresponding to target data sent by a target node device through a smart contract, the target node device being any node device in a plurality of node devices in the blockchain system.
[0150] The data processing request is generated by the target node device in the case that the processing mode corresponding to the target data is an off-chain processing mode, and the off-chain processing mode refers to processing by a computer device outside the blockchain system. The node device in the blockchain system stores a smart contract, the smart contract provides an interface for interacting with the computer device outside the blockchain system, the computer device provides processing resources for processing data for the smart contract, and the computer device outside the blockchain system receives the data processing request sent by the target node device through the smart contract, the data processing request being used to request the computer device to process data. The process of the target node device sending the data processing request to the computer device through the smart contract is described in the above Figure 4 The illustrated embodiment.
[0151] Optionally, the computer device periodically or in real time detects a data processing request sent by each node device in the blockchain system, and when the target node device broadcasts a data processing request to multiple computer devices, the computer device can detect the data processing request.
[0152] 502, the computer device determines the data processing result in response to the data processing request.
[0153] The data processing request includes target data, and the computer device processes the target data in response to the data processing request to obtain the data processing result. The data processing request can be any type of data processing request, and the processing of the target data can be any type of processing.
[0154] 503, the computer device sends the data processing result to the target node device, and the target node device receives the data processing result sent by the computer device, and performs consensus on the data processing result to obtain a first consensus processing result.
[0155] In the method provided by the embodiment of the application, when the target data needs to be processed off-chain, the node device in the blockchain system requests the computer device outside the blockchain system to process the data processing request corresponding to the target data through the smart contract, so that the data processing request is transferred from the blockchain system to the outside of the blockchain system for processing, thereby reducing the data processing pressure of the blockchain system and improving the data processing efficiency. And, the data processing result processed by the computer device is consensus by the node device to obtain a consensus processing result, which reduces the error risk and improves the accuracy and reliability of data processing.
[0156] On the basis of the above Figure 4 and Figure 5 On the basis of the above Figure 6 illustrated embodiment.
[0157] Figure 6 is another flowchart of a data processing method provided by the embodiment of the application, which is executed by the node device in the blockchain system and the computer device outside the blockchain system, and the method is described in detail with reference to Figure 6 , which comprises:
[0158] 601, the node device obtains target data.
[0159] The target data can be data sent to the node device by other devices, data submitted by a user of the node device, or target data generated when the smart contract is processed according to business processing logic. Embodiments of the present application do not limit the source of the target data.
[0160] The target data can be any type of data, such as video data, voice data, picture data, text data, or table data. Embodiments of the present application do not limit the type of target data. Optionally, the target data is obtained by the node device through the smart contract.
[0161] 602、The node device determines whether the processing mode corresponding to the target data belongs to an off-chain processing mode.
[0162] After the node device obtains the target data, it determines whether the processing mode corresponding to the target data is an off-chain processing mode. The processing mode corresponding to the target data refers to the mode used to process the target data, and the off-chain processing mode refers to processing by a computer device outside the blockchain system.
[0163] In one possible implementation, the node device determines that the processing mode corresponding to the target data belongs to an off-chain processing mode when the attribute information of the target data satisfies the intensive condition. The attribute information of the target data includes at least one of the calculation amount, the data amount, the business party to which it belongs, and the data type. The method includes the following four modes.
[0164] (1) The node device determines that the processing mode corresponding to the target data belongs to an off-chain processing mode when the calculation amount of the target data is greater than a first threshold.
[0165] If the calculation amount of the target data is greater than the first threshold, it means that the target data needs intensive calculation and will consume a lot of processing resources. In order to reduce the data processing pressure of the blockchain system, the target data can be classified as off-chain processing, so that the computer device outside the blockchain system assists the node device in the blockchain system to process the target data. Therefore, when the calculation amount of the target data is greater than the first threshold, it is determined that the processing mode corresponding to the target data belongs to an off-chain processing mode, and when the calculation amount of the target data is not greater than the first threshold, it is determined that the processing mode corresponding to the target data does not belong to an off-chain processing mode.
[0166] Intensive calculation refers to a calculation with a large amount of calculation, such as hash processing, signature, signature verification, and cryptography algorithms.
[0167] (2) The node device determines that the processing mode corresponding to the target data belongs to an off-chain processing mode when the data amount of the target data is greater than a second threshold.
[0168] If the data amount of the target data is greater than the second threshold value, it indicates that processing the target data will consume more processing resources, in order to reduce the data processing pressure of the blockchain system, the target data can be classified as off-chain processing, so that the computer device outside the blockchain system assists the node device in the blockchain system to process the target data. Therefore, in the case where the data amount of the target data is greater than the second threshold value, it is determined that the processing mode corresponding to the target data belongs to the off-chain processing mode, and in the case where the data amount of the target data is greater than the second threshold value, it is determined that the processing mode corresponding to the target data does not belong to the off-chain processing mode.
[0169] (3) The node device determines that the processing mode corresponding to the target data belongs to the off-chain processing mode in the case where the business party to which the target data belongs is the target business party.
[0170] In the embodiments of the present application, the processing mode corresponding to the data can be divided according to the business party, for example, in the case where the business party has off-chain processing needs, the business party is set as the target business party, so that the data of the business party is set as the off-chain processing mode. In the case where the business party does not have off-chain processing needs, the data of the business party is classified as on-chain processing, that is, processed by the node device in the blockchain system. Therefore, in the case where the business party to which the target data belongs is the target business party, it is determined that the processing mode corresponding to the target data belongs to the off-chain processing mode, and in the case where the business party to which the target data belongs is not the target business party, it is determined that the processing mode corresponding to the target data does not belong to the off-chain processing mode.
[0171] (4) The node device determines that the processing mode corresponding to the target data belongs to the off-chain processing mode in the case where the data type of the target data belongs to the preset data type.
[0172] In the embodiments of the present application, the processing mode corresponding to the data can be divided according to the data type, and the node device can flexibly set which data type of data is processed off-chain and which data type of data is processed on-chain. The data type that needs to be processed off-chain is determined as the preset data type. Therefore, in the case where the data type of the target data belongs to the preset data type, it is determined that the processing mode corresponding to the target data belongs to the off-chain processing mode, and in the case where the data type of the target data does not belong to the preset data type, it is determined that the processing mode corresponding to the target data does not belong to the off-chain processing mode.
[0173] In another possible implementation, the node device calls a data prediction model to predict the target data to obtain a target prediction result, and the target prediction result is used to indicate whether the processing mode corresponding to the target data belongs to the off-chain processing mode.
[0174] The data prediction model is stored in the node device, for example, the data prediction model is included in a smart contract stored in the node device, and the data prediction model is used to predict whether a processing manner corresponding to data is an off-chain processing manner. Therefore, the node device inputs the target data into the data prediction model, and the data prediction model predicts the target data, so as to obtain a target prediction result corresponding to the target data. In the embodiment of the present application, whether the processing manner corresponding to the target data belongs to the off-chain processing manner is predicted by the data prediction model, which simplifies the processing logic and is beneficial to improving the efficiency of data processing.
[0175] Optionally, the training process of the data prediction model includes the following steps 6021-6023:
[0176] 6021、According to the historical processing record, obtain positive sample data and corresponding first sample label, and negative sample data and corresponding second sample label, the first sample label indicates that the processing manner corresponding to the positive sample data belongs to the off-chain processing manner, and the second sample label indicates that the processing manner corresponding to the negative sample data does not belong to the off-chain processing manner.
[0177] The node device stores a historical processing record, and the historical processing record includes historical data that has been processed and a label corresponding to each historical data, the label corresponding to the historical data indicates whether the processing manner corresponding to the historical data belongs to the off-chain processing manner. Therefore, according to the historical processing record, the positive sample data and the negative sample data are obtained in the historical data, and the first sample label corresponding to the positive sample data and the second sample label corresponding to the negative sample data are obtained. The positive sample data is historical data whose processing manner belongs to the off-chain processing manner, and the negative sample data is historical data whose processing manner does not belong to the off-chain processing manner.
[0178] 6022、Call the data prediction model to predict the positive sample data and the negative sample data respectively, and obtain the first prediction result and the second prediction result.
[0179] The first prediction result indicates whether the processing manner corresponding to the positive sample data predicted by the data prediction model belongs to the off-chain processing manner, and the second prediction result indicates whether the processing manner corresponding to the negative sample data predicted by the data prediction model belongs to the off-chain processing manner.
[0180] 6023、Based on the first sample label and the first prediction result, and the second sample label and the second prediction result, train the data prediction model, so that the similarity between the first prediction result obtained by calling the trained data prediction model and the first sample label increases, and the similarity between the second prediction result obtained and the second sample label increases.
[0181] The higher the similarity between the first prediction result and the first sample label and the higher the similarity between the second prediction result and the second sample label, the more accurate the result predicted by the data prediction model is. Therefore, by training the data prediction model, the similarity between the first prediction result obtained by calling the trained data prediction model and the first sample label is increased, and the similarity between the second prediction result and the second sample label is increased, which can improve the prediction ability of the data prediction model and enable the data prediction model to learn how to distinguish data that needs to be processed off-chain and data that does not need to be processed off-chain.
[0182] 603、In a case where the processing mode corresponding to the target data belongs to the off-chain processing mode, the node device generates a data processing request corresponding to the target data.
[0183] If the processing mode corresponding to the target data belongs to the off-chain processing mode, it means that the computer device needs to be requested to process the target data. Therefore, the node device generates a data processing request corresponding to the target data, and the data processing request includes the target data. The data processing request is used to request processing of the target data.
[0184] In a possible implementation, in a case where the processing mode corresponding to the target data belongs to the off-chain processing mode, the node device queries a target program identifier corresponding to the processing mode, the target program identifier indicates a computing program used to perform processing of the processing mode, and generates a data processing request based on the target data and the target program identifier.
[0185] The data processing request includes the target data and the target program identifier. For example, the processing mode corresponding to the target data is encryption, and the target program identifier corresponding to the processing mode indicates a computing program used to perform encryption. For example, the processing mode corresponding to the target data is hash processing, and the target program identifier corresponding to the processing mode indicates a computing program used to perform hash processing.
[0186] In the embodiments of the present application, the target program identifier is carried in the data processing request, which facilitates the computer device to subsequently find a computing program used to process the target data according to the target program identifier, and improves the efficiency of data processing.
[0187] In a possible implementation, the node device executes the above steps 602-603 through a smart contract.
[0188] 604、The node device sends the data processing request to the computer device outside the blockchain system through the smart contract.
[0189] The smart contract is provided with an interface for interacting with the computer device outside the blockchain system, and the computer device is provided with processing resources for processing data for the smart contract.
[0190] In a possible implementation, the data processing request comprises target data and a target program identifier, and the target program identifier indicates a computing program for processing the target data. The node device sends the data processing request to the computer device through the smart contract if the target program identifier is a registered program identifier.
[0191] In this way, after obtaining the data processing request, the node device determines whether the target program identifier in the data processing request is a registered program identifier through the smart contract. If the target program identifier is a registered program identifier, it indicates that the computer device can process the data processing request, and the node device sends the data processing request to the computer device. If the target program identifier is not a registered program identifier, it indicates that the computer device cannot process the data processing request, and the node device does not need to send the data processing request to the computer device.
[0192] It should be noted that the above steps 602-604 are described by taking the example of first determining whether the processing mode belongs to an off-chain processing mode, and then generating a data processing request and sending it to the computer device if the processing mode belongs to the off-chain processing mode. In another embodiment, the node device directly processes according to the current business processing logic. If the processing mode corresponding to the target data belongs to an off-chain processing mode, the processing function corresponding to the target data is a request sending interface. Therefore, the node device directly calls the request sending interface to generate a data processing request and sends it to the computer device, without the need to determine whether the processing mode corresponding to the target data belongs to an off-chain processing mode.
[0193] 605、The computer device receives the data processing request sent by the node device through the smart contract.
[0194] 606、The computer device determines a data processing result in response to the data processing request.
[0195] The data processing request comprises target data, and the computer device processes the target data in response to the data processing request to obtain the data processing result.
[0196] In a possible implementation, the computer device determines the data processing result in response to the data processing request, including the following three ways.
[0197] (1) The data processing request is a hash processing request for target data, and the computer device performs hash processing on the target data in response to the data processing request to obtain hash data.
[0198] (2) The data processing request is a verification request for the target data, and the computer device verifies the target data in response to the data processing request to obtain a verification result.
[0199] (3) The data processing request is an encryption request for the target data, and the computer device encrypts the target data in response to the data processing request to obtain encrypted data.
[0200] In addition, the data processing request can also be other types of processing requests, such as a model training request or a data repair request, etc. The model training request is used to request training of an artificial intelligence model. The data repair request is used to request repair of erroneous data, etc.
[0201] In a possible implementation, the computer device stores an external processing interface, and the computer device invokes the external processing interface to process the target data in response to the data processing request to obtain the data processing result.
[0202] The external processing interface is provided by other devices other than the computer device. The computer device invokes the external processing interface to trigger the device providing the external processing interface to process the target data in the data processing request, thereby obtaining the data processing result. For example, the external processing interface is provided by a server corresponding to a third-party data website, or the external processing interface is provided by a sensor of an Internet of Things device, etc.
[0203] In different application scenarios, the functions of the external processing interface are also different. For example, in the case of predicting weather data, the target data can be historical weather data, the data processing request can be a weather data prediction request based on the historical weather data, and the external processing interface has the function of predicting future weather data based on historical weather data.
[0204] 607. The computer device sends the data processing result to the node device.
[0205] In a possible implementation, the computer device sends the data processing result to a smart contract in the node device.
[0206] 608. The node device receives the data processing result obtained by the computer device based on the data processing request.
[0207] 609. The node device performs consensus on the data processing result to obtain a first consensus processing result.
[0208] The node device obtains a data processing result of the computer device, and performs consensus on the data processing result to obtain a first consensus processing result, and takes the first consensus processing result as a final processing result corresponding to the data processing request. After obtaining the first consensus processing result, the node device continues to process the first consensus processing result according to the business processing logic in the blockchain system through the smart contract, for example, adds the first consensus processing result to the blockchain in the blockchain system.
[0209] In the embodiments of the present application, the data processing request is processed by the computer device, and the data processing result is consensus by the node device to obtain a consensus processing result, which reduces the risk of error and the risk of tampering data by the computer device, and improves the accuracy and reliability of data processing.
[0210] In addition, the smart contract in the node device provides an interface for interacting with the computer device outside the blockchain system, which is equivalent to providing a bridge for connecting the node device in the blockchain system with the computer device outside the blockchain system, so that data outside the blockchain system can be input into the blockchain system, reducing the data processing pressure and execution complexity in the blockchain system, without the need to increase new node devices in the blockchain system, which can achieve the effect of expanding the blockchain system to a certain extent, simplifies the system architecture of data processing, and expands the function of the blockchain system.
[0211] In a possible implementation manner, the node device executes steps 608-609 through the smart contract.
[0212] The method provided in the embodiments of the present application can be used to process target data off-chain. The node device in the blockchain system requests the computer device outside the blockchain system to process the data processing request corresponding to the target data through the smart contract, so that the data processing request is transferred from the blockchain system to the outside of the blockchain system for processing, reducing the data processing pressure of the blockchain system and improving the data processing efficiency. In addition, the data processing result processed by the computer device is consensus by the node device to obtain a consensus processing result, which reduces the risk of error, improves the accuracy and reliability of data processing.
[0213] In addition, the data is determined whether to be processed off-chain according to the calculation amount or the size of the data amount, so that in the case that the calculation amount or the data amount of the data is large, the computer device outside the blockchain system is requested to assist the node device inside the blockchain system to process the data, effectively reducing the data processing pressure of the blockchain system.
[0214] Furthermore, the processing method determines whether data needs to be processed off-chain based on the business party or data type to which the data belongs. This allows node devices to flexibly configure which business parties' data or which data types are processed off-chain, thus improving the flexibility of data processing.
[0215] Furthermore, by using a data prediction model to predict whether the processing method corresponding to the target data belongs to the off-chain processing method, the processing logic of smart contracts is simplified, which helps to improve the efficiency of data processing.
[0216] Furthermore, by including the target program identifier in the data processing request, subsequent computer devices can easily locate the computing program used to process the target data based on the target program identifier, thereby improving the efficiency of data processing.
[0217] Based on the above embodiments, the smart contract includes a business smart contract and an oracle smart contract. The node device uses the interaction between the business smart contract and the oracle smart contract to send data processing requests and receive data processing results. See the following for details. Figure 7 The example shown.
[0218] Figure 7 This is a flowchart of another data processing method provided in this application embodiment. This application embodiment is executed by node devices in the blockchain system and computer devices outside the blockchain system. See [link to flowchart]. Figure 7 The method includes:
[0219] 701. The node device sends a data processing request to the oracle smart contract through the business smart contract.
[0220] The business smart contract manages the data and processing logic within the blockchain system. The oracle smart contract provides an interface for interacting with computer devices outside the blockchain system; these computer devices provide the processing resources for the oracle smart contract to process data. The oracle smart contract connects node devices within the blockchain system with computer devices outside the blockchain system, enabling the input of data from outside the blockchain system into the blockchain system. Both the business smart contract and the oracle smart contract are programs running on the node devices.
[0221] Therefore, when a node device processes data through a business smart contract, it generates a data processing request corresponding to that data and sends the data processing request to the oracle smart contract.
[0222] The process by which the node device generates a data processing request through the business smart contract is the same as the process in steps 601-603 above, and will not be described again here.
[0223] 702. Node devices receive data processing requests through oracle smart contracts and send data processing requests to computer devices.
[0224] The process of the oracle smart contract sending a data processing request to the computer device is the same as the process in step 604 above, and will not be described again here.
[0225] 703. The computer device receives the data processing request sent by the node device through the oracle smart contract.
[0226] 704. The computer device responds to the data processing request and determines the data processing result.
[0227] 705. The computer device sends the data processing results to the oracle smart contract in the node device.
[0228] 706. Node devices receive data processing results through oracle smart contracts.
[0229] 707. The node device uses the oracle smart contract to reach a consensus on the data processing results, obtains a second consensus processing result, and sends the second consensus processing result to the business smart contract.
[0230] Node devices use oracle smart contracts to reach a consensus on the data processing results, resulting in a relatively accurate and reliable second consensus processing result.
[0231] 708. The node device receives the second consensus processing result through the business smart contract, reaches a consensus on the second consensus processing result, and obtains the first consensus processing result.
[0232] The node devices use business smart contracts to reach a consensus on the second consensus processing result, resulting in a more accurate and reliable first consensus processing result.
[0233] The process of determining and transmitting the data processing results in steps 703-708 is the same as that in steps 605-609, and will not be repeated here. The difference lies in the interaction between the business smart contract and the oracle smart contract.
[0234] The method provided in this application involves a node device in a blockchain system requesting a computer device outside the blockchain system to process data processing requests via a smart contract. This transfers data processing requests from within the blockchain system to outside, reducing the data processing pressure on the blockchain system and improving data processing efficiency. Furthermore, the node device performs two consensus processes on the data processing results obtained from the computer device to arrive at the final consensus processing result, reducing the risk of errors and improving the accuracy and reliability of data processing.
[0235] Furthermore, the oracle smart contracts within the node devices provide a bridge connecting node devices within the blockchain system with computer devices outside the blockchain system, enabling data from outside the blockchain system to be input into it, thus expanding the functionality of the blockchain system. Moreover, by reducing the data processing pressure and execution complexity within the blockchain system, it achieves a certain degree of scaling effect on the blockchain system.
[0236] Based on the above embodiments, the computer devices outside the blockchain system include an oracle control device and an oracle computing device. The oracle control device manages the requests sent by the oracle smart contracts, and the oracle computing device processes the requests; for example, the oracle computing device is a computationally intensive device. Therefore, the generation and transmission of data processing results can be achieved through the interaction between the oracle control device and the oracle computing device. The specific process is described below. Figure 8 The example shown.
[0237] Figure 8 This is a flowchart of another data processing method provided in this application embodiment. This application embodiment is executed by node devices in the blockchain system and computer devices outside the blockchain system. See [link to flowchart]. Figure 8 The method includes:
[0238] 801. Node devices send data processing requests to oracle control devices outside the blockchain system via smart contracts.
[0239] 802. The oracle control device receives a data processing request.
[0240] 803. The oracle control device sends a data processing request to the oracle computing device.
[0241] Each oracle control device is connected to at least one oracle computing device. After receiving a data processing request, the oracle control device sends the data processing request to one of the oracle computing devices.
[0242] 804. The oracle computing device responds to a data processing request and determines the data processing result.
[0243] In one possible implementation, the oracle computing device stores multiple computing programs, and the data processing request includes target data and a target program identifier. The target program identifier indicates the computing program used to process the target data. Therefore, in response to the data processing request, the oracle computing device invokes the computing program indicated by the target program identifier to process the target data and obtain the data processing result.
[0244] In addition, the process of determining the data processing result in step 804 is the same as the process of determining the data processing result in step 606 above, and will not be repeated here.
[0245] 805. The oracle computing device sends the data processing results to the oracle control device.
[0246] 806. The oracle control device sends the data processing results to the node device.
[0247] After receiving the data processing result sent by the oracle computing device, the oracle control device forwards the data processing result to the node device.
[0248] In one possible implementation, the oracle control device converts the data processing result into a target format that is supported by the smart contract. The oracle control device then sends the converted data processing result to the smart contract in the node device so that the smart contract in the node device can process the data processing result in the target format.
[0249] It should be noted that steps 802-806 above are illustrated using only one oracle control device and one oracle computing device as an example. In another embodiment, the node device sends a data processing request to multiple oracle control devices, and each of the multiple oracle control devices and its corresponding oracle computing device performs one or more steps in steps 802-806 above.
[0250] 807. The node device receives the data processing results sent by the oracle control device.
[0251] 808. The node devices reach a consensus on the data processing results and obtain the first consensus processing result.
[0252] Steps 807-808 are similar to steps 608-609 above, and will not be repeated here.
[0253] The method provided in this application involves node devices in a blockchain system requesting data processing requests from computer devices outside the blockchain system via smart contracts. This transfers data processing requests from within the blockchain system to outside, reducing the data processing pressure on the blockchain system and improving data processing efficiency. Furthermore, the consensus process, where node devices reach a consensus on the data processing results obtained from the computer devices, reduces the risk of errors and improves the accuracy and reliability of data processing.
[0254] The above embodiments illustrate the example of a node device sending a data processing request to a computer device outside the blockchain system via a smart contract. In another embodiment, the node device sends data processing requests to multiple computer devices outside the blockchain system via smart contracts. These multiple computer devices respond to the data processing requests, determine the data processing results, and return the results to the node device. The node device receives the data processing results returned by the multiple computer devices, reaches a consensus on the received results, and obtains a first consensus processing result.
[0255] Due to differences in processing power and other factors, the data processing results obtained by different computer devices may be the same or different. For example, a computer with stronger processing power will produce more accurate data processing results, while a computer with weaker processing power will produce less accurate results. Furthermore, if a computer device poses a security risk, the reliability of the data processing results obtained by that device will be lower.
[0256] In this embodiment, by reaching a consensus on multiple data processing results, the accuracy of the consensus processing result can be improved. Furthermore, when the data processing result corresponding to a data processing request is uncertain, reaching a consensus on multiple data processing results can improve the certainty of the consensus processing result. For example, if the data processing request is to predict tomorrow's weather, the prediction result obtained by a single computer device is uncertain. Using a decentralized consensus mechanism can improve the certainty of the final prediction result.
[0257] In one possible implementation, the node device reaches a consensus on multiple data processing results to obtain a first consensus processing result, which includes the following three methods.
[0258] (1) The data processing result that appears most frequently among multiple data processing results is determined as the first consensus processing result. For example, if the data processing result is a numerical value, and multiple data processing results include 85, 83, 85, 89 and 87, since 85 is the data processing result that appears most frequently, 85 is determined as the first consensus processing result.
[0259] (2) The data processing result that appears a third threshold number of times among multiple data processing results is determined as the first consensus processing result. This third threshold can be a threshold pre-set by the smart contract, such as half or 80% of the number of multiple computer devices. For example, if the data processing result is a numerical value and the third threshold is 3 times, and the multiple data processing results include 85, 83, 85, 85, and 87, then since 85 appears a third time, it is determined as the first consensus processing result.
[0260] (3) The data processing result is a numerical value. Multiple data processing results are weighted and fused to obtain the first consensus processing result. For example, multiple computer devices have their own weights. The node device uses a smart contract to perform a weighted average of the data processing results corresponding to the multiple computer devices based on their respective weights to obtain the first consensus processing result.
[0261] In one possible implementation, the smart contract includes a business smart contract and an oracle smart contract. The node device, through the oracle smart contract, reaches a consensus on multiple data processing results to obtain a second consensus processing result, which is then sent to the business smart contract. The node device receives the second consensus processing result through the business smart contract, reaches a consensus on the second consensus processing result, and obtains a first consensus processing result.
[0262] In this embodiment, consensus through oracle smart contracts refers to processing multiple data processing results, such as using the methods described in (1), (2), or (3) above, or using other methods for statistics, filtering, or fusion. In this embodiment, consensus through business smart contracts refers to verifying and confirming the second consensus processing result.
[0263] Figure 9 This is a flowchart of another data processing method provided in the embodiments of this application, such as... Figure 9 As shown, the method includes the following steps.
[0264] 901. The business smart contract sends a data processing request to the oracle smart contract.
[0265] 902. The oracle smart contract broadcasts the data processing request, which includes the target data to be processed and the program identifier corresponding to the computation program used to process the target data.
[0266] 903. The oracle control device receives the data processing request and forwards it to the oracle computing device.
[0267] 904. The oracle computing device responds to the data processing request, determines the data processing result, and returns the data processing result to the oracle control device.
[0268] 905. The oracle control device returns the data processing result to the oracle smart contract.
[0269] 906. The oracle smart contract reaches a consensus on the processing results of multiple received data, obtains a second consensus processing result, and returns it to the business smart contract. The business smart contract then reaches a consensus on the second consensus processing result to obtain the first consensus processing result.
[0270] Figure 10 This is a flowchart of another data processing method provided in the embodiments of this application, such as... Figure 10 As shown, the method includes the following steps.
[0271] 1001. The business smart contract sends a data processing request to the oracle smart contract, requesting the oracle smart contract to perform off-chain processing. The data processing request carries the target data to be processed and the program identifier corresponding to the computing program used to process the target data.
[0272] 1002. After the oracle smart contract is invoked, it broadcasts the data processing request. Multiple oracle control devices outside the blockchain system will detect the data processing request broadcast by the oracle smart contract in real time.
[0273] 1003. After receiving the data processing request, the oracle control device sends the data processing request to the oracle computing device.
[0274] 1004. The oracle computing device receives a data processing request sent by the oracle control device, selects the computing program indicated by the program identifier in the data processing request, calls the computing program to process the target data in the data processing request, obtains the data processing result, and returns the data processing result to the oracle control device.
[0275] 1005. After receiving the data processing result, the oracle control device converts the data processing result into the target format supported by the oracle smart contract and sends the converted data processing result to the oracle smart contract.
[0276] 1006. The oracle smart contract reaches a consensus on the data processing results returned by multiple oracle control devices outside the blockchain system, obtains the consensus processing result, and returns the consensus processing result to the business smart contract.
[0277] 1007. The business smart contract receives the consensus processing result and continues to execute its processing logic based on this result. For example, the business smart contract performs consensus again on the received result to verify its accuracy and reliability. Another example is that the business smart contract adds the consensus processing result to the blockchain.
[0278] Figure 11 This is a flowchart of another data processing method provided in the embodiments of this application, such as... Figure 11 As shown, the method includes the following steps.
[0279] 1101. The business smart contract sends a data processing request to the oracle smart contract.
[0280] 1102. The oracle smart contract broadcasts the data processing request, which includes the target data to be processed, to multiple computer devices outside the blockchain system.
[0281] 1103. The computer device receives the data processing request and calls the external processing interface. The external processing interface triggers the device that provides the external processing interface to process the data processing request, thereby obtaining the data processing result.
[0282] 1104. The external processing interface returns the processed data to the computer device.
[0283] 1105. The computer device returns the data processing result to the oracle smart contract.
[0284] 1106. The oracle smart contract reaches a consensus on the processing results of multiple received data, obtains the consensus processing result, and returns it to the business smart contract.
[0285] Figure 12 This is a schematic diagram of the structure of a data processing apparatus provided in an embodiment of this application. See also... Figure 12 The device is used on any node device in a blockchain system, which stores smart contracts; the device includes:
[0286] The request sending module 1201 is used to obtain target data and, if the processing method corresponding to the target data is an off-chain processing method, generate a data processing request corresponding to the target data. The off-chain processing method refers to processing by computer devices outside the blockchain system.
[0287] The request sending module 1201 is also used to send the data processing request to a computer device outside the blockchain system through the smart contract. The smart contract provides an interface for interacting with the computer device outside the blockchain system, and the computer device provides processing resources for the smart contract to process data.
[0288] Result receiving module 1202 is used to receive the data processing result obtained by the computer device based on the data processing request;
[0289] The consensus module 1203 is used to reach a consensus on the data processing results and obtain the first consensus processing result.
[0290] The data processing apparatus provided in this application, when requiring off-chain processing of target data, allows node devices in the blockchain system to request data processing requests corresponding to the target data from computer devices outside the blockchain system via smart contracts. This transfers the data processing request from within the blockchain system to outside, reducing the data processing pressure on the blockchain system and improving data processing efficiency. Furthermore, the consensus-based processing results obtained by the node devices from the computer devices reduce the risk of errors and improve the accuracy and reliability of data processing.
[0291] Optionally, see Figure 13 The smart contract includes a business smart contract and an oracle smart contract. The oracle smart contract provides an interface for interacting with computer devices outside the blockchain system, and the computer devices provide processing resources for the oracle smart contract to process data. The request sending module 1201 is used for:
[0292] The data processing request is sent to the oracle smart contract through the business smart contract;
[0293] The oracle smart contract receives the data processing request and sends it to the computer device.
[0294] Optionally, see Figure 13 The consensus module 1203 includes:
[0295] The first consensus unit 1213 is used to reach a consensus on the data processing result through the oracle smart contract, obtain the second consensus processing result, and send the second consensus processing result to the business smart contract.
[0296] The second consensus unit 1223 is used to receive the second consensus processing result through the business smart contract, reach a consensus on the second consensus processing result, and obtain the first consensus processing result.
[0297] Optionally, see Figure 13 The number of computer devices outside the blockchain system is multiple, and the data processing results received by the node device are the data processing results returned by multiple computer devices; this consensus module 1203 is used for:
[0298] The data processing result that appears most frequently among multiple data processing results is determined as the first consensus processing result; or...
[0299] The data processing result that appears at a frequency reaching the third threshold among the multiple data processing results is determined as the first consensus processing result; or,
[0300] The data processing result is a numerical value. The multiple data processing results are weighted and fused to obtain the first consensus processing result.
[0301] Optionally, see Figure 13 The device also includes:
[0302] The prediction module 1204 is used to call the data prediction model to predict the target data and obtain the target prediction result. The target prediction result is used to indicate whether the processing method corresponding to the target data belongs to the off-chain processing method.
[0303] Optionally, see Figure 13 The device also includes a training module 1205, which is used for:
[0304] Based on historical processing records, obtain positive sample data and corresponding first sample label, as well as negative sample data and corresponding second sample label. The first sample label indicates that the processing method corresponding to the positive sample data belongs to the off-chain processing method, and the second sample label indicates that the processing method corresponding to the negative sample data does not belong to the off-chain processing method.
[0305] The data prediction model is invoked to predict the positive sample data and the negative sample data respectively, and the first prediction result and the second prediction result are obtained.
[0306] Based on the first sample label and the first prediction result, as well as the second sample label and the second prediction result, the data prediction model is trained so that the similarity between the first prediction result obtained by calling the trained data prediction model and the first sample label is increased, and the similarity between the second prediction result obtained and the second sample label is increased.
[0307] Optionally, see Figure 13 The device also includes a determining module 1206, which is used for:
[0308] If the computational cost of the target data exceeds the first threshold, it is determined that the processing method corresponding to the target data belongs to the off-chain processing method.
[0309] If the amount of the target data exceeds the second threshold, it is determined that the processing method corresponding to the target data belongs to the off-chain processing method.
[0310] If the business entity to which the target data belongs is the target business entity, then the processing method corresponding to the target data is determined to be an off-chain processing method.
[0311] If the data type of the target data belongs to the preset data type, then the processing method corresponding to the target data is determined to be the off-chain processing method.
[0312] Optionally, see Figure 13 The request sending module 1201 is used for:
[0313] If the processing method corresponding to the target data belongs to the off-chain processing method, query the target program identifier corresponding to the processing method. The target program identifier indicates the computing program used to perform the processing of the processing method.
[0314] Based on the target data and the target program identifier, the data processing request is generated.
[0315] Optionally, see Figure 13 The data processing request includes target data and a target program identifier, which indicates the computational program used to process the target data;
[0316] The request sending module 1201 is used to send the data processing request to the computer device when the target program identifier is a registered program identifier.
[0317] It should be noted that the data processing apparatus provided in the above embodiments is only illustrated by the division of the above functional modules. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the node device can be divided into different functional modules to complete all or part of the functions described above. In addition, the data processing apparatus and data processing method embodiments provided in the above embodiments belong to the same concept, and their specific implementation process can be found in the method embodiments, which will not be repeated here.
[0318] Figure 14 This is a schematic diagram of another data processing apparatus provided in an embodiment of this application. See also... Figure 14 The device is applicable to any computer device outside of a blockchain system, and the device includes:
[0319] The request receiving module 1401 is used to receive a data processing request corresponding to target data sent by a target node device through a smart contract. The target node device is any one of multiple node devices in the blockchain system. The smart contract provides an interface for interacting with computer devices outside the blockchain system. The computer device provides the smart contract with processing resources for processing data. The data processing request is generated by the target node device when the processing method corresponding to the target data is an off-chain processing method. The off-chain processing method refers to processing by computer devices outside the blockchain system.
[0320] Processing module 1402 is used to determine the data processing result in response to the data processing request;
[0321] The result sending module 1403 is used to send the data processing result to the target node device. The target node device is used to receive the data processing result sent by the computer device, perform consensus on the data processing result, and obtain a first consensus processing result.
[0322] The data processing apparatus provided in this application embodiment allows node devices in a blockchain system to request data processing requests from computer devices outside the blockchain system via smart contracts. This transfers data processing requests from within the blockchain system to outside, reducing the data processing pressure on the blockchain system and improving data processing efficiency. Furthermore, the node devices reach a consensus on the data processing results obtained from the computer devices, resulting in a consensus processing result, which reduces the risk of errors and improves the accuracy and reliability of data processing.
[0323] Optionally, see Figure 15 The computer device includes an oracle control device and an oracle computing device; the request receiving module 1401 in the oracle control device is used to receive the data processing request;
[0324] The processing module 1402 includes a first sending unit 1412 in the oracle control device and a processing unit 1422 in the oracle computing device; the first sending unit 1412 is used to send the data processing request to the oracle computing device; the processing unit 1422 is used to generate the data processing result in response to the data processing request.
[0325] The result sending module 1403 includes a second sending unit 1413 in the oracle computing device and a third sending unit 1423 in the oracle control device. The second sending unit 1413 is used to send the data processing result to the oracle control device; the third sending unit 1423 is used to send the data processing result to the target node device.
[0326] Optionally, see Figure 15 The data processing request includes target data and a target program identifier; the processing unit 1422 is used to respond to the data processing request by calling the calculation program indicated by the target program identifier to process the target data and obtain the data processing result.
[0327] Optionally, see Figure 15 The third transmitting unit 1423 is used for:
[0328] The data processing result is converted into a target format, which is a format supported by the smart contract.
[0329] The transformed data processing result is sent to the smart contract in the target node device.
[0330] Optionally, see Figure 15 The computer device stores an external processing interface, which is provided by other devices outside the computer device. The processing module 1402 is used to respond to the data processing request, call the external processing interface, process the target data, and obtain the data processing result.
[0331] Optionally, see Figure 15 The processing module 1402 is used for:
[0332] This data processing request is a hash processing request for the target data. In response to this data processing request, the target data is hashed to obtain hash data; or...
[0333] This data processing request is a verification request for the target data. In response to this data processing request, the target data is verified, and a verification result is obtained; or...
[0334] The data processing request is an encryption request for the target data. In response to the data processing request, the target data is encrypted to obtain encrypted data.
[0335] It should be noted that the data processing apparatus provided in the above embodiments is only an example of the division of the above functional modules. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the computer device can be divided into different functional modules to complete all or part of the functions described above. In addition, the data processing apparatus and data processing method embodiments provided in the above embodiments belong to the same concept, and their specific implementation process can be found in the method embodiments, which will not be repeated here.
[0336] This application also provides a computer device, which includes a processor and a memory. The memory stores at least one computer program, which is loaded and executed by the processor to perform the operations performed in the data processing method of the above embodiments.
[0337] Optionally, the computer device is provided as a terminal. Figure 16 A schematic diagram of the structure of a terminal 1600 provided in an exemplary embodiment of this application is shown.
[0338] Terminal 1600 includes a processor 1601 and a memory 1602.
[0339] Processor 1601 may include one or more processing cores, such as a quad-core processor or an octa-core processor. Processor 1601 may be implemented using at least one hardware form selected from DSP (Digital Signal Processing), FPGA (Field Programmable Gate Array), and PLA (Programmable Logic Array). Processor 1601 may also include a main processor and a coprocessor. The main processor, also known as a CPU (Central Processing Unit), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, processor 1601 may integrate a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content required to be displayed on the screen.
[0340] Memory 1602 may include one or more computer-readable storage media, which may be non-transitory. Memory 1602 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In some embodiments, the non-transitory computer-readable storage media in memory 1602 are used to store at least one computer program, which is used by processor 1601 to implement the data processing method provided in the method embodiments of this application.
[0341] In some embodiments, the terminal 1600 may also optionally include a peripheral device interface 1603 and at least one peripheral device. The processor 1601, memory 1602, and peripheral device interface 1603 can be connected via a bus or signal line. Each peripheral device can be connected to the peripheral device interface 1603 via a bus, signal line, or circuit board. Optionally, the peripheral device includes at least one of a radio frequency circuit 1604 or a display screen 1605.
[0342] Peripheral interface 1603 can be used to connect at least one I / O (Input / Output) related peripheral device to processor 1601 and memory 1602. In some embodiments, processor 1601, memory 1602 and peripheral interface 1603 are integrated on the same chip or circuit board; in some other embodiments, any one or two of processor 1601, memory 1602 and peripheral interface 1603 can be implemented on separate chips or circuit boards, which is not limited in this embodiment.
[0343] The radio frequency (RF) circuit 1604 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The RF circuit 1604 communicates with communication networks and other communication devices via electromagnetic signals. The RF circuit 1604 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals back into electrical signals. Optionally, the RF circuit 1604 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a user identity module card, etc.
[0344] Display screen 1605 is used to display a UI (User Interface). This UI may include graphics, text, icons, video, and any combination thereof. When display screen 1605 is a touch display screen, it also has the ability to acquire touch signals on or above its surface. These touch signals can be input as control signals to processor 1601 for processing.
[0345] Those skilled in the art will understand that Figure 16 The structure shown does not constitute a limitation on terminal 1600 and may include more or fewer components than shown, or combine certain components, or use different component arrangements.
[0346] Optionally, the computer device is provided as a server. Figure 17This is a schematic diagram of a server structure provided in an embodiment of this application. The server 1700 can vary significantly due to different configurations or performance. It may include one or more Central Processing Units (CPUs) 1701 and one or more memories 1702. The memories 1702 store at least one computer program, which is loaded and executed by the processor 1701 to implement the methods provided in the various method embodiments described above. Of course, the server may also have wired or wireless network interfaces, a keyboard, and input / output interfaces for input and output. The server may also include other components for implementing device functions, which will not be elaborated upon here.
[0347] This application also provides a computer-readable storage medium storing at least one computer program, which is loaded and executed by a processor to implement the operations performed by the data processing method of the above embodiments.
[0348] This application also provides a computer program product, including a computer program loaded and executed by a processor to perform operations as described in the data processing method of the above embodiments. In some embodiments, the computer program involved in this application may be deployed and executed on a single computer device, or on multiple computer devices located in one location, or on multiple computer devices distributed across multiple locations and interconnected via a communication network. These multiple computer devices distributed across multiple locations and interconnected via a communication network can constitute a blockchain system.
[0349] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.
[0350] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present application should be included within the protection scope of the present application.
Claims
1. A data processing method, characterized in that, Executed by any node device in the blockchain system, the node device storing business smart contracts and oracle smart contracts; the method includes: Acquire target data, and if the processing method of the target data is off-chain processing, generate a data processing request for the target data. The off-chain processing method refers to processing by computer devices outside the blockchain system. The data processing request is sent to the oracle smart contract through the business smart contract, which is used to manage the data in the blockchain system; The oracle smart contract receives the data processing request and sends it to an oracle control device outside the blockchain system. The oracle smart contract provides an interface for interacting with the oracle control device, and the oracle control device provides processing resources for the oracle smart contract to process data. The oracle control device receives the data processing request and sends it to multiple oracle computing devices outside the blockchain system. These multiple oracle computing devices respond to the data processing request, determine multiple data processing results, and send these results to the oracle control device. The oracle control device also converts the multiple data processing results into a target format supported by the oracle smart contract and sends the multiple data processing results in the target format to the oracle smart contract. The oracle smart contract receives the multiple data processing results in the target format; the oracle smart contract determines the data processing result that appears most frequently among the multiple data processing results as the second consensus processing result; or, the data processing result that appears most frequently among the multiple data processing results reaches a third threshold as the second consensus processing result; or, if the data processing result is a numerical value, the multiple data processing results are weighted and fused to obtain the second consensus processing result; the oracle smart contract then sends the second consensus processing result to the business smart contract. The business smart contract receives the second consensus processing result, reaches a consensus on the second consensus processing result, and obtains the first consensus processing result.
2. The method according to claim 1, characterized in that, Before generating the data processing request for the target data when the processing method for the target data is an off-chain processing method, the method further includes: The data prediction model is invoked to predict the target data and obtain the target prediction result. The target prediction result is used to indicate whether the processing method corresponding to the target data belongs to the off-chain processing method.
3. The method according to claim 2, characterized in that, The training process of the data prediction model includes: Based on historical processing records, obtain positive sample data and corresponding first sample labels, as well as negative sample data and corresponding second sample labels. The first sample label indicates that the processing method corresponding to the positive sample data belongs to the off-chain processing method, and the second sample label indicates that the processing method corresponding to the negative sample data does not belong to the off-chain processing method. The data prediction model is invoked to predict the positive sample data and the negative sample data respectively, and a first prediction result and a second prediction result are obtained. Based on the first sample label and the first prediction result, as well as the second sample label and the second prediction result, the data prediction model is trained to increase the similarity between the first prediction result obtained by calling the trained data prediction model and the first sample label, and to increase the similarity between the second prediction result obtained and the second sample label.
4. The method according to claim 1, characterized in that, Before generating the data processing request for the target data when the processing method for the target data is an off-chain processing method, the method further includes: If the computational load of the target data exceeds a first threshold, it is determined that the processing method corresponding to the target data belongs to the off-chain processing method. If the amount of the target data is greater than the second threshold, it is determined that the processing method corresponding to the target data belongs to the off-chain processing method; If the business entity to which the target data belongs is the target business entity, it is determined that the processing method corresponding to the target data belongs to the off-chain processing method; If the data type of the target data belongs to a preset data type, then the processing method corresponding to the target data is determined to belong to the off-chain processing method.
5. A data processing method, characterized in that, The method includes: An oracle control device outside the blockchain system receives a data processing request for target data sent by a target node device through an oracle smart contract. The target node device is any one of multiple node devices in the blockchain system. The oracle smart contract provides an interface for interacting with the oracle control device, and the oracle control device provides processing resources for the oracle smart contract to process the data. The data processing request is generated by the target node device when the processing method of the target data is off-chain processing, which refers to processing by computer devices outside the blockchain system. The target node device sends the data processing request to the oracle smart contract through a business smart contract, receives the data processing request through the oracle smart contract, and sends the data processing request to the oracle control device. The business smart contract is used to manage the data in the blockchain system. The oracle control device sends the data processing request to multiple oracle computing devices outside the blockchain system; In response to the data processing request, the plurality of oracle computing devices determine a plurality of data processing results and send the plurality of data processing results to the oracle control device; The oracle control device receives the multiple data processing results, converts the multiple data processing results into a target format supported by the oracle smart contract, and sends the multiple data processing results in the target format to the oracle smart contract. The target node device is used to receive the multiple data processing results in the target format through the oracle smart contract, and determine the data processing result that appears most frequently among the multiple data processing results as the second consensus processing result; or, determine the data processing result that appears most frequently among the multiple data processing results as the second consensus processing result; or, if the data processing result is a numerical value, perform weighted fusion on the multiple data processing results to obtain the second consensus processing result, and send the second consensus processing result to the business smart contract. The target node device is also used to receive the second consensus processing result through the business smart contract, and perform consensus on the second consensus processing result to obtain the first consensus processing result.
6. The method according to claim 5, characterized in that, The plurality of oracle computing devices store external processing interfaces, which are provided by other devices besides the plurality of oracle computing devices. In response to the data processing request, the plurality of oracle computing devices determine a plurality of data processing results, including: In response to the data processing request, the plurality of oracle computing devices respectively call the external processing interface to process the target data and obtain the plurality of data processing results.
7. A data processing system, characterized in that, The data processing system includes multiple node devices in the blockchain system, as well as oracle control devices and multiple oracle computing devices outside the blockchain system. The node devices store business smart contracts and oracle smart contracts. The business smart contracts are used to manage data in the blockchain system, and the oracle smart contracts provide interfaces for interacting with the oracle control devices. The oracle control devices provide processing resources for the oracle smart contracts to process data. The target node device among the plurality of node devices is used to acquire target data, and when the processing method of the target data is an off-chain processing method, it generates a data processing request for the target data. The off-chain processing method refers to processing by computer devices outside the blockchain system. The target node device is also used to send the data processing request to the oracle smart contract through the business smart contract; The target node device is also used to receive the data processing request through the oracle smart contract and send the data processing request to the oracle control device; The oracle control device is used to receive the data processing request and send the data processing request to the plurality of oracle computing devices; The plurality of oracle computing devices are configured to, in response to the data processing request, determine a plurality of data processing results and return the plurality of data processing results to the oracle control device; The oracle control device is used to receive the multiple data processing results, convert the multiple data processing results into a target format supported by the oracle smart contract, and send the multiple data processing results in the target format to the oracle smart contract. The target node device is also used to receive the multiple data processing results in the target format through the oracle smart contract; The target node device is further configured to, through the oracle smart contract, determine the data processing result that appears most frequently among the multiple data processing results as the second consensus processing result; or, determine the data processing result that appears most frequently among the multiple data processing results as the second consensus processing result; or, if the data processing result is a numerical value, perform weighted fusion on the multiple data processing results to obtain the second consensus processing result. The target node device is also used to send the second consensus processing result to the business smart contract through the oracle smart contract; The target node device is further configured to receive the second consensus processing result through the business smart contract, and to reach a consensus on the second consensus processing result to obtain the first consensus processing result.
8. A data processing apparatus, characterized in that, An application to any node device in a blockchain system, wherein the node device stores business smart contracts and oracle smart contracts; the device includes: The request sending module is used to obtain target data and, if the processing method of the target data is off-chain processing, generate a data processing request for the target data. The off-chain processing method refers to processing by computer devices outside the blockchain system. The request sending module is also used to send the data processing request to the oracle smart contract through the business smart contract, wherein the business smart contract is used to manage the data in the blockchain system; The request sending module is further configured to receive the data processing request through the oracle smart contract, and send the data processing request to an oracle control device outside the blockchain system. The oracle smart contract provides an interface for interacting with the oracle control device, and the oracle control device provides the oracle smart contract with processing resources for processing data. The oracle control device is configured to receive the data processing request and send the data processing request to multiple oracle computing devices outside the blockchain system. The multiple oracle computing devices are configured to respond to the data processing request, determine multiple data processing results, and send the multiple data processing results to the oracle control device. The oracle control device is further configured to convert the multiple data processing results into a target format supported by the oracle smart contract and send the multiple data processing results in the target format to the oracle smart contract. The result receiving module is used to receive the multiple data processing results in the target format through the oracle smart contract; The consensus module is used to determine the data processing result that appears most frequently among the multiple data processing results as the second consensus processing result through the oracle smart contract; or, determine the data processing result that appears most frequently among the multiple data processing results as the second consensus processing result; or, if the data processing result is a numerical value, perform weighted fusion on the multiple data processing results to obtain the second consensus processing result. The consensus module is also used to send the second consensus processing result to the business smart contract through the oracle smart contract; The consensus module is further configured to receive the second consensus processing result through the business smart contract, reach a consensus on the second consensus processing result, and obtain the first consensus processing result.
9. A data processing apparatus, characterized in that, The device includes: A request receiving module is used to receive data processing requests for target data sent by a target node device through an oracle smart contract. The target node device is any one of multiple node devices in the blockchain system. The oracle smart contract provides an interface for interacting with an oracle control device outside the blockchain system. The oracle control device provides the oracle smart contract with processing resources for processing data. The data processing request is generated by the target node device when the processing method of the target data is off-chain processing. Off-chain processing refers to processing by computer devices outside the blockchain system. The target node device is used to send the data processing request to the oracle smart contract through a business smart contract, receive the data processing request through the oracle smart contract, and send the data processing request to the oracle control device. The business smart contract is used to manage data in the blockchain system. The request receiving module is also used to send the data processing request to multiple oracle computing devices outside the blockchain system; The processing module is configured to respond to the data processing request, determine multiple data processing results, and send the multiple data processing results to the oracle control device; The result sending module is used to receive the multiple data processing results, convert the multiple data processing results into a target format supported by the oracle smart contract, and send the multiple data processing results in the target format to the oracle smart contract; the target node device is used to receive the multiple data processing results in the target format through the oracle smart contract, and determine the data processing result that appears most frequently among the multiple data processing results as the second consensus processing result; or, determine the data processing result that appears most frequently among the multiple data processing results as the second consensus processing result; or, if the data processing result is a numerical value, perform weighted fusion on the multiple data processing results to obtain the second consensus processing result, and send the second consensus processing result to the business smart contract; the target node device is also used to receive the second consensus processing result through the business smart contract, and perform consensus on the second consensus processing result to obtain the first consensus processing result.
10. A computer device, characterized in that, The computer device includes a processor and a memory, the memory storing at least one computer program, the at least one computer program being loaded and executed by the processor to implement the operations performed by the data processing method as described in any one of claims 1 to 4, or to implement the operations performed by the data processing method as described in any one of claims 5 to 6.
11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores at least one computer program, which is loaded and executed by a processor to implement the operations performed by the data processing method as described in any one of claims 1 to 4, or to implement the operations performed by the data processing method as described in any one of claims 5 to 6.
12. A computer program product, comprising a computer program, characterized in that, The computer program is loaded and executed by a processor to perform the operations performed by the data processing method as described in any one of claims 1 to 4, or to perform the operations performed by the data processing method as described in any one of claims 5 to 6.
Citation Information
Patent Citations
Blockchain data processing method and device based on cloud computing
CN111541785A
Off-chain security payment method and system based on alliance chain, medium and equipment
CN112241884A
Block chain data processing method and device based on cloud computing
CN113438289A
Data processing method, block chain, terminal equipment and storage medium
CN114240657A