CN117633903A - Data processing method based on block chain network, related equipment and product - Google Patents

Data processing method based on block chain network, related equipment and product Download PDF

Info

Publication number
CN117633903A
CN117633903A CN202210953416.XA CN202210953416A CN117633903A CN 117633903 A CN117633903 A CN 117633903A CN 202210953416 A CN202210953416 A CN 202210953416A CN 117633903 A CN117633903 A CN 117633903A
Authority
CN
China
Prior art keywords
contract execution
execution information
contract
transaction
blockchain network
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210953416.XA
Other languages
Chinese (zh)
Inventor
王宗友
时一防
刘区城
朱耿良
廖志勇
刘汉卿
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202210953416.XA priority Critical patent/CN117633903A/en
Publication of CN117633903A publication Critical patent/CN117633903A/en
Pending legal-status Critical Current

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The embodiment of the application discloses a data processing method based on a block chain network, related equipment and a product. The method comprises the following steps: in response to a request for a uplink to a transaction, invoking at least one intelligent contract in the blockchain network to perform the transaction, recording contract execution information for the at least one intelligent contract during execution of the transaction, the contract execution information including at least one of: contract execution results and contract execution logs; constructing the merck tree based on the contract execution information, and adding the root node of the merck tree as check data of the contract execution information to the blockchain, and returning the contract execution information to a sender of the uplink request. It can be seen that by generating the verification data of the contract execution information, the sender of the uplink request can verify the contract execution information based on the verification data, thereby improving the reliability of the contract execution information (including the execution result of the transaction).

Description

