Data processing method, device, electronic device, and computer program
A blockchain-based data processing method using node devices and smart contracts addresses the limitations of centralized systems by ensuring continuous service, reducing costs, and enhancing security and storage reliability.
Patent Information
- Application Number
- JP2023566964
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Priority Date
- 2022-12-22
- Filing Date
- 2023-08-07
- Publication Date
- 2025-09-09
- Estimated Expiration
- 2043-08-07
AI Technical Summary
Centralized data processing engines face challenges in providing continuous service during failures or upgrades, are limited by geographical location, and incur high maintenance costs, with limited functionality expansion and insecure data storage.
Implementing a data processing method using node devices in a blockchain system with smart contracts to distribute data processing functions, enabling decentralized operation and smart contract updates, ensuring service continuity and reducing maintenance complexity.
The blockchain-based approach simplifies system configuration, reduces deployment and maintenance costs, facilitates service expansion, ensures service continuity, and enhances data security and storage reliability.
Smart Images

Figure 0007735645000001 
Figure 0007735645000002 
Figure 0007735645000003
Abstract
Description
[Technical Field]
[0001] (CROSS-REFERENCE TO RELATED APPLICATIONS) This application claims priority to a Chinese patent application bearing application number 202211658556.0, filed with the China Patent Office on December 22, 2022, the entire contents of which are incorporated herein by reference.
[0002] The present application relates to the field of blockchain technology, and in particular to a data processing method, device, electronic device, and computer program. [Background technology]
[0003] In the related art, when performing data processing, a data processing engine centrally located on the server side usually performs data processing corresponding to a data processing request triggered by a target, and here, the data processing function provided by the data processing engine is composed of multiple subsystem functions, and the multiple subsystem functions include a load balancing subsystem, various processing function subsystems, and a network distribution subsystem, etc.
[0004] However, because the data processing engines are centrally located, it is not possible to provide data processing services to users or guarantee their data processing needs when a failure occurs or when a service is upgraded, and the geographical limitations of the centralized location make it difficult to expand services.In addition, current data processing engines can only store processing results for a certain period of time after completing data processing, so they cannot meet the processing needs for a wide range of past data.Furthermore, it is difficult to guarantee the overall processing effectiveness of the functions of multiple subsystems, and maintenance costs are high. Summary of the Invention [Problem to be solved by the invention]
[0005] Embodiments of the present application provide a data processing method, device, electronic device, computer storage medium, and computer program product that can realize various data processing functions using node devices in a blockchain system and smart contracts stored in the blockchain, and can significantly reduce the complexity of maintenance and deployment while ensuring the data processing needs of related subjects. [Means for solving the problem]
[0006] An embodiment of the present application provides a data processing method applied to a node device in a blockchain system, the method comprising: receiving a data processing request sent from a target device, and acquiring contract identification information, description information of data to be processed, operation type information for the data to be processed, and target identification information of the target device included in the data processing request, wherein one contract identification information is used to identify one smart contract, and the one smart contract stores processing logic for at least one data processing function; Searching for a corresponding target smart contract in the stored blockchain based on the contract identification information, and processing the waiting data according to a processing method corresponding to the operation type information in the target smart contract to obtain a data processing result; and feeding back the data processing result to the target device.
[0007] An embodiment of the present application provides a data processing apparatus, the apparatus comprising: a receiving unit; a processing unit; and a feedback unit; The receiving unit is configured to receive a data processing request sent from a target device, and obtain contract identification information, description information of data to be processed, operation type information for the data to be processed, and target identification information of the target device included in the data processing request, wherein one contract identification information is used to identify one smart contract, and the one smart contract stores processing logic of at least one data processing function; The processing unit is configured to search for a corresponding target smart contract in the stored blockchain based on the contract identification information, and process the waiting data according to a processing manner corresponding to the operation type information in the target smart contract to obtain a data processing result; The feedback unit is configured to feed back the data processing result to the target device.
[0008] An embodiment of the present application provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable by the processor, wherein the processor, when executing the program, realizes any of the data processing methods described above.
[0009] An embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, the computer program realizing any one of the data processing methods described above when executed by a processor.
[0010] An embodiment of the present application provides a computer program product including a computer program, which, when executed by a processor, implements any of the data processing methods described above. [Effects of the Invention]
[0011] The present application has the following beneficial effects:
[0012] In the embodiments of the present application, a data processing method, an apparatus, an electronic device, a computer storage medium, and a computer program product are proposed. When implementing data processing functions based on data processing requests from target devices, various data processing functions can be realized using node devices in a blockchain system and smart contracts stored in the blockchain. This simplifies the system configuration for performing data processing, and significantly reduces the complexity of maintenance and deployment by converting the maintenance and deployment of data processing engines into the deployment and updating of smart contracts in the blockchain. Furthermore, the distributed architecture of the blockchain system enables distributed construction of data processing functions. When data processing is performed, data processing can be performed correspondingly for pending data by invoking the target smart contract indicated in the data processing request. Therefore, the blockchain allows various data processing functions to be easily deployed in node devices, significantly reducing deployment and maintenance costs for implementing data processing functions and facilitating the expansion of data processing services, thereby resolving the problem of service expansion being limited by regional factors. Furthermore, due to the nature of the blockchain being stored in each node device within the blockchain system, if one node device within the blockchain system fails, the other node devices can also perform the same processing function, so the failure of one node device will not affect the normal operation of the data processing service, thereby ensuring normal responses to data processing requests even when the target device is unaware of the failure. [Brief explanation of the drawings]
[0013] [Figure 1] 1 is a schematic diagram of the architecture of a prior art data processing engine in an embodiment of the present application; [Figure 2] 1 is a schematic diagram of an applicable scene in an embodiment of the present application; [Figure 3A] 1 is a flowchart of data processing in an embodiment of the present application. [Figure 3B]FIG. 1 is a schematic diagram of the architecture of each stored smart contract in an embodiment of the present application. [Figure 3C] FIG. 1 is a schematic diagram of the functionality supported by a smart contract in an embodiment of the present application. [Figure 3D] 1 is a comparative diagram of execution orders of data processing transactions in an embodiment of the present application. [Figure 4A] 1 is a schematic diagram of an implementation process of trusted computing processing in an embodiment of the present application; [Figure 4B] FIG. 2 is a schematic diagram of another implementation process of trusted computing processing in an embodiment of the present application. [Figure 5] 1 is a flowchart illustrating a process for invoking a smart contract to execute a transaction in an embodiment of the present application. [Figure 6] 1 is a schematic diagram illustrating a logical structure of a data processing device according to an embodiment of the present application; [Figure 7] FIG. 1 is a schematic diagram illustrating a hardware configuration of an electronic device according to an embodiment of the present application. [Figure 8] FIG. 1 is a schematic diagram illustrating the configuration of a computing device according to an embodiment of the present application. DETAILED DESCRIPTION OF THE INVENTION
[0014] In order to clarify the objectives, technical solutions and advantages of the embodiments of the present application, the following will clearly and completely describe the technical solutions of the embodiments of the present application with reference to the drawings of the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the technical solutions of the present application, but not all of the embodiments. Based on the embodiments described in the specification of the present application, all other embodiments obtained by those skilled in the art without any creative efforts are included in the protection scope of the present application.
[0015] The terms "first," "second," and the like in the present specification, claims, and drawings do not limit a particular order or sequence, but rather distinguish between similar objects. It should be understood that data so used can be interchanged where appropriate, such that the embodiments of the invention described herein can be implemented in sequences other than those illustrated or described herein.
[0016] To facilitate understanding by those skilled in the art, some of the terms used in the examples of the present application are explained below.
[0017] Blockchain: A distributed ledger technology in the information technology field, generally consisting of consensus, transaction blocks, state data storage, cryptographic ID security, etc. In addition, since the ledger is stored in a distributed manner and the blocks are consensus-based, it has the characteristics of being tamper-proof, traceable, and commonly maintained.
[0018] Consensus: Refers to the mechanism by which all nodes in a blockchain system jointly maintain block development. Common consensus mechanisms include Proof of Work (POW), Proof of Stake (POS), Delegated Proof of Stake (DPOS), and Practical Byzantine Fault Tolerance (PBFT).
[0019] Node: or node device, is the smallest unit that participates in the maintenance of the blockchain in a blockchain system, and is the unit that deploys and executes the blockchain node program.
[0020] Data Processing Engine: A tool used to provide data processing functions, typically providing an external standard restful interface, or a remote procedure call interface (GRPC: Google Remote Procedure Call), or a websocket interface service, or a function-level application programming interface (API: Application Programming Interface) calling function.
[0021] Blockchain is a new application of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanisms, and encryption algorithms. Blockchain is essentially a decentralized database, a series of data blocks generated and associated using cryptographic correlation methods, with each data block containing the same batch of network transaction information to verify the validity (anti-counterfeiting) of the information and generate the next block. Blockchain may include a blockchain base platform, a platform product service layer, and an application service layer.
[0022] The blockchain foundation platform may include processing modules such as user management, basic services, smart contracts, and operation monitoring. The user management module is responsible for managing the identity information of all blockchain participants, including generating and maintaining public and private keys (account management), key management, and maintaining the correspondence between users' real identities and blockchain addresses (authority management). It also oversees and audits transactions related to specific real identities after approval and provides risk control rule setting (risk control audit). The basic service module is deployed on all blockchain node devices and is used to verify the validity of service requests and record valid requests after reaching consensus. For new service requests, the basic service first performs interface adaptation analysis and authentication processing (interface adaptation), then encrypts the service information through a consensus algorithm (consensus management), verifies the encrypted information, and transmits it to the shared ledger (network communication) for consistency and storage. The smart contract module is responsible for contract registration and issuance, contract triggering, and contract execution. Developers define contract logic in a specific programming language, deploy it on the blockchain (contract registration), and trigger execution to complete the contract logic by invoking keys or other events according to the contract condition logic. At the same time, it also provides the function of canceling contract upgrades. The operation monitoring module is mainly responsible for the deployment of product release processes, configuration changes, contract settings, cloud adaptation, and visual output of real-time product operation status, such as warnings, network status monitoring, and node equipment health monitoring.
[0023] The platform product service layer provides the basic functions and implementation framework of typical applications, allowing developers to overlay service characteristics based on these basic functions to complete the blockchain implementation of service logic. The application service layer provides application services based on the blockchain solution for use by service participants.
[0024] The design concept of the embodiment of the present invention will be briefly explained below.
[0025] In data processing, most of the current data processing technologies are centralized service systems based on cloud services, and in some embodiments, data processing is realized by a centralized data processing engine. In the process of providing data processing services, services are usually provided by providing a standard restful interface, and related objects request to perform data processing tasks through the restful interface, and then the server-side data processing engine performs corresponding data processing, and the server-side data processing system (or data processing engine) usually has a multi-layer architecture.
[0026] As shown in Fig. 1, Fig. 1 is a schematic diagram of the architecture of a data processing engine of the prior art in an embodiment of the present application. As can be seen from Fig. 1, in the prior art, a data processing engine 100 for realizing data processing includes a multi-layer architecture including a content delivery network (CDN) subsystem 200, a load balancing subsystem 300, data sub-processing systems 400-1 to 400-n, a data statistics subsystem 500, a system monitoring subsystem 600, and a data storage subsystem 700.
[0027] The CDN subsystem 200 is used to solve problems such as small network bandwidth and access volume, and can improve the response speed of target devices; the load balancing subsystem 300 is used to distribute and process requests from different target devices to different data processing subsystems; the data processing subsystems are used to process data and obtain processing results; the system monitoring subsystem 600 is used to monitor the operation of the entire data processing system; and the data storage subsystem 700 is used to realize data storage.
[0028] However, current data processing engines are centrally located and have complex configurations, which require significant maintenance costs for deployment and maintenance. A problem occurring in only one subsystem can affect the normal operation of data processing. Although the data processing engine includes a load balancing service, a failure can still affect access to more target devices, exacerbating the impact of system failures. Furthermore, the centralized location of the data processing engine limits the data processing engine's geographical location, making it difficult to expand the scope of data services. Furthermore, upgrading functionality requires service downtime, affecting the normal operation of service data. Furthermore, because conventional data processing engines are typically provided by cloud vendors, service functions tend to be standardized, limiting functional expansion and often relying on the functionality provided by the cloud vendor, preventing users from customizing their own data processing functions.
[0029] Furthermore, in conventional data processing methods, in order to improve performance, data processing engines often adopt one-way authentication methods, which make them susceptible to request attacks and unavoidable losses, posing data security risks and making it difficult to safely store data. Furthermore, since the operation logs of the target device cannot be permanently stored, related past data cannot be tracked. For example, after data replacement, only the latest data after the replacement is saved, and past data before the replacement cannot be referenced. Furthermore, the target device can only obtain processing results from the data processing engine, and cannot check the accuracy of the processing results, making it impossible to determine the accuracy of the data processing results.
[0030] In view of the above, embodiments of the present application propose a data processing method, apparatus, electronic device, computer storage medium, and computer program product, in which a node device in a blockchain system receives a data processing request sent from a target device, and obtains contract identification information, description information of the data to be processed, operation type information for the data to be processed, and target identification information of the target device contained in the data processing request, where one contract identification information is used to identify one smart contract, and one smart contract stores the processing logic of at least one data processing function. Then, based on the contract identification information, the node device searches for the corresponding target smart contract in the stored blockchain, processes the data to be processed according to the processing method corresponding to the operation type information in the target smart contract, obtains a data processing result, and then feeds back the data processing result to the target device.
[0031] In this way, when implementing data processing functions based on data processing requests from target devices, various data processing functions can be realized using node devices in the blockchain system and smart contracts stored in the blockchain. This simplifies the system configuration for performing data processing, and significantly reduces the complexity of maintenance and deployment by converting maintenance and deployment of data processing engines into deployment and updates of smart contracts in the blockchain. Furthermore, the distributed architecture of the blockchain system enables distributed construction of data processing functions. During data processing, data processing can be performed correspondingly for pending data by calling the target smart contract indicated in the data processing request. Therefore, the blockchain makes it easy to deploy various data processing functions in node devices, significantly reducing deployment and maintenance costs for implementing data processing functions and easily expanding data processing services, thereby resolving the problem of service expansion being limited by regional factors. Furthermore, because the blockchain is stored in each node device in the blockchain system, if one node device in the blockchain system fails, the other node devices can still implement the same processing function. Therefore, the failure of one node device does not affect the normal operation of the data processing service, ensuring normal responses to data processing requests without the target device being aware of the failure. In addition, the storage principle of the blockchain system not only allows data generated in the processing process to be stored in the blockchain, but also makes it possible to query and track past data, making it possible to verify the data processing results from the perspective of the target device, thereby ensuring safe data storage and improving the reliability of the data processing results.
[0032] The following describes preferred embodiments of the present application with reference to the drawings. It should be understood that the preferred embodiments described herein are only used to explain and interpret the present application, and do not limit the present application. The embodiments and features in the embodiments of the present application can be combined with each other without contradiction.
[0033] 2, which is a schematic diagram of an application scene in which the embodiment of the present application can be applied, shows a target device 201 and node devices 202 (including node devices 202-1 to 202-m).
[0034] In an embodiment of the present application, the target device 201 is a terminal device where a target object is located, and may be a computer device with a certain computing capability, such as a personal computer, a mobile phone, a tablet PC, a laptop, an e-book reader, a smart home, or an in-vehicle terminal. The target device 201 can send a data processing request to a node device 202 in a blockchain system according to the actual processing needs of the target object, and obtain a data processing result fed back by the node device 202. Here, the node device accessed by the target device may be selected by the target device by the target object, accessed by default based on distance information, or accessed according to possible rules for terminals to access blockchain nodes in related technologies, and the present application is not limited thereto.
[0035] The node device 202 refers to a node within a blockchain system, and may be an independent physical server, a server cluster or distributed system consisting of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), big data and artificial intelligence platforms.
[0036] In an embodiment of the present application, a blockchain smart contract-based data processing engine mainly includes an underlying blockchain system and a smart contract used for data processing. Architecturally, one node device (or node) in the blockchain system mainly includes modules such as a virtual machine, consensus, storage, network, and a smart contract for data processing. Here, a node program for implementing the functions of the blockchain system needs to be deployed on a device that serves as a node in the blockchain system. The program structure of this node program includes four elements: a virtual machine, consensus, storage, and network. It is used to build a smart contract execution environment, can receive data processing requests, invoke smart contracts to complete processing, and store data generated by the processing in the blockchain according to actual processing needs.
[0037] The technical solution proposed in this application can realize data processing for various types of multimedia data in various application scenarios, and the related multimedia data can be video, audio, files, images, etc.
[0038] It should be noted that the processing operations corresponding to the data processing requests initiated by the target device may include, but are not limited to, any one or combination of file format conversion, file content search, file editing, image format conversion, image scaling, image editing, watermark operation, audio format conversion, audio bit rate conversion, audio editing, video format conversion, video compression, video editing, data query, and data statistics, etc.
[0039] According to various data processing needs, the target device 201 can initiate a data processing request based on various data processing needs for multimedia data, and the data processing request includes description information of the data to be processed, contract identification information of the smart contract to be called and executed, operation type information for the data to be processed, and target identification information of the target device.
[0040] Then, after receiving the data processing request, the node device obtains the corresponding target smart contract according to the contract identification information contained in the data processing request, processes the obtained waiting data according to the storage logic bound by this target smart contract, and feeds back the data processing result to the target device 201. Then, if it decides to store the data processing result in the blockchain according to the actual processing needs, during the execution of the target smart contract, it calls the data storage interface to obtain the data storage logic in the blockchain system, and stores it in the blockchain according to the determined data storage logic.
[0041] Hereinafter, first, with reference to the drawings, a data processing process according to an embodiment of the present application will be described in detail from the viewpoint of one node device in a blockchain system.
[0042] It should be noted that in the embodiment of the present application, the blockchain-based data processing engine is a distributed processing system, and a point-to-point (p2p) communication network is generally adopted between node devices. If the network is in good condition in the location where the service is required, only one node (or node device) can be constructed to provide the data processing service, and the scalability is not limited by geographical location.
[0043] When initiating a data processing request, the target device can transmit the data processing request to at least one node device, so that even if a failure occurs in one node (or node device) in the blockchain system, data processing can be executed by other devices without affecting the normal operation of the entire system, and data processing can be performed without the target device noticing the data processing request transmitted from the target device. In the following explanation, a data processing process will be explained using an example of a processing process that can be executed by one node device.
[0044] As shown in Figure 3A, Figure 3A is a flowchart of data processing in an embodiment of the present application. The data processing process in an embodiment of the present application will be described in detail below with reference to Figure 3A.
[0045] In step 301, the node device receives a data processing request sent from the target device, and acquires the contract identification information, description information of the data waiting to be processed, operation type information for the data waiting to be processed, and target identification information of the target device contained in the data processing request.
[0046] In an embodiment of the present application, a node device must first join the blockchain system and become a node in the blockchain system before receiving a data processing request sent from a target device.
[0047] In some embodiments, according to a node deployment scheme in the blockchain system, a node device can be configured as a node in the blockchain system and store a blockchain, where the blockchain includes stored smart contracts for realizing different data processing functions.
[0048] It should be noted that, for node devices in a blockchain system, by selecting some devices and configuring node programs according to actual processing needs, the devices configured with the node programs can become node devices in the blockchain system, or can perform data processing based on a blockchain system maintained by another platform, and achieve data processing functions through the node devices and stored smart contracts in the maintained blockchain system. Here, by configuring the node programs, the node devices can have modules such as virtual machines, consensus, storage, network, and smart contracts for data processing inside them.
[0049] For example, ChainMaker technology, which is currently widely used in China, makes it easy to build a highly powerful and high-performance blockchain system, or you can purchase blockchain services directly.
[0050] In this way, by configuring the processing function of a blockchain node, the device can be constructed as a node device within a blockchain system, providing a processing foundation for realizing data processing based on the data processing requirements of subsequent target devices. Furthermore, with the gradual maturity of current blockchain technology, the deployment and maintenance of blockchain systems has become very simple. Therefore, the data processing system (or data processing engine) constructed by the present application based on a blockchain system can greatly simplify the system configuration and reduce deployment and maintenance costs.
[0051] It should be noted that in the embodiment of the present application, the node device serves as a node in a blockchain system, and stores a blockchain, which stores various transaction data and a smart contract, which is a processing logic for realizing at least one data processing function. Here, the process of creating and storing the blockchain and the process of deploying the smart contract are mature technologies in the field, and the present application does not limit these.
[0052] For example, when deploying a smart contract, after obtaining the smart contract obtained by programming, the smart contract can be stored in the blockchain according to the smart contract deployment method in different blockchain architectures.
[0053] When performing step 301, the node device can receive a data processing request sent from a target device, where the data processing request is constructed by the target device based on description information of the data to be processed and determined contract identification information according to a predetermined field format, and the target smart contract corresponding to the contract identification information includes processing logic to be performed on the data to be processed, and then parse the data processing request according to the field format to obtain the contract identification information, description information of the data to be processed, operation type information for the data to be processed, and target identification information of the target device, where one contract identification information is used to identify one smart contract, and one smart contract stores the processing logic of at least one data processing function.
[0054] In some embodiments, for a data processing request initiated by a target device, the data processing request may be triggered by a web page in the target device, a predetermined application (APP) for the target device, or a designated mini-program page in the target device. The node device may pre-agree on a field format for the data processing request with the target device, so that from the target device's perspective, the target device where the target object is located can generate the data processing request based on the predetermined field format, and from the node device's perspective, the node device can determine the information content included in the data processing request by analyzing the data processing request based on the predetermined field format.
[0055] It should be noted that in the embodiments of the present application, the data processing request may include instruction information on whether to store the data in the blockchain, and an identification statement for the instruction information is configured in the smart contract, so that in the subsequent data processing process, the data that is determined to need to be stored in the blockchain based on the instruction information and the smart contract will be stored.
[0056] For example, the operation algorithm type and request structure format of the data processing request defined by the agreement are: / / Operate algo definition Define the operation algorithm enum OpAlgo{ / / Represents the definition of an operation algorithm for an enumeration type / / Document split algo Define the file splitting algorithm DocSplit=0; / / Define that the number 0 represents the file splitting algorithm / / Picture Compression algo Define the image compression algorithm PicCompression=1; / / Define the number 1 to represent the image compression algorithm / / Music Compression algo defines the audio compression algorithm MusicCompression=2; / / Defines the number 2 as the audio compression algorithm / / Video Rate Compression algo Define the video compression rate algorithm VideoRateCompression=3; / / Define the number 3 to represent the video compression rate algorithm …} message Operate{ / / Represents the defined request structure / / id of data / / Represents the identification information of the data, and represents the corresponding keyword information in the blockchain of the data to be processed. Based on the keyword information, the value stored in the blockchain, i.e., the data waiting to be processed, can be obtained. DataId string=0; / / Indicates that the position where the number is 0 in the data processing request indicates the identification information of the data waiting to be processed / / Op is the op algo for the data. It represents the operation algorithm to be used to process the data type shown in number 0. Op OpAlgo=1; / / Represents the operation algorithm to be used to process the pending data … / / Furthermore, according to actual processing needs, it is also possible to define the number position corresponding to the contract identification information of the smart contract in the data processing request, the number position corresponding to the target identification information, the number position where the instruction information for whether to store the data is located, etc.} As stated above.
[0057] In this way, by defining enumeration type operation algorithms, the data processing functions that node devices can realize are extensible, and by increasing the definition and configuration of operation algorithms, smart contracts for data processing can be realized, making it easy to expand data processing functions (in other words, this is equivalent to expanding processing functions in smart contracts).In addition, the defined field format makes it possible to effectively analyze the content of data processing requests and achieve effective data processing with a standardized request structure.
[0058] It should be noted that in the embodiments of the present application, multiple smart contracts can be defined respectively according to the data types that need to be processed and the processing operations that need to be implemented, or multiple smart contracts can be unified into one smart contract, and the present application is not limited thereto.
[0059] Each smart contract includes a three-layer logical structure: a function interface layer, an algorithm layer, and a storage layer. The function interface layer defines the data processing functions that can be implemented and the parameters on which the data processing depends. The algorithm layer defines the algorithm content for implementing the data processing functions. The storage layer defines the storage format for the data processing results. In other words, the function interface layer defines the functions supported by the smart contract and the parameters that must be passed to implement the functions. The algorithm layer includes the data processing algorithms involved in implementing the data processing and is invoked by the function layer according to actual processing needs. The storage layer is used to store the data finally generated by the algorithm layer. In some embodiments, the encapsulated data storage interface can be invoked in the storage layer to adopt a blockchain storage method in a blockchain system to implement data storage.
[0060] For example, as shown in Figure 3B, which is a schematic diagram of the architecture of each stored smart contract in an embodiment of the present application, it can be seen that for various types of multimedia data, such as files, images, audio, and videos, smart contracts can be established to process the corresponding data, and various smart contracts have the same hierarchical structure.
[0061] In another example, as shown in Figure 3C, Figure 3C is a schematic diagram of functions supported by a smart contract in an embodiment of the present application. As shown in Figure 3C, the realizable functions of a smart contract are defined by the function interface layer of the smart contract. Typical functions include an operation to query corresponding data content based on a data ID, various data operations, billing statistics operations, etc., where data operations can be further classified into multiple operations according to different data types. For example, format conversion operations include format conversion for files, images, audio, and videos.
[0062] It should be noted that, according to actual processing needs, a smart contract may be created by a developer and then placed on the blockchain, or may be created by a target device by a target object and then placed on the blockchain, and this application is not limited thereto. In addition, a smart contract has a general three-layer structure, which is convenient for relevant developers or target objects to program hierarchically, thereby obtaining a smart contract that implements data.
[0063] For example, in a possible implementation, when creating a smart contract that realizes one data processing function A, developer 1 can create the realization code for the function interface layer, developer 2 can create the realization code for the algorithm layer, and developer 3 can create the realization code for the memory layer.Furthermore, by integrating the contents created by developers 1 to 3, a smart contract that realizes data processing function A can be obtained.
[0064] In this way, the entire code corresponding to the smart contract is divided into blocks, which allows multiple people to participate in the smart contract programming process, allowing for the creation of smart contracts with clear internal logic and facilitating the maintenance of smart contracts, thereby reducing not only the difficulty of programming smart contracts but also the difficulty of expanding data processing functions.
[0065] In step 302, the node device searches for the corresponding target smart contract in the stored blockchain based on the contract identification information, processes the waiting data according to the processing method bound by the target smart contract, and obtains a data processing result.
[0066] In an embodiment of the present application, after the node device obtains the target identification information, contract identification information, operation type information for the data to be processed, and description information of the data to be processed contained in the data processing request, if the node device determines, based on the target identification information, that the target device has passed identity authentication, it searches for the corresponding target smart contract in the stored blockchain based on the contract identification information; then, if it determines, based on the target smart contract, target identification information, and operation type information, that the target device has the authority to request the operation corresponding to the operation type information, it obtains the data to be processed; and then determines the function interface in the target smart contract corresponding to the operation type information, and invokes the algorithm content corresponding to the function interface to process the data to be processed.
[0067] In some embodiments, before data processing is performed, it is necessary to first perform identity authentication on the target device. In the verification process, the node device can call the identity authentication processing logic within the blockchain through a predetermined identity authentication interface to perform signature verification on the target device. Here, the identity authentication logic of the blockchain executed in different blockchain system architectures may differ, and the present application follows the processing logic for signature verification in blockchain systems in the related art to perform identity authentication before processing.
[0068] As such, since the blockchain mechanism generally employs two-way authentication, all requests from target devices are generally recorded on the chain as transactions, and all transactions are signed by the target device. Node devices decide to provide services to target devices only after the target device passes signature verification according to the authentication logic in the blockchain system. This makes attacks on node devices more difficult, and even if an attack does occur, signature verification can be used to determine whether the traffic is normal service traffic or attack traffic, thereby reducing unnecessary service costs and mitigating the impact of attacks on data processing engines built on blockchain.
[0069] If the node device subsequently determines that the target device has passed identity authentication, it searches for the corresponding target smart contract in the stored blockchain based on the contract identification information. Here, since the content storage format in the blockchain is usually in the form of keyword-key value (key-value), obtaining the contract identification information is equivalent to obtaining a keyword that can search for the smart contract. Furthermore, the target smart contract can be queried and determined by searching the content of the key value with the contract identification information as a keyword.
[0070] Furthermore, if the node device determines, based on the target smart contract, the target identification information, and the operation type information, that the target device has the authority to initiate the operation corresponding to the operation type information, it acquires the data to be processed.
[0071] In some embodiments, after completing identity authentication at the blockchain system level, the node device verifies whether the target device has the authority to request the operation indicated by the operation type information through the authority authentication logic within the target smart contract before performing processing based on the determined target smart contract, and if it determines that the target device has the authority to request the provision of the corresponding operation, it obtains the data to be processed.
[0072] It should be noted that the target devices that can request services from the node devices are all target devices that have been registered in advance in the blockchain system, so the node devices can configure the authority to request operations from the target devices. Based on this, the smart contract can define the correspondence between the target and the operation authority that the target can request according to actual processing needs.
[0073] For example, a smart contract may maintain a set of objects registered in a blockchain system, and the objects in the set may request node devices to provide services. Each object in the set has a corresponding set of operation permissions representing the processing operations the object may request to be provided.
[0074] In another example, if target 1 determines that it has purchased a data compression service, target 1 has the authority to request an audio data compression operation. Based on this, when target 1 initiates an audio data compression request, the node device can call a target smart contract that realizes a data compression function to realize audio data compression based on the acquired audio data.
[0075] In this way, after the node device completes signature verification, it is equivalent to realizing authority verification for the target device within the target smart contract, and realizing service request authentication for the target device, thereby avoiding providing unauthorized services to the target device.
[0076] It should be noted that when a node device acquires data to be processed, there are two acquisition methods according to different possible scenarios:
[0077] In method 1, the processing-waiting data included in the data processing request is acquired.
[0078] In an embodiment of the present application, when the descriptive information included in the data processing request is used to describe the contents of the data waiting to be processed, the node device determines the data contents determined based on the descriptive information as the acquired data waiting to be processed.
[0079] In some possible scenarios, if the storage space required for the pending data to be processed by the target device is not large and the pending data has not been stored in the blockchain in advance, the data processing request received by the node device may directly include the pending data, and the description information of the received pending data may be used to describe the content of the pending data, thereby directly obtaining the pending data included in the data processing request.
[0080] In method 2, the data waiting to be processed is queried and obtained based on the description information in the data processing request.
[0081] In an embodiment of the present application, when the descriptive information included in the data processing request is used to instruct the determination of the data content stored in the blockchain, the data content obtained by searching from the blockchain based on the descriptive information is determined as the obtained data waiting to be processed, or when the descriptive information is used to describe the storage address of the data waiting to be processed, the data obtained based on the storage address is determined as the data waiting to be processed.
[0082] In some embodiments, in some possible implementation scenarios, when the data to be processed that is requested to be processed is data that has been pre-stored in the blockchain, the descriptive information acquired by the node device can represent a keyword (key) corresponding to the data to be processed in the blockchain, thereby enabling the data to be processed (i.e., the value corresponding to the key) to be acquired based on the keyword.
[0083] In some possible scenarios, when the target device requests that the pending data be stored in the blockchain, the node device first invokes a target smart contract that implements a data storage function based on the data processing request for storing the pending data in the blockchain, stores the pending data in the blockchain based on the processing logic that implements the data storage function in the target smart contract, and feeds back to the target device corresponding key information when the pending data is stored in the blockchain. Furthermore, in response to the data processing request for the pending data, the node device determines description information (i.e., key value) included in the data processing request, and then determines the pending data by searching for a value corresponding to the description information. Here, the value may refer to address information where the pending data is stored. In this case, the node device needs to acquire the pending data based on the acquired address information.
[0084] In some other possible implementation scenarios, when the storage space occupied by the processing-awaiting data requested by the target device is large, the target device instructs that the processing-awaiting data will not be stored in the blockchain, and the processing-awaiting data has not been stored in the blockchain in advance, the description information included in the data processing request received by the node device indicates the address information where the processing-awaiting data is stored, and in this case, the node device needs to obtain the processing-awaiting data based on the address information.
[0085] It should be noted that in the embodiment of the present application, when determining the size of the occupied storage space, the determination can be made based on the relationship between the space occupied by the data to be processed and a set value. If it is determined that the occupied space is greater than the set value, it can be determined that the occupied storage space is large, and if it is determined that the occupied space is less than the set value, it can be determined that the occupied storage space is not large. The contents stored in the blockchain are in key-value format, so that the corresponding key value can be searched and determined using the descriptive information as a key, and the data to be processed can be obtained based on the searched key value.
[0086] Furthermore, when storing large amounts of storage space in a blockchain, if a large amount of storage space is required to store the pending data, the node device can instruct the target device to store the contents of the pending data in a designated cloud or other device according to actual processing needs. The data processing request sent by the target device can include a uniform resource locator (URL) representing the storage location of the pending data. Furthermore, when processing the data storage request, the node device employs processing logic corresponding to the data storage function interface in the designated data storage smart contract to invoke a mature data blockchain storage method in the related technology and store the constructed key-value and defined dictionary content in the blockchain. Here, the data identification information (referred to as data ID) generated by the pending data is the key, the URL corresponding to the pending data is the value corresponding to the key, and the dictionary content defines the data structure of the blockchain storage and is used to indicate the data structure used for storage in the blockchain, i.e., defines the correspondence between keys and values.
[0087] It should be noted that in the embodiment of the present application, a keyword in the dictionary content may be a data ID (i.e., information that can uniquely identify data), and a value in the dictionary content may be a byte array obtained after data serialization according to a specific structure. Specific structures corresponding to all types of data can be defined in the dictionary content, and these structures can be uniformly defined using a data serialization protocol (protobuf: Google Protocol Buffers), and the stored data type can be adjusted according to actual processing needs.
[0088] For example, a typical data structure format is: / / datatype definition Indicates the definition of a data type enum DataType{ / / Represents the definition of an enumerated data type / / Document type of data Data representing the file type Document=0; / / The character 0 represents the data that indicates the file type. / / Picture type of data Picture=1; / / Character 1 represents the data that indicates the image type / / Music type of data Data representing the audio type Music=2; / / Character 2 represents the data that indicates the audio type / / Video type of data Data representing the video type Video=3; / / Character 3 represents the data that indicates the video type …} message Data{ / / Represents the data structure in the stored value / / DataType for data field Represents the data area reserved for the data type. DataType data_type=0 / / Represents the data type information stored at position number 0 in the data structure / / The field "data" is used to hold the binary data to process or store. This field is used to store the binary data after processing or to store it. bytes data=1; / / Indicates that the data content is stored at location number 1 in the data structure. As stated above.
[0089] In another example, suppose one audio data needs to be stored in the blockchain. From the dictionary content, it can be seen that the structure format for storing the audio data in the blockchain is audio data ID-{2; audio data content in binary format}, where the character 2 represents the audio type.
[0090] In this way, by defining a data type that has extensibility for data storage and specifying a smart contract that realizes data processing for data waiting to be processed, when calling the specified smart contract to perform data processing operations, corresponding processing algorithms can be called according to different data types to easily process data, thereby improving data processing efficiency.
[0091] Furthermore, by combining this with the methods for acquiring data waiting to be processed shown in Methods 1 and 2 above, data waiting to be processed can be acquired effectively in a variety of situations.
[0092] In some embodiments, the processing device determines a function interface corresponding to the operation type information in the target smart contract, and invokes the algorithm content corresponding to the function interface to process the pending data and obtain a data processing result.
[0093] In an embodiment of the present application, considering that a smart contract may include at least one function interface to represent at least one processing function that can be realized based on the smart contract, operation type information is included in the data processing request to determine the function interface to be invoked. Here, the function interface layer of the smart contract defines the functions that can be realized by invoking the smart contract, and the function interface in the function interface layer can invoke an algorithm in the algorithm layer of the smart contract. Then, the node device processes the pending data by invoking the algorithm content corresponding to the function interface to obtain a data processing result.
[0094] In this way, the target smart contract and operation type are determined based on the data processing request, and then the data processing service is provided if the target smart contract determines that the target device has passed authentication. Thus, the distributed architecture of the blockchain system can provide data processing functions to each node device, effectively respond to the data processing request of the target device, and ensure the stable progress of data processing.
[0095] In step 303, the node device feeds back the data processing result to the target device.
[0096] In some embodiments, for the acquired data processing result, when executing the target smart contract, the node device determines whether to store the data processing result based on the instruction information included in the data processing request, which indicates whether to store the data processing result. Based on this, the process in which the node device feeds back the data processing result includes the following two types of operations:
[0097] In an embodiment of the present application, the data processing request of the target device includes instruction information instructing whether to store the progress data and the data processing result, and it can be predetermined that a statement identifying the field is configured in the smart contract, so that different processing contents can be executed based on different values of the field.
[0098] In Type 1, the data processing results are fed back directly to the target device.
[0099] In the embodiment of the present application, if the node device determines not to store the data processing result based on the data processing request, it directly feeds back the acquired data processing result to the target device.
[0100] In some embodiments, when executing a target smart contract, if the node device determines that it does not need to store the data processing results, it can directly feed back the data processing results obtained by processing to the target device.
[0101] In Type 2, the data processing result is fed back to the target device, data identification information is generated for the data processing result, and the data identification information and the corresponding data processing result are stored in the blockchain.
[0102] In an embodiment of the present application, if a node device determines to store a data processing result based on a data processing request, it generates corresponding data identification information for the acquired data processing result, feeds back the data processing result to the target device, and stores the data identification information and the corresponding data processing result in each node device in the blockchain system according to the principles of blockchain consensus.
[0103] In some embodiments, when a node device determines that a data processing result needs to be stored during execution of a target smart contract, it will feed back the data processing result obtained through processing to the target device, generate corresponding data identification information for the data processing result, and then, during execution of the target smart contract, call a data storage interface to request the adoption of a blockchain storage method in the blockchain system, and store the data identification information and the corresponding data processing result in each node device in the blockchain system according to the principles of blockchain consensus. Here, the data blockchain storage method is a mature technology in the field, and is not described herein.
[0104] It should also be explained that, with regard to the storage principle of the blockchain system, all generated data processing operations are usually stored in the form of transactions, so that all past operation data can be traced. The storage of this part of past operation data is not affected by the configuration of the target device. The target device can be configured to store or not store data generated in the processing (such as progress data and processing result data). The storage of past operation data can be realized by invoking the storage logic in the blockchain system, and this application is not limited thereto.
[0105] For example, suppose User 1 requests video editing and indicates that the editing results should not be stored. According to the storage principle of the blockchain system, the past operation information of User 1's video editing operations will be stored, but the final editing results will not be stored.
[0106] In this way, the data contents instructed and stored by the target device can be stored according to the storage needs of the target device configuration, thereby enabling differential processing according to the storage needs of different targets.
[0107] It should be noted that in the embodiments of the present application, the adjustment and upgrade of data processing functions can be achieved by upgrading and deploying smart contracts. In other words, when a function is upgraded for the data processing engine of a blockchain system, only the corresponding smart contract needs to be upgraded. Furthermore, the smart contract upgrade process does not affect the services of the smart contract corresponding to the upgraded function and smart contracts corresponding to other functions. During the smart contract upgrade, since the smart contract upgrade transaction and other transactions that invoke this contract have a dependency relationship, the blockchain system automatically sorts and executes each related transaction (or data processing request) in order, thereby ensuring that all transactions are executed accurately.
[0108] In some embodiments, the node device receives a function adjustment processing request for a target data processing function, obtains a smart contract to be stored that includes the adjusted processing logic included in the function adjustment processing request, sorts each of the received data processing requests based on the dependency between the target data processing function and other data processing requests, and processes each of the data processing requests based on the sorting result.
[0109] Furthermore, a smart contract may have dependencies on different transactions that invoke it (processing the same data) or may not have dependencies on each other (processing completely different data), and in either case, whether or not this smart contract is upgraded does not affect the execution relationship between the transactions.
[0110] Assuming there is no dependency between all transactions that invoke the same smart contract, as shown in Figure 3D, Figure 3D is a comparison diagram of the execution order of data processing transactions in an embodiment of the present application. As shown in Figure 3D, when there is no contract upgrade, each data processing transaction (data processing request) is executed in parallel, but when there is a contract upgrade, the contract upgrade transaction and the data processing transaction are executed in series, and the data processing transactions are executed in parallel.
[0111] In this way, the execution order of different data processing requests can be determined, which corresponds to respectively instructing the execution order of the data query and operation process, the data processing process in a trusted computing scenario, and the processing process in which a contract upgrade transaction and a data processing transaction are parallelized. Based on the automatic sorting function in the blockchain system, various transactions can be executed in an orderly manner, so that data processing will not be interrupted when the processing function is upgraded.
[0112] The data processing solution proposed in the embodiments of the present application can also be applied to a trusted computing scenario, and in the case of a node device, a trusted computing environment is configured in the node device for performing trusted computing, where the configuration of a trusted computing environment is a common technique in the art, and the present application does not limit the same.
[0113] For data processing tasks that require trusted computing, there are two possible processing methods based on blockchain according to different security levels: the first processing method is that both the deployment and invocation of smart contracts directly access the trusted computing service to perform trusted computing, and then the calculated data and data ID are stored on the chain; the second processing method is that the deployment and invocation of smart contracts are performed through the blockchain, but the final execution of the contract is performed through the trusted computing environment.
[0114] It should be noted that a data encryption and decryption method is agreed upon between the node device and the target device of the target object, so that the node device can decrypt the encrypted data sent from the target device.
[0115] In the first processing scheme, the node device receives a trusted processing request triggered by the target device for encrypted data, obtains the encrypted data, the encrypted smart contract, the trusted operation type information for the encrypted data, and the target identification information of the target device contained in the trusted processing request, and then, in the constructed trusted computing environment, decrypts it based on the encrypted smart contract to obtain the corresponding trusted smart contract. If it determines that the target device has the authority to request the operation corresponding to the trusted computing type information, decrypts it based on the encrypted data to obtain the target data, and employs the trusted computing logic bound in the trusted smart contract to process the target data to obtain a trusted computing result. Then, stores the trusted computing result in the blockchain and feeds back keyword information corresponding to the trusted computing result to the target device.
[0116] In some embodiments, in a first processing scheme, after the node device obtains the encrypted data, the encrypted smart contract, the target identification information of the target device, and the trusted computing type information for the encrypted data contained in the trusted processing request, in the trusted computing environment, it performs the following operations: decrypting the encrypted smart contract, and if it determines, based on the decrypted trusted smart contract, the target identification information of the target device, and the trusted computing type information, that the target device has the authority to request an operation corresponding to the trusted computing type, decrypting the encrypted data to obtain the target data; and employing the trusted computing logic in the trusted smart contract that matches the trusted computing type information to invoke an algorithm to process the target data and obtain a trusted computing result.
[0117] In some embodiments, in the process of storing data in the blockchain, after the node device executes the trusted smart contract in the trusted computing environment to obtain the trusted computing result, it can subsequently call the data storage interface through the trusted smart contract, thereby adopting the data storage method in the blockchain system to store the data in the blockchain.
[0118] For example, as shown in Figure 4A, Figure 4A is a schematic diagram of an implementation process of trusted computing processing in an embodiment of the present application. The following describes the process of performing trusted computing based on private data when the related object ground is obtained, with reference to Figure 4A.
[0119] In step 41, the target device sends a private data computing request to the node device, which includes encrypted private data, an encrypted private contract, the target device's identification information, and trusted computing type information.
[0120] In step 42, the node device transmits the contents included in the private data computing request to the trusted computing environment.
[0121] In step 43, the node device decrypts the encrypted private contract in the trusted computing environment to obtain the private contract.
[0122] In step 44, the node device determines, in the trusted computing environment, based on the correspondence between the target information and the trusted computing type in the private contract, that the target device has the authority to initiate an operation corresponding to the trusted computing type information.
[0123] In step 45, the node device, in the trusted computing environment, decrypts the encrypted data to obtain the target data and invokes the contract engine to execute the private contract.
[0124] In step 46, the node device generates a unique data ID for the trusted computing result in the trusted computing environment and stores the data ID and the corresponding trusted computing result in the blockchain.
[0125] In some embodiments, processing logic for performing data storage in a blockchain system can be obtained by invoking a data storage interface encapsulated in a storage layer in a private contract, and storage can be implemented in the blockchain.
[0126] In step 47, the node device feeds back the data ID to the target device in the trusted computing environment.
[0127] In this way, by obtaining the encrypted smart contract and data to be processed, as well as the indicated trusted computing type according to the needs of trusted computing, it is possible to realize effective processing in the trusted computing environment and ensure the safety of data processing.
[0128] In the second processing scheme, the smart contract to be executed in the trusted computing environment is encrypted and stored in the blockchain, and the data content to be processed is also pre-encrypted and stored in the blockchain system. In this case, data processing can be performed according to the normal data processing process shown in Figure 3A.
[0129] In this case, when the node device is configured to perform trusted computing and the data processing request is used to perform trusted processing on encrypted data, the contract identification information in the data processing request is used to identify the encrypted and stored trusted smart contract in the blockchain, the description information is used to describe the encrypted and stored target data, and the operation type information represents the requested trusted computing type information; further, when performing trusted computing, the node device decrypts the encrypted and stored trusted smart contract in the constructed trusted computing environment to obtain the trusted smart contract, and if it determines that the target device has the authority to request the operation corresponding to the trusted computing type information, decrypts the encrypted and stored target data to obtain the target data, and processes the target data according to the trusted computing logic bound in the trusted smart contract.
[0130] For example, as shown in Figure 4B, Figure 4B is a schematic diagram of another implementation process of trusted computing processing in an embodiment of the present application. The following describes the process of performing trusted computing based on private data when the related object ground is obtained, with reference to Figure 4B.
[0131] In step 4b-1, the target device sends a private data computing request to the node device, which includes the contract identification information of the encrypted private contract, the description information of the encrypted data, the target identification information of the target device, and the trusted computing type information.
[0132] In step 4b-2, the node device receives the content included in the private data computing request, and obtains the encrypted private contract and encrypted data based on the contract identification information and description information.
[0133] In step 4b-3, the node device decrypts the encrypted private contract in the trusted computing environment to obtain the private contract.
[0134] In step 4b-4, the node device determines, in the trusted computing environment, based on the correspondence between the target information and the trusted computing type in the private contract, that the target device has the authority to request the operation corresponding to the trusted computing type information.
[0135] In step 4b-5, the node device, in the trusted computing environment, decrypts the encrypted data to obtain the target data and invokes the contract engine to execute the private contract.
[0136] In step 4b-6, the node device generates a unique data ID for the trusted computing result in the trusted computing environment and stores the data ID and the corresponding trusted computing result in the blockchain.
[0137] In some embodiments, processing logic for performing data storage in a blockchain system can be obtained by invoking a data storage interface encapsulated in a storage layer in a private contract, and storage can be implemented in the blockchain.
[0138] In step 4b-7, the node device feeds back the data ID to the target device in the trusted computing environment.
[0139] In this way, by integrating the steps of realizing trusted computing into normal data processing processes, trusted computing can be realized based on smart contracts and target data encrypted and stored in the blockchain.
[0140] Next, we will use examples to explain the process of calling smart contracts to perform query and operation processing in various data processing processes.
[0141] As shown in Figure 5, Figure 5 is a flowchart of invoking a smart contract to execute a transaction in an embodiment of the present application. The following describes the process of invoking a query and operation with reference to Figure 5.
[0142] In step 501, the target device constructs a data processing request.
[0143] In step 502, the node device receives a data processing request and acquires the contract identification information, description information of the data to be processed, operation type information, and target identification information contained in the data processing request.
[0144] In step 503, the node device performs signature verification on the target device and determines that the identity of the target device has been successfully authenticated.
[0145] In step 504, the node device searches the blockchain for the target smart contract to execute based on the contract identification information.
[0146] In step 505, the node device determines whether the target device has the authority to request the operation corresponding to the operation type information. If yes, the node device executes step 507; if no, the node device executes step 506.
[0147] In step 506, the node device feeds back processing failure indication information to the target device.
[0148] In step 507, the node device searches the blockchain for pending data based on the description information.
[0149] In step 508, the node device determines the name of the function to be called in the target smart contract based on the operation type information, and calls the function.
[0150] In step 509, the node device performs data processing by calling a corresponding algorithm based on the determined functional function, and obtains a data processing result.
[0151] In step 510, the node device determines whether the target device has instructed to store the data processing result, and if so, executes step 512; otherwise, executes step 511.
[0152] In step 511, the node device transmits the data processing result to the target device.
[0153] In step 512, the node device generates a data ID for the data processing result, uses the data ID as keyword information, and stores the data ID and the corresponding data processing result in the blockchain after the block packing, verification, and submission are completed by consensus.
[0154] In step 513, the node device feeds back the data processing result and the data ID to the target device.
[0155] Therefore, the data processing solution proposed in this application proposes an overall architecture for a data processing engine based on blockchain smart contracts. Each smart contract has a versatile contract hierarchical structure, making it easy for developers to program it hierarchically. Data processing functions are realized by executing the smart contract. Furthermore, by providing an extensible data type definition for the data type to be stored, the smart contract realizing the data processing function can call corresponding processing algorithms to process data according to different data types. Furthermore, the smart contract realizing the data processing function has an extensible function layer interface definition, allowing new functions to be added and realized through programming according to actual processing needs. Furthermore, by providing an extensible data operation type definition, the target device can define the request structure of a data processing request, thereby enabling data with a specified data ID to be processed using a specified algorithm. Furthermore, a transaction sorting function in the blockchain system can provide a processing order for data query and operation processes, data processing processes in trusted computing scenarios, and parallel processing of contract upgrade transactions and data processing transactions.
[0156] Furthermore, upgrades to data processing functions do not affect services. The actual data processing of the blockchain-based data processing engine is achieved using smart contracts. Contract upgrades are performed as operations at the same level as requests for blockchain data storage and data processing, so they can be carried out transparently without affecting service operation. By creating smart contracts to implement data processing functions, relevant entities can implement data processing algorithms with customized configurations based on the blockchain, allowing for unlimited functional expansion. Furthermore, due to the traceability of historical data in blockchain systems, all data processing operations of the blockchain-based data processing engine are stored in the form of transactions, allowing all historical data to be traced. Related entities can query operation logs from node devices and perform data statistics and billing themselves. Furthermore, the high security of data storage in blockchain systems eliminates data security risks. In special data-sensitive scenarios, data security can be protected by choosing to encrypt data and contracts and store them on the blockchain, or by directly executing smart contracts and target data using trusted computing.
[0157] Based on the same technical concept, as shown in Figure 6, Figure 6 is a schematic diagram showing the logical structure of a data processing device in an embodiment of the present application. The data processing device 600 includes a receiving unit 601, a processing unit 602, and a feedback unit 603; The receiving unit 601 is configured to receive a data processing request sent from the target device, and obtain the contract identification information, description information of the data to be processed, operation type information for the data to be processed, and target identification information of the target device contained in the data processing request, where one contract identification information is used to identify one smart contract, and one smart contract stores the processing logic of at least one data processing function, the processing unit 602 is configured to search for the corresponding target smart contract in the stored blockchain based on the contract identification information, and process the data to be processed according to the processing method corresponding to the operation type information in the target smart contract to obtain a data processing result, and the feedback unit 603 is configured to feedback the data processing result to the target device.
[0158] In some embodiments, each smart contract includes a three-layer logical structure: a function interface layer, an algorithm layer, and a memory layer. The function interface layer is used to define the data processing functions that can be realized and the parameters on which the data processing depends. The algorithm layer is used to define the content of the algorithm that realizes the data processing functions. The memory layer is used to define the storage format of the data processing results.
[0159] In some embodiments, when the node device is configured to perform trusted computing and the data processing request is used to request that trusted processing be performed on encrypted data, the contract identification information is used to identify an encrypted and stored trusted smart contract in the blockchain, the description information is used to describe the encrypted and stored target data, and the operation type information represents the requested trusted computing type information; When searching for a corresponding target smart contract in the stored blockchain based on the contract identification information and processing the waiting data according to the processing manner corresponding to the operation type information in the target smart contract, the processing unit 602 is configured to: decrypt the encrypted and stored trusted smart contract in the constructed trusted computing environment to obtain the trusted smart contract; if it determines that the target device has the authority to request the operation corresponding to the trusted computing type information, decrypt the encrypted and stored target data to obtain the target data, and process the target data according to the trusted computing logic bound in the trusted smart contract.
[0160] In some embodiments, when the node device is configured to perform data processing in a trusted computing mode, the data processing device further includes a computing unit 604. The computing unit 604 is configured to receive a trusted processing request triggered by the target device for encrypted data, obtain the encrypted data, the encrypted smart contract, trusted computing type information for the encrypted data, and the target identification information of the target device included in the trusted processing request, decrypt the encrypted data based on the encrypted smart contract to obtain the corresponding target smart contract in the constructed trusted computing environment, and if it is determined that the target device has the authority to request the operation corresponding to the trusted computing type information, decrypt the encrypted data to obtain the target data, and employ the trusted computing logic bound in the target smart contract to process the target data to obtain a trusted computing result, store the trusted computing result in the blockchain, and feed back keyword information corresponding to the trusted computing result to the target device.
[0161] In some embodiments, before receiving a data processing request sent from the target device, the receiving unit 601 is configured to configure the node device as a node in the blockchain system according to a node deployment scheme in the blockchain system and store smart contracts for realizing different data processing functions.
[0162] In some embodiments, when receiving a data processing request sent from a target device and obtaining contract identification information, description information of the data to be processed, and target identification information of the target device included in the data processing request, the receiving unit 601 is configured to perform the following steps: receiving the data processing request sent from the target device, where the data processing request is constructed based on the description information of the data to be processed and the determined contract identification information according to a predetermined field format, and the target smart contract corresponding to the contract identification information includes processing logic to be executed on the data to be processed; and parsing the data processing request according to the field format to obtain the contract identification information, description information of the data to be processed, and target identification information of the target device.
[0163] In some embodiments, when searching for a corresponding target smart contract in the stored blockchain based on the contract identification information and processing the pending data according to a processing manner corresponding to the operation type information in the target smart contract, the processing unit 602 is configured to: if it determines, based on the target identification information, that the target device has passed identity authentication; if it determines, based on the target smart contract, the target identification information, and the operation type information, that the target device has the authority to initiate an operation corresponding to the operation type information; obtain the pending data, determine a function interface corresponding to the operation type information in the target smart contract, and invoke algorithm content corresponding to the function interface to process the pending data.
[0164] In some embodiments, when feeding back the data processing result to the target device, the processing unit 602 is configured to: if it determines to store the data processing result based on the data processing request, generate corresponding data identification information for the acquired data processing result, feed back the data processing result to the target device, and store the data identification information and the corresponding data processing result in each node device in the blockchain system according to the principles of blockchain consensus; and if it determines not to store the data processing result based on the data processing request, feed back the acquired data processing result directly to the target device.
[0165] In some embodiments, when retrieving the data to be processed, the processing unit 602 is configured to perform one of the following operations: if the descriptive information is used to instruct the determination of data content stored in the blockchain, determine the data content retrieved from the blockchain based on the descriptive information as the retrieved data to be processed; if the descriptive information is used to describe the content of the data to be processed, determine the data content determined based on the descriptive information as the retrieved data to be processed; if the descriptive information is used to describe the storage address of the data to be processed, determine the retrieved data based on the storage address as the data to be processed.
[0166] In some embodiments, the data processing device further comprises a sorting unit 605, which is configured to perform the steps of receiving a function adjustment processing request for a target data processing function and obtaining a to-be-stored smart contract included in the function adjustment processing request, where the to-be-stored smart contract includes the adjusted processing logic; and sorting each of the received data processing requests based on dependencies between the target data processing function and other data processing requests, and processing each of the data processing requests based on the sorting result.
[0167] Having described the data processing method and apparatus of the exemplary embodiment of the present application, an electronic device according to another exemplary embodiment of the present application will now be described.
[0168] Those skilled in the art will appreciate that various aspects of the present application may be embodied as a system, method, or program product. Accordingly, various aspects of the present application may be embodied in an entirely hardware embodiment, an entirely software embodiment (including firmware, microcode, etc.), or an embodiment combining both hardware and software, which may be collectively referred to herein as a "circuit," "module," or "system."
[0169] Based on the same technical concept as the above-described embodiments, an embodiment of the present application further provides an electronic device, as shown in Fig. 7, which is a schematic diagram showing a hardware configuration of an electronic device to which the embodiment of the present application is applied. The electronic device 700 includes at least a processor 701 and a memory 702. Here, the memory 702 stores program code, and when the program code is executed by the processor 701, the processor 701 executes any one of the above-described data processing steps.
[0170] In some possible embodiments, a computing device according to the present application may include at least one processor and at least one memory, where the memory stores program code that, when executed by the processor 701, causes the processor to perform data processing steps according to various embodiments of the present application described herein. For example, the processor may perform the steps shown in FIG. 3A.
[0171] Hereinafter, a computing device 800 according to this embodiment of the present application will be described with reference to Fig. 8. As shown in Fig. 8, the computing device 800 is represented in the form of a general-purpose computing device. Components of the computing device 800 may include, but are not limited to, at least one processing unit 801 described above, at least one storage unit 802 described above, and a bus 803 connecting different system components (including the storage unit 802 and the processing unit 801).
[0172] Bus 803 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, a processor, or a local area bus using any of several bus structures.
[0173] The storage unit 802 may include readable media in the form of volatile memory such as random access memory (RAM) 8021 and / or cache memory 8022 , and may also include read only memory (ROM) 803 .
[0174] The storage unit 802 may further include a program / utility 8025 having a set (at least one) program module 8024, including, but not limited to, an operating system, one or more applications, other program modules, and program data, each or some combination of these examples may include implementing a network environment.
[0175] Computing device 800 may also communicate with one or more external devices 804 (e.g., a keyboard, a pointing device, etc.), one or more devices that enable interaction between objects and computing device 800, and / or any device (e.g., a router, a modem, etc.) that enables computing device 800 to communicate with one or more other computing devices. Such communication may occur via input / output (I / O) interface 805. Computing device 800 may also communicate with one or more networks (such as a local area network (LAN), a wide area network (WAN), and / or a public network such as the Internet) via network adapter 806. As shown, network adapter 806 communicates with other modules of computing device 800 via bus 803. It should be understood that, although not shown, other hardware and / or software modules may be used in conjunction with computing device 800, including, but not limited to, microcode, device drivers, redundant processors, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0176] Based on the same technical concept as the above examples, each aspect of data processing provided by the present application may be realized in the form of a program product including program code, and when the program product is executed in an electronic device, the program code causes the electronic device to perform the data processing steps according to various embodiments of the present application described in this specification, for example, the electronic device can perform the steps shown in FIG. 3A.
[0177] The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. Readable storage media (a non-exhaustive list) include those electrically connected by one or more wire leads, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above.
[0178] Although the preferred embodiments of the present application have been described, those skilled in the art can make further changes and modifications to these embodiments once they understand the basic creative concept. Therefore, it is intended that the appended claims be interpreted to include all changes and modifications that are within the scope of the preferred embodiments and the present application.
[0179] Obviously, those skilled in the art can make various modifications and variations to the present application without departing from the spirit and scope of the present application. Therefore, if these modifications and variations of the present application fall within the scope of the claims of the present application and the equivalent technology, the present application also intends to include these modifications and variations.
Claims
1. A data processing method executed by a node device in a blockchain system, receiving a data processing request sent from a target device, and acquiring contract identification information, description information of data to be processed, operation type information for the data to be processed, and target identification information of the target device included in the data processing request, wherein one contract identification information is used to identify one smart contract, and the one smart contract stores processing logic for at least one data processing function; Searching for a corresponding target smart contract in the stored blockchain based on the contract identification information, and processing the waiting data according to a processing method corresponding to the operation type information in the target smart contract to obtain a data processing result; feeding back the data processing result to the target device; The data processing method includes: receiving a function adjustment processing request for a target data processing function, and acquiring a smart contract to be stored included in the function adjustment processing request, wherein the smart contract to be stored includes processing logic after adjustment; sorting each of the received data processing requests based on the dependency relationship between the target data processing function and other data processing requests, and processing each of the data processing requests based on the sorting result, Data processing methods.
2. Each smart contract includes a three-layer logical structure: a function interface layer, an algorithm layer, and a memory layer. The function interface layer is used to define the data processing functions that can be implemented and the parameters on which the data processing depends. The algorithm layer is used to define the content of the algorithm that implements the data processing functions. The memory layer is used to define the storage format of the data processing results. The data processing method according to claim 1 .
3. When the node device is configured to perform trusted computing and the data processing request is used to request that trusted processing be performed on encrypted data, the contract identification information is used to identify an encrypted and stored trusted smart contract in a blockchain, the description information is used to describe the encrypted and stored target data, and the operation type information represents requested trusted computing type information; The step of searching for a corresponding target smart contract in the stored blockchain based on the contract identification information, and processing the waiting data according to a processing manner corresponding to the operation type information in the target smart contract, Decrypting the encrypted and stored trusted smart contract in the constructed trusted computing environment to obtain the trusted smart contract; If the target device determines that it has the authority to request the operation corresponding to the trusted computing type information, decrypting the encrypted and stored target data to obtain the target data; processing the target data according to trusted computing logic bound in the trusted smart contract; The data processing method according to claim 1 .
4. When the node device is configured to perform data processing in a trusted computing mode, the data processing method includes: receiving a trusted processing request triggered by a target device for encrypted data, and obtaining the encrypted data, the encrypted smart contract, trusted computing type information for the encrypted data, and target identification information of the target device included in the trusted processing request; In the constructed trusted computing environment, decrypting the encrypted smart contract to obtain a corresponding target smart contract; If the target device determines that it has the authority to request the operation corresponding to the trusted computing type information, decrypting the encrypted data to obtain target data; Employing trusted computing logic bound in the target smart contract to process the target data to obtain a trusted computing result; Storing the trusted computing result in a blockchain and feeding back keyword information corresponding to the trusted computing result to the target device. The data processing method according to claim 1 .
5. Before receiving a data processing request transmitted from the target device, the data processing method includes: The method includes configuring the node devices as nodes in the blockchain system according to a node allocation method in the blockchain system, and storing smart contracts in the node devices to realize different data processing functions. The data processing method according to claim 1 .
6. receiving a data processing request transmitted from the target device, and acquiring contract identification information, description information of data waiting to be processed, and target identification information of the target device, which are included in the data processing request; receiving a data processing request sent from a target device, wherein the data processing request is constructed by the target device according to a predetermined field format based on description information of data to be processed and determined contract identification information, and a target smart contract corresponding to the contract identification information includes processing logic that needs to be performed on the data to be processed; analyzing the data processing request according to the field format to obtain the contract identification information, description information of the data to be processed, and target identification information of the target device; The data processing method according to claim 1 .
7. The step of searching for a corresponding target smart contract in the stored blockchain based on the contract identification information, and processing the waiting data according to a processing manner corresponding to the operation type information in the target smart contract, When determining that the target device has passed identity authentication based on the target identification information, searching for a corresponding target smart contract in the stored blockchain based on the contract identification information; If it is determined based on the target smart contract, the target identification information, and the operation type information that the target device has the authority to initiate the operation corresponding to the operation type information, acquiring the waiting data; Determining a function interface corresponding to the operation type information in the target smart contract, and calling an algorithm content corresponding to the function interface to process the pending data; The data processing method according to claim 1 .
8. The step of feeding back the data processing result to the target device includes: If it is determined to store the data processing result based on the data processing request, generating corresponding data identification information for the acquired data processing result, feeding back the data processing result to the target device, and storing the data identification information and the corresponding data processing result in each node device in the blockchain system according to the principles of blockchain consensus; and when it is determined based on the data processing request that the data processing result not be stored, directly feeding back the acquired data processing result to the target device. The data processing method according to claim 7.
9. The step of acquiring the data to be processed includes: When the description information is used to instruct the determination of data content stored in the blockchain, determining the data content obtained by retrieving from the blockchain based on the description information as the acquired data to be processed; if the description information is used to describe the content of the data to be processed, determining the data content determined based on the description information as the acquired data to be processed; and when the description information is used to describe a storage address of data to be processed, determining data acquired based on the storage address as data to be processed. The data processing method according to claim 7.
10. 1. A data processing device, comprising: A receiving unit, a processing unit, and a feedback unit, The receiving unit is configured to receive a data processing request sent from a target device, and obtain contract identification information, description information of data to be processed, operation type information for the data to be processed, and target identification information of the target device included in the data processing request, wherein one contract identification information is used to identify one smart contract, and the one smart contract stores processing logic of at least one data processing function; The processing unit is configured to search for a corresponding target smart contract in the stored blockchain based on the contract identification information, and process the waiting data according to a processing manner corresponding to the operation type information in the target smart contract to obtain a data processing result; the feedback unit is configured to feed back the data processing result to the target device; the data processing device further comprises a sorting unit; The sorting unit receiving a function adjustment processing request for a target data processing function, and obtaining a smart contract to be stored included in the function adjustment processing request, wherein the smart contract to be stored includes processing logic after adjustment; and sorting each of the received data processing requests based on the dependency relationship between the target data processing function and other data processing requests, and processing each of the data processing requests based on the sorting result; configured to: Data processing device.
11. Each smart contract includes a three-layer logical structure: a function interface layer, an algorithm layer, and a memory layer. The function interface layer is used to define the data processing functions that can be implemented and the parameters on which the data processing depends. The algorithm layer is used to define the content of the algorithm that implements the data processing functions. The memory layer is used to define the storage format of the data processing results.
11. A data processing device according to claim 10.
12. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable by the processor, wherein the processor, when executing the computer program, realizes the data processing method according to any one of claims 1 to 9.
13. A computer program which, when executed by a processor, causes the processor to carry out the data processing method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Intelligent contract execution method, device and system, storage medium and electronic equipment
CN112632573A
Method and apparatus for maintaining private data using a consortium blockchain
JP2022547853A
Blockchain-based data processing method, and blockchain node apparatus
WO2022247385A1