Data processing method based on block chain network, related equipment and product
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a data processing method, apparatus, device, computer readable storage medium and product based on a blockchain network.
Background
With the progress of scientific research, blockchain technology is widely used in daily life due to its traceable nature; such as product traceability, transaction evidence, etc. In processing a uplink request for a transaction, a blockchain network node is typically required to return the results of the execution of the transaction to the sender of the uplink request. It has been found that there is a risk of the execution result being falsified or tampered with in the course of the blockchain network node returning the execution result of the transaction to the sender of the uplink request.
Disclosure of Invention
The embodiment of the application provides a data processing method, device, equipment, a computer readable storage medium and a product based on a blockchain network, which can improve the reliability of the execution result of a transaction.
In one aspect, an embodiment of the present application provides a data processing method based on a blockchain network, including:
invoking at least one intelligent contract in the blockchain network to execute the transaction in response to the uplink request for the transaction;
recording at least one contract execution information that is intelligent about in executing the transaction, the contract execution information including at least one of: contract execution results and contract execution logs;
Constructing a merck tree based on the contract execution information, and adding the root node of the merck tree as check data of the contract execution information to the blockchain;
contract execution information is returned to the sender of the uplink request.
In an embodiment of the present application, in response to a request for uplink of a transaction, at least one intelligent contract in a blockchain network is invoked to execute the transaction, and contract execution information of the at least one intelligent contract in a transaction executing process is recorded, wherein the contract execution information comprises at least one of the following: contract execution results and contract execution logs; constructing the merck tree based on the contract execution information, and adding the root node of the merck tree as check data of the contract execution information to the blockchain, and returning the contract execution information to a sender of the uplink request. It can be seen that by generating the verification data of the contract execution information, the sender of the uplink request can verify the contract execution information based on the verification data, thereby improving the reliability of the contract execution information (including the execution result of the transaction).
In one aspect, an embodiment of the present application provides a data processing method based on a blockchain network, including:
sending a uplink request for a transaction to a blockchain network node, so that the blockchain network node calls at least one intelligent contract in the blockchain network to execute the transaction, records contract execution information of at least one intelligent contract in the process of executing the transaction, constructs a merck tree based on the contract execution information, and adds the root node of the merck tree to the blockchain as verification data of the contract execution information;
Receiving contract execution information returned by the block chain network node;
wherein the contract execution information includes at least one of: and (3) a contract execution result corresponding to the uplink request, and a contract execution log corresponding to the uplink request.
In the embodiment of the application, a uplink request for a transaction is sent to a blockchain network node, so that the blockchain network node calls at least one intelligent contract in a blockchain network to execute the transaction, records contract execution information of at least one intelligent contract in the process of executing the transaction, constructs a merck tree based on the contract execution information, and adds root nodes of the merck tree as verification data of the contract execution information to a blockchain; receiving contract execution information returned by the block chain network node; wherein the contract execution information includes at least one of: and (3) a contract execution result corresponding to the uplink request, and a contract execution log corresponding to the uplink request. It can be seen that after receiving the contract execution information returned by the blockchain network node, the sender of the uplink request can verify the contract execution information based on the verification data corresponding to the contract execution information on the blockchain, thereby improving the reliability of the contract execution information (including the execution result of the transaction).
In one aspect, an embodiment of the present application provides a data processing apparatus based on a blockchain network, the data processing apparatus including:
a processing unit for invoking at least one intelligent contract in the blockchain network to execute the transaction in response to the uplink request for the transaction;
and means for recording contract execution information for at least one intelligent contract in the course of executing the transaction, the contract execution information including at least one of: contract execution results and contract execution logs;
and the system is used for constructing the merck tree based on the contract execution information and adding the root node of the merck tree as verification data of the contract execution information to the blockchain;
and the sending unit is used for returning contract execution information to the sender of the uplink request.
In one embodiment, the contract execution information includes a contract execution log; the processing unit is further configured to:
if at least one intelligent contract detects that the uplink request does not meet the uplink condition in the process of executing the transaction, recording violation information corresponding to the uplink request in a contract execution log.
In one embodiment, the processing unit is configured to record at least one contract execution information that is intelligent about the process of executing the transaction, and is specifically configured to:
Recording, by a contract recording function, contract execution information for at least one intelligent contract during execution of the transaction;
wherein the contract recording function includes at least one of the following fields: a type field, an index field, a data field; the type field indicates the type of the contract execution information, and the index field screens the contract execution information.
In one embodiment, the processing unit is configured to construct a merck tree based on the contract execution information, and add the root node of the merck tree as check data of the contract execution information to the blockchain, specifically configured to:
adding contract execution information to a to-be-stored certificate set, wherein the to-be-stored certificate set comprises one or more contract execution information;
when the to-be-stored evidence collection is detected to meet the evidence storage condition, constructing a merck tree based on one or more contract execution information in the to-be-stored evidence collection;
the hash value of the root node of the merck tree is used as check data of contract execution information, and the check data is added into the target block.
In one embodiment, the processing unit is configured to, when detecting that the set of to-be-stored credentials satisfies the credentials storing condition, construct a merck tree based on one or more contracts execution information in the set of to-be-stored credentials, specifically configured to:
When the to-be-stored evidence collection is detected to meet the evidence storage conditions, calculating hash values corresponding to all contract execution information in the to-be-stored evidence collection;
taking hash values corresponding to the contract execution information as leaf nodes of the merck tree, and constructing the merck tree;
wherein, the to-be-stored evidence collection meets the evidence storage condition and comprises any one of the following: the current moment is matched with the preset evidence storage time, and the quantity of contract execution information in the evidence storage set reaches a quantity threshold.
In one embodiment, the processing unit is configured to construct a merck tree based on the contract execution information, and add the root node of the merck tree as check data of the contract execution information to the blockchain, specifically configured to:
constructing a merck tree based on the contract execution information, and adding the root node of the merck tree as verification data of the contract execution information to the block header of the target block.
In one embodiment, the processing unit is further configured to:
acquiring at least one intelligent contract to be deployed;
the at least one smart contract to be deployed is deployed in response to a consensus of the at least one smart contract to be deployed through the blockchain network.
In one aspect, an embodiment of the present application provides a data processing apparatus based on a blockchain network, the data processing apparatus including:
A sending unit, configured to send a request for uplink of a transaction to a blockchain network node, so that the blockchain network node invokes at least one intelligent contract in the blockchain network to perform the transaction, records contract execution information of at least one intelligent contract in a process of performing the transaction, constructs a merck tree based on the contract execution information, and adds a root node of the merck tree as verification data of the contract execution information to the blockchain;
the receiving unit is used for receiving contract execution information returned by the block chain network node;
wherein the contract execution information includes at least one of: and (3) a contract execution result corresponding to the uplink request, and a contract execution log corresponding to the uplink request.
In one embodiment, the blockchain network-based data processing device further includes a processing unit, the contract execution information including a contract execution log; if the uplink request does not meet the uplink condition, the processing unit is configured to:
obtaining violation information existing in the uplink request from a contract execution log;
wherein the violation information is detected by at least one intelligent party in the course of executing the transaction.
In one embodiment, the verification data of the contract execution information includes a hash value of a root node of the merck tree generated based on the contract execution information; the processing unit is further configured to:
Acquiring certification information which is returned by the block chain network node and is associated with contract execution information;
based on the contract execution information and the proving information, obtaining to-be-verified data corresponding to the contract execution information;
obtaining check data from a blockchain;
if the verification data is matched with the data to be verified, judging that the contract execution information passes the verification.
Accordingly, the present application provides an intelligent device, the device comprising:
a processor for loading and executing the computer program;
a computer readable storage medium having a computer program stored therein, which when executed by a processor, implements the blockchain network-based data processing method described above.
Accordingly, the present application provides a computer readable storage medium storing a computer program adapted to be loaded by a processor and to perform the above described blockchain network based data processing method.
Accordingly, the present application provides a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions to cause the computer device to perform the data processing method based on the blockchain network.
In an embodiment of the present application, in response to a request for uplink of a transaction, at least one intelligent contract in a blockchain network is invoked to execute the transaction, and contract execution information of the at least one intelligent contract in a transaction executing process is recorded, wherein the contract execution information comprises at least one of the following: contract execution results and contract execution logs; constructing the merck tree based on the contract execution information, and adding the root node of the merck tree as check data of the contract execution information to the blockchain, and returning the contract execution information to a sender of the uplink request. It can be seen that by generating the verification data of the contract execution information, the sender of the uplink request can verify the contract execution information based on the verification data, thereby improving the reliability of the contract execution information (including the execution result of the transaction). In addition, through the contract execution log, the related information in the transaction execution process can be more comprehensively and completely recorded.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1a is a schematic diagram of a data sharing system according to an embodiment of the present disclosure;
FIG. 1b is a block chain architecture diagram according to one embodiment of the present disclosure;
fig. 1c is a schematic flow chart of a block generation method according to an embodiment of the present application;
FIG. 1d is a block chain network based data processing system architecture diagram according to an embodiment of the present application;
FIG. 2 is a flowchart of a data processing method based on a blockchain network according to an embodiment of the present application;
FIG. 3 is a flowchart of another data processing method based on a blockchain network according to an embodiment of the present application;
FIG. 4a is a schematic diagram of a transaction performed by invoking at least one intelligent contract in a blockchain network provided in accordance with embodiments of the present application;
FIG. 4b is a schematic diagram of adding verification data to a target block according to an embodiment of the present disclosure;
FIG. 5 is a flowchart of yet another data processing method based on a blockchain network according to an embodiment of the present application;
fig. 6 is a schematic diagram of calculating a hash value of a root node of a merck tree according to an embodiment of the present application;
FIG. 7 is a schematic diagram of a block chain network based data processing apparatus according to an embodiment of the present application;
FIG. 8 is a schematic diagram of another block chain network based data processing apparatus according to an embodiment of the present application;
fig. 9 is a schematic structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all, of the embodiments of the present application. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments herein without making any inventive effort, are intended to be within the scope of the present application.
Embodiments of the present application relate to blockchain technology and related terms and concepts of blockchain technology are briefly described below:
blockchain (Blockchain) is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm and the like. The method is characterized in that the method is a decentralised database, which is a series of data blocks generated by correlation of a cryptography method, and each data block contains information of a batch of network transactions and is used for checking the validity (anti-counterfeiting) of the information and generating a next block. The blockchain may include a blockchain underlying platform, a platform product services layer, and an application services layer.
A blockchain network may be understood as a data sharing system 100, the data sharing system 100 may refer to a system for sharing data between nodes, and an exemplary architecture of the data sharing system 100 may be seen in fig. 1a; as shown in fig. 1a, a data sharing system 100 refers to a system for performing data sharing between nodes, where a plurality of nodes 1001 may be included in the data sharing system, and the plurality of nodes 1001 may be respective clients in the data sharing system. Each node 1001 may receive input information while operating normally and maintain shared data within the data sharing system based on the received input information. In order to ensure the information intercommunication in the data sharing system, information connection can exist between each node in the data sharing system, and the nodes can transmit information through the information connection. For example, when any node in the data sharing system receives input information, other nodes in the data sharing system acquire the input information according to a consensus algorithm, and store the input information as data in the shared data, so that the data stored on all nodes in the data sharing system are consistent. In the present application, after any one of the blockchain network nodes receives a transaction request, the transaction request is broadcasted in the blockchain network, and a plurality of transactions are packaged into a block by a block-out node (one of the blockchain network nodes) and broadcasted to other blockchain network nodes.
Each node in the data sharing system has a node identifier corresponding to the node identifier, and each node in the data sharing system can store the node identifiers of other nodes in the data sharing system, so that the generated block can be broadcast to other nodes in the data sharing system according to the node identifiers of the other nodes. Each node can maintain a node identification list shown in the following table, and the node names and the node identifications are correspondingly stored in the node identification list. Wherein the node identity may be an IP (Internet Protocol, protocol for interconnection between networks) address and any other information that can be used to identify the node; for example, the node identifier may also be a binary sequence code (e.g., 110001110), and table 1 is only illustrated by taking an IP address as an example:
TABLE 1
Node name Node identification
Node 1 yyy.yyy.yyy.yyy
Node 2 zzz.zzz.zzz.zzz
Node X (X is a positive integer) xxx.xxx.xxx.xxx
Each node in the data sharing system stores one and the same blockchain. The blockchain is composed of a plurality of blocks, see fig. 1b, the blockchain is composed of a plurality of blocks, the starting block comprises a block head and a block body, the block head stores an input information characteristic value, a version number, a time stamp and a difficulty value, and the block body stores input information; the next block of the starting block takes the starting block as a father block, the next block also comprises a block head and a block body, the block head stores the input information characteristic value of the current block, the block head characteristic value of the father block, the version number, the timestamp and the difficulty value, and the like, so that the block data stored in each block in the block chain are associated with the block data stored in the father block, and the safety of the input information in the block is ensured.
When each block in the blockchain is generated, referring to fig. 1c, when the node where the blockchain is located receives input information, checking the input information, after the checking is completed, storing the input information into a memory pool, and updating a hash tree used for recording the input information; then, updating the update time stamp to the time of receiving the input information, trying different random numbers, and calculating the characteristic value for a plurality of times, so that the calculated characteristic value can meet the following formula:
SHA256(SHA256(version+prev_hash+merkle_root+ntime+nbits+x))<TARGET
wherein SHA256 is a eigenvalue algorithm used to calculate eigenvalues; version (version number) is version information of the related block protocol in the block chain; the prev_hash is the block header characteristic value of the parent block of the current block; the merkle_root is a characteristic value of input information; ntime is the update time of the update timestamp; the nbits is the current difficulty, is a fixed value in a period of time, and is determined again after exceeding a fixed period of time; x is a random number; TARGET is a eigenvalue threshold that can be determined from nbits.
Thus, when the random number meeting the formula is calculated, the information can be correspondingly stored to generate the block head and the block body, and the current block is obtained. And then, broadcasting the newly generated block to other nodes in the data sharing system according to the node identification of other nodes in the data sharing system by the node in which the block chain is positioned, performing common check on the newly generated block by the other nodes, and adding the newly generated block into the stored block chain after the common check is finished.
In this application, after each blockchain network node receives a block packaged by a block node, the transaction in the block starts to be executed. Specifically, the logic computation layer of each blockchain network node obtains the transaction parameters parsed from the uplink request, and executes at least one intelligent contract corresponding to the transaction parameters.
Further, after the execution of at least one intelligent contract corresponding to the transaction is completed, each blockchain network node performs mutual verification on the execution result; for example, the blockchain network node may organize the execution result or the change to the storage into a form of a merck (merkle) tree, put the tree root into the blockhead of the target block, and finally verify that the hash in the blockhead of the target block stored in each blockchain network node is consistent. After the verification is successful, each blockchain network node writes the data related to the target block into the storage, wherein the data related to the target block comprises at least one of the following: the block header of the target block, all transactions contained in the target block, and the intelligent contract execution results of each transaction.
Based on the above description about the blockchain network structure related to the embodiment of the present application, the following briefly describes a data processing scheme provided by the embodiment of the present application based on the blockchain network, which can improve the reliability of the execution result of the transaction. Referring to FIG. 1d, FIG. 1d is a block chain network based data processing system architecture diagram according to an embodiment of the present application. As shown in fig. 1d, the processing system may include: a service node 101 and a blockchain network node 102. One data processing method based on the blockchain network provided in the embodiments of the present application may be performed by the service node 101, and another data processing method based on the blockchain network may be performed by the blockchain network node 102. Service node 101 may include, but is not limited to: smart phones (such as Android phones, IOS phones, etc.), tablet computers, portable personal computers, mobile internet devices (Mobile Internet Devices, abbreviated as MID), vehicle terminals, and other smart devices, which are not limited in this embodiment of the present application. The blockchain network node 102 may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network ), basic cloud computing services such as big data and an artificial intelligence platform, which is not limited in the embodiment of the present application.
It should be noted that, in fig. 1d, the service node 101 and the blockchain network node 102 may be directly or indirectly connected through a wired communication manner or a wireless communication manner, which is not limited herein. The number of service nodes 101 and blockchain network nodes 102 is for example only and does not constitute a practical limitation of the present application; for example, a service node 103 or the like may also be included in the data processing system.
It will be appreciated that in the detailed description of the present application, where the transaction provided by a service node is to be acquired, when the above embodiments of the present application are applied to a specific product or technology, the blockchain network node needs to acquire corresponding data acquisition rights (e.g., the service node 101 authorizes the blockchain network node 102), and the collection, use and processing of relevant data needs to comply with relevant laws and regulations of relevant countries and regions.
The general principle of a blockchain network-based data processing scheme is as follows:
(1) The service node 101 sends a request for the uplink of the transaction to the blockchain network node 102, and the blockchain network node 102 invokes at least one smart contract in the blockchain network to execute the transaction in response to the request for the uplink of the transaction. The transaction comprises data which need to be verified in a blockchain network; the transaction may include a virtual resource transfer record, and may also include certification information (e.g., an identification code for product A, a date of manufacture for product B, etc.). For example, let intelligent contract 1 and intelligent contract 2 be used to handle virtual resource transfer, intelligent contract 3 be used to check the validity of data, if transaction 1 is to transfer virtual resources in account a to account B, blockchain network node 102 invokes intelligent contract 1 and intelligent contract 2 to execute transaction 1; if transaction 2 is the certification of storage product a, blockchain network node 102 invokes smart contract 3 to perform transaction 2 (e.g., verify that the certification of storage product a is legitimate).
(2) The blockchain network node 102 records at least one contract execution information that is intelligent about in executing the transaction; wherein the contract execution information includes at least one of: the method comprises the steps of executing a contract, and executing a contract execution log, wherein the contract execution log comprises at least one piece of effective information which is generated in the process of executing a transaction intelligently; for example, at least one intelligence may be in close proximity to intermediate data generated during execution of the transaction, violation information of the transaction, and the like. In one embodiment, the blockchain network node 102 may record at least one contract execution information that is intelligent about in executing the transaction by invoking a contract recording function, wherein the contract recording function includes at least one of the following fields: a type field, an index field, a data field; the type field indicates the type of the contract execution information, and the index field screens the contract execution information.
(3) The blockchain network node 102 constructs a merck tree based on the contract execution information and adds the root node of the merck tree as check data of the contract execution information to the blockchain. Specifically, the blockchain network node 102 may add contract execution information to the to-be-stored set, where the to-be-stored set includes one or more contract execution information, and when it is detected that the to-be-stored set satisfies the storage condition (e.g., the number of contract execution information in the storage set reaches a number threshold), the blockchain network node 102 constructs a merck tree based on the one or more contract execution information in the to-be-stored set, and adds a hash value of a root node of the merck tree as verification data of the contract execution information to the target block. Alternatively, the blockchain network node 102 may also directly add the hash value of the contract execution information to the target block.
(4) The blockchain network node 102 returns contract execution information to the sender of the uplink request (e.g., the service node 101). In one embodiment, blockchain network node 102 returns contract execution information to service node 101 as response information to the uplink request. It should be noted that, the step (4) may also be performed before the step (3), or may be performed synchronously with the step (3), which is not limited in this application.
(5) After receiving the contract execution information returned by the blockchain network node 102, the service node 101 may obtain verification data of the contract execution information from the blockchain to verify the reliability of the contract execution information. In one embodiment, the verification data of the contract execution information includes hash values of a root node of a merck tree constructed based on the hash values of the contract execution information, the service node 101 acquires attestation information associated with the contract execution information returned by the blockchain network node, the attestation information includes one or more hash values associated with the hash values of the contract execution information, and the service node 101 obtains to-be-verified data corresponding to the contract execution information based on the contract execution information and the attestation information; for example, the service node 101 calculates a hash value of a root node of the merck tree (i.e., data to be verified) constructed based on the hash value of the contract execution information, based on the hash value of the contract execution information and one or more hash values associated with the hash value of the contract execution information. After obtaining the data to be verified corresponding to the contract execution information, the service node 101 obtains the verification data from the blockchain, verifies whether the verification data is matched with the data to be verified, and if the verification data is matched with the data to be verified, determines that the contract execution information passes the verification, namely the contract execution information is reliable.
In an embodiment of the present application, in response to a request for uplink of a transaction, at least one intelligent contract in a blockchain network is invoked to execute the transaction, and contract execution information of the at least one intelligent contract in a transaction executing process is recorded, wherein the contract execution information comprises at least one of the following: contract execution results and contract execution logs; constructing the merck tree based on the contract execution information, and adding the root node of the merck tree as check data of the contract execution information to the blockchain, and returning the contract execution information to a sender of the uplink request. It can be seen that by generating the verification data of the contract execution information, the sender of the uplink request can verify the contract execution information based on the verification data, thereby improving the reliability of the contract execution information (including the execution result of the transaction). In addition, through the contract execution log, the related information in the transaction execution process can be more comprehensively and completely recorded.
Based on the video processing scheme, the embodiment of the application provides a more detailed data processing method based on the blockchain network, and the data processing method based on the blockchain network provided by the embodiment of the application will be described in detail with reference to the accompanying drawings.
Referring to fig. 2, fig. 2 is a flowchart of a data processing method based on a blockchain network, which may be performed by a computer device, which may be the blockchain network node 102 shown in fig. 1d, according to an embodiment of the present application. As shown in fig. 2, the data processing method may include the following steps S201 to S204:
s201, in response to a uplink request for a transaction, invoking at least one intelligent contract in a blockchain network to execute the transaction.
The transaction comprises data which need to be verified in a blockchain network; the transaction may include a virtual resource transfer record, and may also include certification information (e.g., an identification code for product A, a date of manufacture for product B, etc.). One transaction may correspond to one or more smart contracts in a blockchain network; for example, transaction 1 corresponds to intelligent contract 1 and intelligent contract 2 in the blockchain network, and transaction 2 corresponds to intelligent contract 3 in the blockchain network.
In one embodiment, in response to a request for a uplink to a transaction, a computer device invokes at least one smart contract in a blockchain network corresponding to the transaction to perform the transaction; for example, let intelligent contract 1 and intelligent contract 2 be used to handle virtual resource transfer, intelligent contract 3 be used to check the validity of data, if transaction 1 is to transfer the virtual resource in account a to account B, then the computer device calls intelligent contract 1 and intelligent contract 2 to execute transaction 1; if transaction 2 is the certification of storage product a, the computer device invokes smart contract 3 to perform transaction 2 (e.g., verifying that the certification of storage product a is legitimate).
S202, recording contract execution information of at least one intelligent contract in the process of executing the transaction.
The contract execution information includes at least one of: the method comprises the steps of executing a contract, and executing a contract execution log, wherein the contract execution log comprises at least one piece of effective information which is generated in the process of executing a transaction intelligently; the effective information may include at least one intelligent contract about intermediate data generated in the process of executing the transaction, and if the at least one intelligent contract detects that the transaction has violation information in the process of executing the transaction, the effective information may further include the violation information of the transaction, and the like.
In one embodiment, the computer device may record at least one contract execution information that is intelligent about in the course of executing the transaction by invoking a contract recording function, wherein the contract recording function includes at least one of the following fields: a type field, an index field, a data field; wherein the type field is used to indicate the type of contract execution information, the index field is used to filter the contract execution information, and the data field is used to store one or more valid information generated during execution of the transaction by the at least one intelligent entity. In practical applications, the recording function may be expressed as: lockcontext, logevent (name, drags, data); wherein name is a type field for indicating an event name; in one implementation, the event name indicated by the type field may correspond to an event function signature, which may indicate the type of transaction by name; topics is an index field that indicates the value to be indexed; in one implementation, the index field is a byte array having a length less than a length threshold.
S203, constructing the merck tree based on the contract execution information, and adding the root node of the merck tree as check data of the contract execution information to the blockchain.
The verification data of the contract execution information is used for verifying the authenticity of the contract execution information, the computer device can add the contract execution information to a to-be-stored certificate set, the to-be-stored certificate set comprises one or more contract execution information, when the to-be-stored certificate set is detected to meet a certificate storage condition (for example, the quantity of the contract execution information in the to-be-stored certificate set reaches a quantity threshold value), the computer device constructs a merck tree based on the one or more contract execution information in the to-be-stored certificate set, and the hash value of the root node of the merck tree is used as the verification data of the contract execution information to be added to a target block; for example, a merck tree is constructed based on the contract execution information, and a root node of the merck tree is added as check data of the contract execution information to a block header of a target block. Alternatively, the computer device may directly add the hash value of the contract execution information to the target block.
It can be appreciated that storing hash values of root nodes of the merck tree as check data of the plurality of contract execution information saves more memory space than storing hash values of the respective contract execution information separately.
Further, after generating the verification data of the contract execution information, the computer device may add the verification data to the target block; for example, the computer device may add the verification data to the tile header of the target tile.
Note that, when the verification data of the contract execution information is: when the verification data is stored in the block header of the target block, the block header of the target block at least comprises two hash values, and one hash value is the hash value of the merck tree constructed based on the hash values of a plurality of transactions (i.e. the hash value carried in the block header of the conventional block chain); the other is a hash value of the root node of the merck tree constructed based on hash values of the contract execution information, and by this hash value, the reliability of the contract execution information can be verified more conveniently.
S204, returning contract execution information to the sender of the uplink request.
In one embodiment, the computer device may return the contract execution information to the sender of the uplink request as response information to the uplink request. It should be noted that, step S204 may also be performed before step S203 or performed in synchronization with step S203, which is not limited in this application.
In an embodiment of the present application, in response to a request for uplink of a transaction, at least one intelligent contract in a blockchain network is invoked to execute the transaction, and contract execution information of the at least one intelligent contract in a transaction executing process is recorded, wherein the contract execution information comprises at least one of the following: contract execution results and contract execution logs; constructing the merck tree based on the contract execution information, and adding the root node of the merck tree as check data of the contract execution information to the blockchain, and returning the contract execution information to a sender of the uplink request. It can be seen that by generating the verification data of the contract execution information, the sender of the uplink request can verify the contract execution information based on the verification data, thereby improving the reliability of the contract execution information (including the execution result of the transaction). In addition, through the contract execution log, the related information in the transaction execution process can be more comprehensively and completely recorded.
Referring to fig. 3, fig. 3 is a flowchart of another data processing method based on a blockchain network, which may be performed by a computer device, which may be the blockchain network node 102 shown in fig. 1d, according to an embodiment of the present application. As shown in fig. 3, the data processing method may include the following steps S301 to S309:
S301, at least one intelligent contract to be deployed is acquired.
An intelligent contract is a computer protocol that aims to propagate, verify, or execute contracts in an informative manner. In a blockchain network, a smart contract is a code that can be understood and executed by each blockchain network node in the blockchain network, by invoking the corresponding smart contract, the blockchain network node can execute any logic and get the result. In practice, smart contracts may be managed and used by transactions on the blockchain. Each transaction may be understood as a remote procedure call (Remote Procedure Call, RPC) request for the blockchain network. For ease of understanding, a smart contract may be understood as an executable program and a blockchain network may be understood as an operating system that provides a running environment for the executable program. It should be noted that, a blockchain network may include a plurality of intelligent contracts, where each intelligent contract is distinguished by a contract identifier (e.g., a contract ID, a contract name, etc.).
The intelligent contracts to be deployed may be broadcast to the computer devices by blockchain network nodes in the blockchain network or imported to the computer devices by participants in the blockchain network.
S302, deploying at least one intelligent contract to be deployed through the consensus of the blockchain network in response to the at least one intelligent contract to be deployed.
Responsive to the consensus of the at least one smart contract to be deployed over the blockchain network, the computer device deploys the at least one smart contract to be deployed; for example, if each blockchain network node in the blockchain network agrees to deploy the smart contract to be deployed, the computer device deploys the smart contract to be deployed.
S303, in response to the uplink request for the transaction, invoking at least one intelligent contract in the blockchain network to execute the transaction.
The specific embodiment of step S303 can refer to the embodiment of step S201 in fig. 2, and will not be described herein.
Fig. 4a is a schematic diagram of a transaction performed by invoking at least one smart contract in a blockchain network according to an embodiment of the present application. As shown in fig. 4a, a requestor (e.g., a service node) sends a request for a transaction to the remote procedure call (Remote Procedure Call, RPC) layer of each blockchain network node. The blockchain network nodes broadcast transactions to each other, and the out-block nodes (one of the blockchain network nodes) package a plurality of transactions into one block and broadcast the block to other blockchain network nodes. The selection of the block node may be set according to the actual requirement, which is not limited in this application, for example, the algorithm for determining the block node may be: the leader outputs blocks, alternately outputs blocks, competes with each other to output blocks, etc. After each blockchain network node receives a block packaged by the block out node, the transaction in the block starts to be executed. Specifically, the logic computation layer of each blockchain network node obtains the transaction parameters parsed from the uplink request, and executes at least one intelligent contract corresponding to the transaction parameters. It should be noted that, in the process of executing at least one intelligent contract corresponding to the transaction, the logic calculation layer may also read the data required in the storage; for example, in the process of executing at least one smart contract corresponding to transaction 1, the associated data in transaction 2 needs to be used; if there is associated data in transaction 2 in the store, the logical compute layer may read the associated data in transaction 2 from the store. Further, after the execution of at least one intelligent contract corresponding to the transaction is completed, each blockchain network node performs mutual verification on the execution result; for example, the blockchain network node may organize the execution result or the change to the storage into a form of a merck (merkle) tree, put the tree root into the blockhead of the target block, and finally verify that the hash in the blockhead of the target block stored in each blockchain network node is consistent. After the verification is successful, each blockchain network node writes the data related to the target block into the storage, wherein the data related to the target block comprises at least one of the following: the block header of the target block, all transactions contained in the target block, and the intelligent contract execution results of each transaction.
S304, recording contract execution information of at least one intelligent contract in the process of executing the transaction.
The contract execution information includes at least one of: the method comprises the steps of executing a contract, and executing a contract execution log, wherein the contract execution log comprises at least one piece of effective information which is generated in the process of executing a transaction intelligently; the effective information may include at least one intelligent contract about intermediate data generated in the process of executing the transaction, and if the at least one intelligent contract detects that the transaction has violation information in the process of executing the transaction, the effective information may further include the violation information of the transaction, and the like.
In one embodiment, the computer device may record at least one contract execution information that is intelligent about in the course of executing the transaction by invoking a contract recording function, wherein the contract recording function includes at least one of the following fields: a type field, an index field, a data field; wherein the type field is used to indicate the type of contract execution information, the index field is used to filter the contract execution information, and the data field is used to store one or more valid information generated during execution of the transaction by the at least one intelligent entity. In practical applications, the recording function may be expressed as: lockcontext, logevent (name, drags, data); wherein name is a type field for indicating an event name; in one implementation, the event name indicated by the type field may correspond to an event function signature, which may indicate the type of transaction by name; topics is an index field that indicates the value to be indexed; in one implementation, the index field is a byte array having a length less than a length threshold.
S305, if at least one intelligent contract detects that the uplink request does not meet the uplink condition in the process of executing the transaction, recording the violation information corresponding to the uplink request in a contract execution log.
In practical application, the uplink condition can be set based on practical requirements, which is not limited in the application; for example, assuming that transaction 1 is to transfer 100 virtual resources in account a to account B, and at least one intelligence is about to perform a transaction, if it is detected that the number of virtual resources in account a is less than 100 (i.e. the uplink request does not satisfy the uplink condition), then the violation information corresponding to the uplink request is recorded in the contract execution log as follows: the balance is insufficient; for another example, assuming that the transaction 2 is to store relevant parameters of the product a, at least one intelligent entity is configured to perform the transaction, and detect that there is a violation parameter in the relevant parameters of the product a (e.g., a value of the violation parameter does not belong to a preset value range, etc.), record, in a contract execution log, violation information corresponding to the uplink request as follows: there are violation parameters.
It is understood that step S305 may be performed synchronously during the process performed in step S304.
Optionally, if at least one intelligent contract detects that the uplink request does not meet the uplink condition in the process of executing the transaction, contract execution information corresponding to the uplink request is discarded.
S306, adding contract execution information into the to-be-stored certificate set.
The to-be-stored certificate set is used for storing contract execution information which needs to be uplink, the to-be-stored certificate set comprises one or more pieces of contract execution information, and the contract execution information in the to-be-stored certificate set belongs to the same block.
S307, when the stored evidence collection is detected to meet the evidence storage condition, constructing a merck tree based on one or more contract execution information in the stored evidence collection.
The collection to be deposited meets the depositing condition and comprises any one of the following: the current moment is matched with the preset evidence storage time, and the quantity of contract execution information in the evidence storage set reaches a quantity threshold.
In one embodiment, when the to-be-stored-certificate set is detected to meet the certificate storage condition, the computer equipment calculates hash values corresponding to all contract execution information in the to-be-stored-certificate set, and takes the hash values corresponding to all contract execution information as leaf nodes of the merck tree to construct the merck tree.
S308, taking the hash value of the root node of the Merker tree as check data of contract execution information, and adding the check data into a target block.
In one embodiment, the computer device uses the hash value of the root node of the merck tree as check data for the contract execution information and adds the check data to the chunk header of the target chunk.
FIG. 4b is a schematic diagram of adding verification data to a target block according to an embodiment of the present disclosure. As shown in fig. 4b, during execution of a transaction, at least one smart contract stores all generated valid information in contract execution information (TxResult). The computer device constructs a merck (merkle) tree based on a plurality of contract execution information (TxResult) in the set of credentials to be stored, and adds a hash value (roothash) of a root node of the merck tree to a block header (block header) of the target block along with other fields. It will be appreciated that the amount of contract execution information in fig. 4b is merely exemplary and does not constitute a practical limitation of the present application.
S309, the contract execution information is returned to the sender of the uplink request.
The specific embodiment of step S309 can refer to the embodiment of step S204 in fig. 2, and will not be described herein.
In one embodiment, if the uplink request for the transaction does not meet the uplink condition, the contract execution information corresponding to the uplink request is still added to the to-be-stored set, and the subsequent step of storing the contract is continued. That is, although the uplink request for the transaction is not uplink, the verification data of the contract execution information corresponding to the uplink request is uplink, and the uplink requester can verify the contract execution information returned by the computer device based on the verification data of the contract execution information in the blockchain, so as to ensure the reliability of the contract execution information.
Optionally, if the computer device receives the request for obtaining the certification information, returning the certification information associated with the contract execution information to the requester; for example, assuming that the verification data of the contract execution information is a hash value of the root node of the merck tree constructed based on the hash value of the contract execution information, the certification information associated with the contract execution information means: one or more hash values needed in calculating the hash value of the root node of the merck tree based on the hash value of the contract execution information.
According to the embodiment of the application, on the basis of the embodiment of fig. 2, the verification data of the contract execution information is uplink, so that the requesters of all uplink requests can verify the contract execution information based on the verification data of the contract execution information; by storing the check data of the contract execution information in the block header, the requester of each uplink request can read the check data of the contract execution information more conveniently, the contract execution information can be queried statically for a plurality of times, the influence of other uplink requests is avoided, and the risk of tampering of the contract execution information is reduced; the contract execution information of various types of smart contracts can be recorded through the recording function.
Referring to fig. 5, fig. 5 is a flowchart of yet another data processing method based on a blockchain network according to an embodiment of the present application, where the data processing method may be performed by a computer device, and the computer device may be the service node 101 shown in fig. 1 d. As shown in fig. 5, the data processing method may include the following steps S501 to S506:
s501, sending a uplink request for a transaction to a blockchain network node.
The uplink request aiming at the transaction is used for uplink the transaction in the uplink request, and the transaction comprises data which needs to be verified in a blockchain network; the transaction may include a virtual resource transfer record, and may also include certification information (e.g., an identification code for product A, a date of manufacture for product B, etc.). One transaction may correspond to one or more smart contracts in a blockchain network; for example, transaction 1 corresponds to intelligent contract 1 and intelligent contract 2 in the blockchain network, and transaction 2 corresponds to intelligent contract 3 in the blockchain network.
In one embodiment, a computer device sends a request for a transaction to a blockchain network node to cause the blockchain network node to invoke at least one intelligent contract in a blockchain network to perform the transaction and record contract execution information for at least one intelligent contract in the process of performing the transaction, and constructs a merck tree based on the contract execution information and adds a root node of the merck tree to the blockchain as verification data of the contract execution information; wherein the contract execution information includes at least one of: and (3) a contract execution result corresponding to the uplink request, and a contract execution log corresponding to the uplink request. The block chain network node performs the above steps in the embodiments described with reference to fig. 2 and 3, and will not be described in detail herein.
S502, contract execution information returned by the block chain network node is received.
In one embodiment, after receiving the contract execution information returned by the blockchain network node, the computer device may send a certification information acquisition request to the blockchain network node to acquire certification information associated with the contract execution information, where the certification information acquisition request carries an identifier of the contract execution information.
In another embodiment, the contract execution information includes a contract execution log, and if the uplink request for the transaction does not satisfy the uplink component, the computer device may obtain, from the contract execution log, violation information present in the uplink request; the violation information is detected by at least one intelligent party during the execution of the transaction, and specifically, refer to step S305 in fig. 3, which is not described herein.
S503, obtaining the certification information which is returned by the blockchain network node and is associated with the contract execution information.
The certification information associated with the contract execution information is used to assist in verifying the authenticity of the contract execution information.
In one embodiment, the blockchain network node may send the attestation information associated with the contract execution information to the computer device along with the contract execution information. In another embodiment, the blockchain network node returns, after receiving the attestation information acquisition request sent by the computer device, attestation information associated with contract execution information carried in the attestation information acquisition request to the requestor.
S504, obtaining to-be-verified data corresponding to the contract execution information based on the contract execution information and the proving information.
In one embodiment, the computer device calculates data to be verified corresponding to the contract execution information based on the hash value of the contract execution information and the attestation information (e.g., one or more hash values) associated with the contract information.
Fig. 6 is a schematic diagram of calculating a hash value of a root node of a merck tree according to an embodiment of the present application. As shown in fig. 6, H (x) represents that x is hashed; assuming that the contract execution information is information d in fig. 6, the certification information associated with the contract execution information includes: h (c), H (ab), H (efgh); the process of calculating the data to be verified (H (abcdefgh)) corresponding to the contract execution information by the computer equipment is as follows: h (d) is calculated from the information d, H (cd) is calculated from H (c) and H (d), H (abcd) is calculated from H (ab) and H (cd), and H (abcdefgh) is calculated from H (abcd) and H (efgh).
S505, obtaining check data from the block chain.
In one embodiment, the check data is a hash value of a root node of a merck tree constructed based on a hash value of contract execution information, and the computer device may obtain the check data from a block header of a target block, the target block being a block in a blockchain.
S506, if the verification data are matched with the data to be verified, judging that the contract execution information passes the verification.
In one embodiment, if the verification data is consistent with the data to be verified, the computer device determines that the contract execution information passes the verification; accordingly, if the verification data is inconsistent with the data to be verified, the computer equipment judges that the contract execution information fails to pass the verification.
Optionally, the computer device may further provide contract execution information and certification information associated with the contract execution information to other terminal devices or servers to certify the reliability of the contract execution information.
In the embodiment of the application, a uplink request for a transaction is sent to a blockchain network node, so that the blockchain network node calls at least one intelligent contract in a blockchain network to execute the transaction, records contract execution information of at least one intelligent contract in the process of executing the transaction, constructs a merck tree based on the contract execution information, and adds root nodes of the merck tree as verification data of the contract execution information to a blockchain; receiving contract execution information returned by the block chain network node; wherein the contract execution information includes at least one of: and (3) a contract execution result corresponding to the uplink request, and a contract execution log corresponding to the uplink request. After receiving the contract execution information returned by the blockchain network node, the sender of the uplink request can verify the contract execution information based on the verification data corresponding to the contract execution information on the blockchain, so that the reliability of the contract execution information (including the execution result of the transaction) is improved; in the verification process of the contract execution information, the reliability of the contract execution information can be verified without acquiring all contents in the target block; in addition, if the uplink request for the transaction does not meet the uplink condition, the violation information existing in the uplink request can be obtained through a contract execution log in the contract execution information.
The foregoing details of the method of embodiments of the present application are set forth in order to provide a better understanding of the foregoing aspects of embodiments of the present application, and accordingly, the following provides a device of embodiments of the present application.
Referring to fig. 7, fig. 7 is a schematic structural diagram of a data processing apparatus based on a blockchain network according to an embodiment of the present application, and the data processing apparatus based on a blockchain network shown in fig. 7 may be used to perform some or all of the functions of the method embodiments described in fig. 2 and 3. Referring to fig. 7, the data processing apparatus based on a blockchain network includes:
a processing unit 701 for invoking at least one intelligent contract in a blockchain network to execute a transaction in response to a request for a uplink of the transaction;
and means for recording contract execution information for at least one intelligent contract in the course of executing the transaction, the contract execution information including at least one of: contract execution results and contract execution logs;
and the system is used for constructing the merck tree based on the contract execution information and adding the root node of the merck tree as verification data of the contract execution information to the blockchain;
a sending unit 702, configured to return contract execution information to a sender of the uplink request.
In one embodiment, the contract execution information includes a contract execution log; the processing unit 701 is further configured to:
if at least one intelligent contract detects that the uplink request does not meet the uplink condition in the process of executing the transaction, recording violation information corresponding to the uplink request in a contract execution log.
In one embodiment, the processing unit 701 is configured to record at least one contract execution information that is intelligent about the execution of a transaction, and is specifically configured to:
recording, by a contract recording function, contract execution information for at least one intelligent contract during execution of the transaction;
wherein the contract recording function includes at least one of the following fields: a type field, an index field, a data field; the type field indicates the type of the contract execution information, and the index field screens the contract execution information.
In one embodiment, the processing unit 701 is configured to construct a merck tree based on the contract execution information, and add the root node of the merck tree as check data of the contract execution information to the blockchain, specifically configured to:
adding contract execution information to a to-be-stored certificate set, wherein the to-be-stored certificate set comprises one or more contract execution information;
When the to-be-stored evidence collection is detected to meet the evidence storage condition, constructing a merck tree based on one or more contract execution information in the to-be-stored evidence collection;
the hash value of the root node of the merck tree is used as check data of contract execution information, and the check data is added into the target block.
In one embodiment, the processing unit 701 is configured to, when detecting that the to-be-stored set meets the certification condition, construct a merck tree based on one or more contracts in the to-be-stored set, specifically configured to:
when the to-be-stored evidence collection is detected to meet the evidence storage conditions, calculating hash values corresponding to all contract execution information in the to-be-stored evidence collection;
taking hash values corresponding to the contract execution information as leaf nodes of the merck tree, and constructing the merck tree;
wherein, the to-be-stored evidence collection meets the evidence storage condition and comprises any one of the following: the current moment is matched with the preset evidence storage time, and the quantity of contract execution information in the evidence storage set reaches a quantity threshold.
In one embodiment, the processing unit 701 is configured to construct a merck tree based on the contract execution information, and add the root node of the merck tree as check data of the contract execution information to the blockchain, specifically configured to:
Constructing a merck tree based on the contract execution information, and adding the root node of the merck tree as check data of the contract execution information to the block header of the target block.
In one embodiment, the processing unit 701 is further configured to:
acquiring at least one intelligent contract to be deployed;
the at least one smart contract to be deployed is deployed in response to a consensus of the at least one smart contract to be deployed through the blockchain network.
According to one embodiment of the present application, some of the steps involved in the blockchain network-based data processing methods shown in fig. 2 and 3 may be performed by various units in the blockchain network-based data processing device shown in fig. 7. For example, step S201 to step S203 shown in fig. 2 may be performed by the processing unit 701 shown in fig. 7, and step S204 may be performed by the transmitting unit 702 shown in fig. 7; step S301 to step S308 shown in fig. 3 may be performed by the processing unit 701 shown in fig. 7, and step S309 may be performed by the transmitting unit 702 shown in fig. 7. The various units in the blockchain network-based data processing device shown in fig. 7 may be combined into one or several other units separately or all, or some (some) of the units may be further split into a plurality of units with smaller functions to form the same operation, which may not affect the implementation of the technical effects of the embodiments of the present application. The above units are divided based on logic functions, and in practical applications, the functions of one unit may be implemented by a plurality of units, or the functions of a plurality of units may be implemented by one unit. In other embodiments of the present application, the blockchain network-based data processing device may also include other units, and in actual practice, these functions may also be implemented with the assistance of other units, and may be implemented by the cooperation of multiple units.
According to another embodiment of the present application, a blockchain network-based data processing apparatus as shown in fig. 7 may be constructed by running a computer program (including program code) capable of executing the steps involved in the respective methods as shown in fig. 2 and 3 on a general-purpose computing apparatus, such as a computer device, including a Central Processing Unit (CPU), a random access storage medium (RAM), a read only storage medium (ROM), etc., processing elements and storage elements, and implementing the blockchain network-based data processing method of the embodiments of the present application. The computer program may be recorded on, for example, a computer-readable recording medium, and loaded into and run in the above-described computing device through the computer-readable recording medium.
Based on the same inventive concept, the principle and beneficial effects of the block chain network-based data processing device provided in the embodiments of the present application are similar to those of the block chain network-based data processing method in the embodiments of the present application, and may be referred to the principle and beneficial effects of the implementation of the method, which are not described herein for brevity.
Referring to fig. 8, fig. 8 is a schematic structural diagram of another data processing apparatus based on a blockchain network according to an embodiment of the present application, and the data processing apparatus based on a blockchain network shown in fig. 8 may be used to perform some or all of the functions of the method embodiment described in fig. 5. Referring to fig. 8, the data processing apparatus based on a blockchain network includes:
A sending unit 801, configured to send a request for uplink of a transaction to a blockchain network node, so that the blockchain network node invokes at least one intelligent contract in the blockchain network to perform the transaction, records contract execution information of at least one intelligent contract in a process of performing the transaction, constructs a merck tree based on the contract execution information, and adds root nodes of the merck tree as verification data of the contract execution information to the blockchain;
a receiving unit 802, configured to receive contract execution information returned by the blockchain network node;
wherein the contract execution information includes at least one of: and (3) a contract execution result corresponding to the uplink request, and a contract execution log corresponding to the uplink request.
In one embodiment, the blockchain network-based data processing device further includes a processing unit 803, and the contract execution information includes a contract execution log; if the uplink request does not satisfy the uplink component, the processing unit 803 is configured to:
obtaining violation information existing in the uplink request from a contract execution log;
wherein the violation information is detected by at least one intelligent party in the course of executing the transaction.
In one embodiment, the verification data of the contract execution information includes a hash value of a root node of the merck tree generated based on the contract execution information; the processing unit 803 is further configured to:
Acquiring certification information which is returned by the block chain network node and is associated with contract execution information;
based on the contract execution information and the proving information, obtaining to-be-verified data corresponding to the contract execution information;
obtaining check data from a blockchain;
if the verification data is matched with the data to be verified, judging that the contract execution information passes the verification.
According to one embodiment of the present application, some of the steps involved in the blockchain network-based data processing method shown in fig. 5 may be performed by various units in the blockchain network-based data processing device shown in fig. 8. For example, step S501 shown in fig. 5 may be performed by the transmitting unit 801 shown in fig. 8, step S502 may be performed by the receiving unit 802 shown in fig. 8, and steps S503 to S506 may be performed by the processing unit 803. The various units in the blockchain network-based data processing device shown in fig. 8 may be combined into one or several other units separately or all, or some (some) of the units may be further split into a plurality of units with smaller functions to form the same operation, which may not affect the implementation of the technical effects of the embodiments of the present application. The above units are divided based on logic functions, and in practical applications, the functions of one unit may be implemented by a plurality of units, or the functions of a plurality of units may be implemented by one unit. In other embodiments of the present application, the blockchain network-based data processing device may also include other units, and in actual practice, these functions may also be implemented with the assistance of other units, and may be implemented by the cooperation of multiple units.
According to another embodiment of the present application, a blockchain network-based data processing apparatus as shown in fig. 8 may be constructed by running a computer program (including program code) capable of executing the steps involved in the respective methods as shown in fig. 5 on a general-purpose computing apparatus, such as a computer device, including a Central Processing Unit (CPU), a random access storage medium (RAM), a read only storage medium (ROM), etc., processing elements and storage elements, and implementing the blockchain network-based data processing method of the embodiments of the present application. The computer program may be recorded on, for example, a computer-readable recording medium, and loaded into and run in the above-described computing device through the computer-readable recording medium.
Based on the same inventive concept, the principle and beneficial effects of the block chain network-based data processing device provided in the embodiments of the present application are similar to those of the block chain network-based data processing method in the embodiments of the present application, and may be referred to the principle and beneficial effects of the implementation of the method, which are not described herein for brevity.
Referring to fig. 9, fig. 9 is a schematic structural diagram of a computer device provided in an embodiment of the present application, where the computer device may be a terminal device or a server. As shown in fig. 9, the computer device includes at least a processor 901, a communication interface 902, and a memory 903. Wherein the processor 901, the communication interface 902, and the memory 903 may be connected by a bus or other means. Among them, the processor 901 (or central processing unit (Central Processing Unit, CPU)) is a computing core and a control core of a computer device, which can parse various instructions in the computer device and process various data of the computer device, for example: the CPU can be used for analyzing a startup and shutdown instruction sent by the object to the computer equipment and controlling the computer equipment to perform startup and shutdown operation; and the following steps: the CPU may transmit various types of interaction data between internal structures of the computer device, and so on. Communication interface 902 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI, mobile communication interface, etc.), and may be controlled by processor 901 to receive and transmit data; the communication interface 902 may also be used for transmission and interaction of data within a computer device. The Memory 903 (Memory) is a Memory device in a computer device for storing programs and data. It will be appreciated that the memory 903 here may include both built-in memory of the computer device and extended memory supported by the computer device. The memory 903 provides storage space that stores the operating system of the computer device, which may include, but is not limited to: android systems, iOS systems, windows Phone systems, etc., which are not limiting in this application.
The embodiments of the present application also provide a computer-readable storage medium (Memory), which is a Memory device in a computer device, for storing programs and data. It is understood that the computer readable storage medium herein may include both built-in storage media in a computer device and extended storage media supported by the computer device. The computer readable storage medium provides storage space that stores a processing system of a computer device. In this memory space, a computer program suitable for being loaded and executed by the processor 901 is also stored. Note that the computer readable storage medium can be either a high-speed RAM memory or a non-volatile memory (non-volatile memory), such as at least one magnetic disk memory; alternatively, it may be at least one computer-readable storage medium located remotely from the aforementioned processor.
In one embodiment, the computer device is the blockchain network node 102 shown in fig. 1 d. The processor 901 performs the following operations by running a computer program in the memory 903:
invoking at least one intelligent contract in the blockchain network to execute the transaction in response to the uplink request for the transaction;
Recording at least one contract execution information that is intelligent about in executing the transaction, the contract execution information including at least one of: contract execution results and contract execution logs;
constructing a merck tree based on the contract execution information, and adding the root node of the merck tree as check data of the contract execution information to the blockchain;
contract execution information is returned to the sender of the uplink request via the communication interface 902.
As an alternative embodiment, the contract execution information includes a contract execution log; the processor 901 further performs the following operations by running a computer program in the memory 903:
if at least one intelligent contract detects that the uplink request does not meet the uplink condition in the process of executing the transaction, recording violation information corresponding to the uplink request in a contract execution log.
As an alternative embodiment, the processor 901 records at least one specific embodiment of contract execution information that is intelligently integrated in the course of executing the transaction as follows:
recording, by a contract recording function, contract execution information for at least one intelligent contract during execution of the transaction;
wherein the contract recording function includes at least one of the following fields: a type field, an index field, a data field; the type field indicates the type of the contract execution information, and the index field screens the contract execution information.
As an alternative embodiment, the specific embodiment in which the processor 901 constructs the merck tree based on the contract execution information and adds the root node of the merck tree as the check data of the contract execution information to the blockchain is:
adding contract execution information to a to-be-stored certificate set, wherein the to-be-stored certificate set comprises one or more contract execution information;
when the to-be-stored evidence collection is detected to meet the evidence storage condition, constructing a merck tree based on one or more contract execution information in the to-be-stored evidence collection;
the hash value of the root node of the merck tree is used as check data of contract execution information, and the check data is added into the target block.
As an alternative embodiment, when detecting that the to-be-authenticated set meets the authentication condition, the processor 901 constructs a specific embodiment of the merck tree based on one or more contracts execution information in the to-be-authenticated set as follows:
when the to-be-stored evidence collection is detected to meet the evidence storage conditions, calculating hash values corresponding to all contract execution information in the to-be-stored evidence collection;
taking hash values corresponding to the contract execution information as leaf nodes of the merck tree, and constructing the merck tree;
wherein, the to-be-stored evidence collection meets the evidence storage condition and comprises any one of the following: the current moment is matched with the preset evidence storage time, and the quantity of contract execution information in the evidence storage set reaches a quantity threshold.
As an alternative embodiment, the specific embodiment in which the processor 901 constructs the merck tree based on the contract execution information and adds the root node of the merck tree as the check data of the contract execution information to the blockchain is:
constructing a merck tree based on the contract execution information, and adding the root node of the merck tree as check data of the contract execution information to the block header of the target block.
As an alternative embodiment, the processor 901 further performs the following operations by running a computer program in the memory 903:
acquiring at least one intelligent contract to be deployed;
the at least one smart contract to be deployed is deployed in response to a consensus of the at least one smart contract to be deployed through the blockchain network.
In another embodiment, the computer device is the service node 101 shown in fig. 1 d. The processor 1001 performs the following operations by running a computer program in the memory 1003:
sending a request for a transaction to a blockchain network node through a communication interface 1002 to enable the blockchain network node to call at least one intelligent contract in the blockchain network to execute the transaction, recording contract execution information of at least one intelligent contract in the process of executing the transaction, constructing a merck tree based on the contract execution information, and adding a root node of the merck tree to the blockchain as verification data of the contract execution information;
Receiving contract execution information returned by the block chain network node;
wherein the contract execution information includes at least one of: and (3) a contract execution result corresponding to the uplink request, and a contract execution log corresponding to the uplink request.
As an alternative embodiment, the contract execution information includes a contract execution log; if the uplink request does not satisfy the uplink component, the processor 1001 further performs the following operations by running the computer program in the memory 1003:
obtaining violation information existing in the uplink request from a contract execution log;
wherein the violation information is detected by at least one intelligent party in the course of executing the transaction.
As an alternative embodiment, the check data of the contract execution information includes a hash value of a root node of the merck tree generated based on the contract execution information; the processor 1001 also performs the following operations by running a computer program in the memory 1003:
acquiring certification information which is returned by the block chain network node and is associated with contract execution information;
based on the contract execution information and the proving information, obtaining to-be-verified data corresponding to the contract execution information;
obtaining check data from a blockchain;
if the verification data is matched with the data to be verified, judging that the contract execution information passes the verification.
Based on the same inventive concept, the principle and beneficial effects of the computer device for solving the problem provided in the embodiments of the present application are similar to those of the data processing method based on the blockchain network in the embodiments of the method of the present application, and may refer to the principle and beneficial effects of implementation of the method, which are not described herein for brevity.
The present application also provides a computer readable storage medium, in which a computer program is stored, the computer program being adapted to be loaded by a processor and to perform the data processing method based on a blockchain network of the above method embodiments.
The present application also provides a computer program product comprising a computer program adapted to be loaded by a processor and to perform the data processing method based on a blockchain network of the above method embodiments.
Embodiments of the present application also provide a computer program product or computer program comprising computer instructions stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions to cause the computer device to perform the data processing method based on the blockchain network as described above.
The steps in the method of the embodiment of the application can be sequentially adjusted, combined and deleted according to actual needs.
The modules in the device of the embodiment of the application can be combined, divided and deleted according to actual needs.
Those of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be implemented by a program to instruct related hardware, the program may be stored in a computer readable storage medium, and the readable storage medium may include: flash disk, read-Only Memory (ROM), random-access Memory (Random Access Memory, RAM), magnetic or optical disk, and the like.
The foregoing disclosure is only a preferred embodiment of the present application, and it is not intended to limit the scope of the claims, and one of ordinary skill in the art will understand that all or part of the processes for implementing the embodiments described above may be performed with equivalent changes in the claims of the present application and still fall within the scope of the claims.

Claims (15)

1. A method of data processing based on a blockchain network, the method comprising:
invoking at least one intelligent contract in a blockchain network to execute a transaction in response to a request for a uplink of the transaction;
Recording contract execution information of the at least one smart contract in executing the transaction, the contract execution information including at least one of: contract execution results and contract execution logs;
constructing a merck tree based on the contract execution information, and adding the root node of the merck tree as verification data of the contract execution information to a blockchain;
and returning the contract execution information to the sender of the uplink request.
2. The method of claim 1, wherein the contract execution information includes a contract execution log; the method further comprises the steps of:
and if the at least one intelligent contract detects that the uplink request does not meet the uplink condition in the process of executing the transaction, recording the violation information corresponding to the uplink request in a contract execution log.
3. The method of claim 1, wherein the recording contract execution information for the at least one smart contract in executing the transaction includes:
recording contract execution information of the at least one smart contract in executing the transaction through a contract recording function;
wherein the contract recording function includes at least one of the following fields: a type field, an index field, a data field; the type field is used for indicating the type of the contract execution information, and the index field is used for screening the contract execution information.
4. The method of claim 1, wherein constructing a merck tree based on the contract execution information and adding a root node of the merck tree as check data of contract execution information to a blockchain comprises:
adding the contract execution information to a to-be-stored certificate set, wherein the to-be-stored certificate set comprises one or more contract execution information;
when the to-be-stored evidence collection is detected to meet the evidence storage condition, constructing a merck tree based on one or more contract execution information in the to-be-stored evidence collection;
and taking the hash value of the root node of the merck tree as check data of the contract execution information, and adding the check data into a target block.
5. The method of claim 4, wherein the constructing the merck tree based on one or more contracts execution information in the set of to-be-authenticated when the set of to-be-authenticated is detected to satisfy an authentication condition comprises:
when the to-be-stored evidence collection is detected to meet the evidence storage conditions, calculating hash values corresponding to all contract execution information in the to-be-stored evidence collection;
taking hash values corresponding to the contract execution information as leaf nodes of the merck tree, and constructing the merck tree;
Wherein the to-be-stored-certificate set meets the certificate storing conditions, including any one of the following: the current moment is matched with the preset evidence storage time, and the quantity of contract execution information in the to-be-stored evidence collection reaches a quantity threshold.
6. The method of claim 1, wherein constructing a merck tree based on the contract execution information and adding a root node of the merck tree as check data of contract execution information to a blockchain comprises:
constructing a merck tree based on the contract execution information, and adding the root node of the merck tree as verification data of the contract execution information to the block header of the target block.
7. The method of claim 1, wherein the method further comprises:
acquiring at least one intelligent contract to be deployed;
deploying the at least one smart contract to be deployed in response to a consensus of the at least one smart contract to be deployed through the blockchain network.
8. A method of data processing based on a blockchain network, the method comprising:
sending an uplink request for a transaction to a blockchain network node, so that the blockchain network node calls at least one intelligent contract in a blockchain network to execute the transaction, records contract execution information of the at least one intelligent contract in the process of executing the transaction, constructs a merck tree based on the contract execution information, and adds a root node of the merck tree to a blockchain as verification data of the contract execution information;
Receiving contract execution information returned by the blockchain network node;
wherein the contract execution information includes at least one of: and the contract execution result corresponding to the uplink request is a contract execution log corresponding to the uplink request.
9. The method of claim 8, wherein the contract execution information includes a contract execution log; if the uplink request does not meet the uplink condition, the method further includes:
obtaining violation information existing in the uplink request from the contract execution log;
wherein the violation information is detected by the at least one smart contract during execution of the transaction.
10. The method of claim 8, wherein the verification data of the contract execution information includes a hash value of a root node of a merck tree generated based on the contract execution information; the method further comprises the steps of:
acquiring certification information which is returned by the blockchain network node and is associated with the contract execution information;
based on the contract execution information and the proving information, obtaining to-be-verified data corresponding to the contract execution information;
acquiring the check data from the blockchain;
And if the verification data are matched with the data to be verified, judging that the contract execution information passes the verification.
11. A blockchain network-based data processing device, the data processing device comprising:
a processing unit for invoking at least one intelligent contract in a blockchain network to execute a transaction in response to a uplink request for the transaction; and contract execution information for recording the at least one smart contract in executing the transaction, the contract execution information including at least one of: contract execution results and contract execution logs; and the system is used for constructing a merck tree based on the contract execution information and adding the root node of the merck tree to a blockchain as verification data of the contract execution information;
and the sending unit is used for returning the contract execution information to the sender of the uplink request.
12. A blockchain network-based data processing device, the data processing device comprising:
a sending unit, configured to send a request for uplink of a transaction to a blockchain network node, so that the blockchain network node invokes at least one intelligent contract in a blockchain network to execute the transaction, records contract execution information of the at least one intelligent contract in a process of executing the transaction, constructs a merck tree based on the contract execution information, and adds a root node of the merck tree as verification data of the contract execution information to a blockchain;
The receiving unit is used for receiving the contract execution information returned by the blockchain network node;
wherein the contract execution information includes at least one of: and the contract execution result corresponding to the uplink request is a contract execution log corresponding to the uplink request.
13. A computer device, comprising: a memory device and a processor;
a memory in which a computer program is stored;
a processor for loading the computer program to implement the blockchain network-based data processing method of any of claims 1-7; or for loading said computer program for implementing a blockchain network-based data processing method as claimed in any of claims 8-10.
14. A computer readable storage medium, characterized in that the computer readable storage medium stores a computer program adapted to be loaded by a processor and to perform the blockchain network based data processing method according to any of the claims 1-7; or load and execute the blockchain network-based data processing method of any of claims 8-10.
15. A computer program product, characterized in that the computer program product comprises a computer program adapted to be loaded by a processor and to perform the blockchain network based data processing method according to any of the claims 1-7; or load and execute the blockchain network-based data processing method of any of claims 8-10.
CN202210953416.XA 2022-08-09 2022-08-09 Data processing method based on block chain network, related equipment and product Pending CN117633903A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210953416.XA CN117633903A (en) 2022-08-09 2022-08-09 Data processing method based on block chain network, related equipment and product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210953416.XA CN117633903A (en) 2022-08-09 2022-08-09 Data processing method based on block chain network, related equipment and product

Publications (1)

Publication Number Publication Date
CN117633903A true CN117633903A (en) 2024-03-01

Family

ID=90018560

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210953416.XA Pending CN117633903A (en) 2022-08-09 2022-08-09 Data processing method based on block chain network, related equipment and product

Country Status (1)

Country Link
CN (1) CN117633903A (en)

Similar Documents

Publication Publication Date Title
TWI733328B (en) Method and device for sending certifiable messages across chains
WO2020258846A1 (en) Method and apparatus for sending certifiable messages across chains
US10878248B2 (en) Media authentication using distributed ledger
US11336451B2 (en) Cross-blockchain resource transmission
US10924281B2 (en) Method and apparatus for inter-blockchain transmission of authenticable message
WO2020258847A1 (en) Method and apparatus for cross-chain transmission of authenticable message based on processing module
CN112818014B (en) Block chain data analysis method and device and electronic equipment
CN110597918A (en) Account management method and device and computer readable storage medium
CN112597485B (en) Information checking method, device and equipment based on block chain and storage medium
CN110598452B (en) Evidence information processing method, device, storage medium and equipment based on blockchain
CN114567643A (en) Cross-block-chain data transfer method, device and related equipment
CN111597537B (en) Block chain network-based certificate issuing method, related equipment and medium
TWI728692B (en) Method and device for sending certifiable messages across chains
CN117633903A (en) Data processing method based on block chain network, related equipment and product
CN112269915B (en) Service processing method, device, equipment and storage medium
CN110597466B (en) Control method and device of block chain node, storage medium and computer equipment
CN117040929B (en) Access processing method, device, equipment, medium and program product
CN112270601B (en) Information transfer method, information transfer device, electronic equipment and readable storage medium
WO2024007855A1 (en) Data processing method and device based on blockchain, and readable storage medium
US20230325833A1 (en) Blockchain-based data processing method and apparatus, device, storage medium, and program product
CN115375304A (en) Data processing method, device, equipment and medium based on block chain
CN117097478A (en) Data processing method and device based on block chain and related equipment
CN116932582A (en) Block chain-based data processing method, device and equipment, medium and product
CN117155953A (en) Data processing method, device, computer equipment and readable storage medium
CN117557372A (en) Block chain-based data processing method, equipment and readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination