CN111556115A - Data processing method, device and equipment based on block chain and storage medium - Google Patents

Data processing method, device and equipment based on block chain and storage medium Download PDF

Info

Publication number
CN111556115A
CN111556115A CN202010322029.7A CN202010322029A CN111556115A CN 111556115 A CN111556115 A CN 111556115A CN 202010322029 A CN202010322029 A CN 202010322029A CN 111556115 A CN111556115 A CN 111556115A
Authority
CN
China
Prior art keywords
block
transaction execution
node
target
consensus
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.)
Granted
Application number
CN202010322029.7A
Other languages
Chinese (zh)
Other versions
CN111556115B (en
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.)
Tenpay Payment Technology Co Ltd
Original Assignee
Tenpay Payment Technology 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 Tenpay Payment Technology Co Ltd filed Critical Tenpay Payment Technology Co Ltd
Priority to CN202010322029.7A priority Critical patent/CN111556115B/en
Publication of CN111556115A publication Critical patent/CN111556115A/en
Application granted granted Critical
Publication of CN111556115B publication Critical patent/CN111556115B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3236Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2209/00Additional information or applications relating to cryptographic mechanisms or cryptographic arrangements for secret or secure communication H04L9/00
    • H04L2209/46Secure multiparty computation, e.g. millionaire problem
    • H04L2209/463Electronic voting
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/50Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using hash chains, e.g. blockchains or hash trees
    • 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, a device, equipment and a readable storage medium based on a block chain, wherein the method comprises the following steps: a first node generates a first block; the first node acquires a local transaction execution result which is locally generated and aims at the historical block; the block height of the first block is larger than that of the historical block; the first node determines a target transaction execution result from the local transaction execution result, broadcasts the first block and the target transaction execution result to at least two second nodes, so that the at least two second nodes perform sequencing consensus on the first block and perform transaction execution result consensus on the target block; the target block is a block corresponding to the target transaction execution result, and the target block is a block which passes sequencing consensus; when the target block is identified by the transaction execution result, the first node stores the target block and the target transaction execution result in the block chain in a related manner. By adopting the method and the device, the generation of the block can be efficiently promoted, and the consensus speed is improved.

Description

Data processing method, device and equipment based on block chain and storage medium
Technical Field
The present application relates to the field of internet technologies, and in particular, to a data processing method, apparatus, device, and readable storage medium based on a block chain.
Background
With the rapid development of network technology and the emphasis of enterprises on data security, the blockchain is greatly emphasized and applied. A blockchain, which is a novel application mode of computer technology, is essentially a decentralized database, which is a string of associated data blocks (i.e., blocks) generated by using cryptography, each data block containing a batch of network transaction data for verifying the validity (anti-counterfeiting) of the data and generating the next block, thereby generating a non-tampered data chain.
When a block is newly generated by the common node, the block needs to be broadcasted to other common nodes so as to perform common identification on the new block. In the prior art, the consensus step includes two parts, namely sequencing and transaction execution, and the two parts are executed serially, that is, after the consensus node completes the block n by sequencing, it is necessary to continue to generate a transaction execution result of the block n after sequencing, and then vote and consensus are performed on the block n after sequencing and the transaction execution result of the block n through other consensus nodes. If the other consensus nodes vote, the other consensus nodes also generate the transaction execution result of the block n. However, the processing speeds of the different consensus nodes are not consistent, so that in order to complete the consensus on the block n, it takes time to wait for other consensus nodes to generate the transaction execution result of the block n, and after the block n passes the consensus network generates and broadcasts the block of the next height. It can be seen that if the speed of generating the transaction execution result by the consensus node is slow, the time interval for generating the next block is also long, so that it is difficult to efficiently advance the generation of the block, and the consensus speed is reduced.
Disclosure of Invention
The embodiment of the application provides a data processing method, a data processing device, data processing equipment and a readable storage medium based on a block chain, which can efficiently promote generation of blocks and improve consensus speed.
An embodiment of the present application provides a data processing method based on a block chain, including:
a first node generates a first block;
the first node acquires a local transaction execution result which is locally generated and aims at the historical block; the block height of the first block is larger than that of the historical block;
the first node determines a target transaction execution result from the local transaction execution result, and broadcasts the first block and the target transaction execution result to at least two second nodes, so that the at least two second nodes perform sequencing consensus on the first block and perform transaction execution result consensus on the target block; the target block is a block corresponding to the target transaction execution result, and the target block is a block which passes sequencing consensus;
when the target blocks are identified by the transaction execution result, the first node stores the target blocks and the target transaction execution result in a block chain in a related manner.
An embodiment of the present application provides a data processing method based on a block chain, including:
the second node acquires a first block broadcasted by the first node and a target transaction execution result; the first block and the target transaction execution result are both generated by the first node;
the second node performs sequencing consensus on the first block;
the second node performs transaction execution result consensus on the target block according to the target transaction execution result; the target block is a block corresponding to the target transaction execution result, the block height of the first block is larger than that of the target block, and the target block is a block which is known by sequencing;
when the target blocks are identified by the transaction execution results and the second node has generated the transaction execution results of the target blocks, the second node stores the target blocks and the transaction execution results of the target blocks generated by the second node in a block chain in a related manner.
An aspect of an embodiment of the present application provides a data processing apparatus based on a block chain, including:
a block generation module for generating a first block;
the local result acquisition module is used for acquiring a local transaction execution result which is locally generated and aims at the historical block; the block height of the first block is larger than that of the historical block;
a broadcast block result module, configured to determine a target transaction execution result from the local transaction execution results, and broadcast the first block and the target transaction execution result to at least two second nodes, so that the at least two second nodes perform sequencing consensus on the first block and perform transaction execution result consensus on the target block; the target block is a block corresponding to the target transaction execution result, and the target block is a block which passes sequencing consensus;
the first storage block result module is used for storing the target block and the target transaction execution result into a block chain in a related way when the target block is identified by the transaction execution result.
Wherein, the block generating module includes:
the data acquisition unit is used for acquiring the second block and transaction data; the second block is generated by a target node of the at least two second nodes;
a sequencing data unit for sequencing the transaction data and generating a block hash parameter according to the second block and the sequenced transaction data;
a block generation unit configured to generate the first block according to the block hash parameter and the sequenced transaction data; the second block is a previous block of the first block.
Wherein, the broadcast block result module comprises:
a broadcast result determining unit, configured to determine a broadcast transaction execution result in the local transaction execution results according to the transaction execution results broadcast by the at least two second nodes;
a target result determining unit, configured to determine, as a target transaction execution result, a transaction execution result other than the broadcasted transaction execution result in the local transaction execution result; the block height of the target block is greater than the block height corresponding to the broadcasted transaction execution result.
Wherein, the broadcast block result module further comprises:
the generation voucher unit is used for generating a Merck tree root voucher according to the local transaction execution result;
a broadcast result voucher unit for broadcasting the first block, the target transaction execution result and the merkel root voucher to the at least two second nodes; the Mercker root certificate is used for the at least two second nodes to agree on the transaction execution result of the target block.
Wherein, the first storage block result module comprises:
a voting result obtaining unit, configured to obtain the voting results of the transaction executions respectively sent by the at least two second nodes; the transaction execution voting result is a voting result that the transaction execution results are identified with respect to the target block;
a consensus determining unit, configured to determine a consensus result of the transaction execution results for the target block according to the transaction execution voting result;
and a block result storage unit, configured to store the target block and the target transaction execution result in association with each other in the block chain when a consensus result of the transaction execution results of the target block is a consensus pass result.
Wherein, the unit for determining consensus result comprises:
a statistic voting pass sub-unit for counting the number of the transaction execution voting results belonging to the voting pass as the number of passing votes in the transaction execution voting results;
a consensus result determining subunit, configured to determine a consensus result of the transaction execution results of the target blocks as a consensus pass result when the number of pass votes is equal to or greater than a consensus pass threshold;
the consensus determining result subunit is further configured to determine that the consensus result of the transaction execution results of the target block is a consensus failure result when the number of pass votes is smaller than a consensus pass threshold.
An aspect of an embodiment of the present application provides a data processing apparatus based on a block chain, including:
the acquisition block result module is used for acquiring a first block broadcasted by the first node and a target transaction execution result; the first block and the target transaction execution result are both generated by the first node;
a sequencing consensus block module, configured to perform sequencing consensus on the first block;
the consensus target result module is used for performing transaction execution result consensus on the target block according to the target transaction execution result; the target block is a block corresponding to the target transaction execution result, the block height of the first block is larger than that of the target block, and the target block is a block which is known by sequencing;
a second storage block result module, configured to store the target block and the transaction execution result of the target block generated by the second node in a block chain in an associated manner when the target block is identified by the transaction execution result and the second node has generated the transaction execution result of the target block.
Wherein the sequencing consensus block module comprises:
a block hash value obtaining unit, configured to obtain a hash value of the mercker tree root and the transaction data in the first block;
a root to be verified generating unit, configured to generate a root of a tachr tree to be verified according to the hash value of the transaction data in the first block;
a verification data validity unit, configured to verify validity of the transaction data in the first block when the root of the mercker tree in the first block is the same as the root of the mercker tree to be verified;
a broadcast sequencing-pass result unit, configured to broadcast a sequencing-pass voting result for the first block to at least two consensus nodes when the transaction data in the first block is legal; the at least two common nodes include the first node;
and a sequencing voting result acquiring unit configured to acquire a sequencing voting result for the first block sent by the at least two consensus nodes, and determine a sequencing consensus result for the first block according to the acquired sequencing voting result and a locally generated sequencing pass voting result.
Wherein, the sequencing consensus block module further comprises:
a transaction data acquisition unit, configured to acquire transaction data when the first block is identified by sequencing;
a block hash parameter generation unit, configured to sequence the transaction data, and generate a block hash parameter of a second block according to the first block and the sequenced transaction data;
a second block generation unit configured to generate the second block according to the block hash parameter of the second block and the sequenced transaction data; the first block is a subsequent block to the second block.
Wherein, the consensus target result module comprises:
a broadcast certificate acquiring unit, configured to acquire a tacle root certificate broadcasted by the first node; the Merck root voucher is a voucher generated based on a result of the execution of the transaction generated by the first node; the target transaction execution result is a transaction execution result except a transaction execution result broadcasted in the consensus network, among the transaction execution results generated by the first node;
the local transaction result acquisition unit is used for acquiring a local transaction execution result which is locally generated and aims at the historical block; the block height of the first block is larger than that of the historical block;
a to-be-verified voucher generating unit, configured to generate a to-be-verified tacl root voucher according to the local transaction execution result and the target transaction execution result;
and the consensus block transaction result unit is used for performing transaction execution result consensus on the target block according to the Mercker root certificate to be verified and the Mercker root certificate.
Wherein, the generating of the unit of the certificate to be verified comprises:
an obtaining block height subunit, configured to obtain a highest block height in a block corresponding to the local transaction execution result;
and a to-be-verified voucher generating subunit, configured to generate the to-be-verified tacle root voucher according to the local transaction execution result and the target transaction execution result, if the highest block height is smaller than the block height of the target block.
Wherein, the consensus block transaction result unit comprises:
a broadcast transaction passing result subunit, configured to broadcast a transaction passing voting result for the target block to the at least two consensus nodes when the tacher root certificate to be verified and the tacher root certificate are the same; the transaction execution represents that the second node is commonly identified through the transaction execution result aiming at the target block through the voting result;
a get transaction vote result subunit, configured to get a result of performing vote on the transaction of the target block sent by the at least two consensus nodes;
and the transaction consensus determining result subunit is used for determining the transaction execution consensus result of the target block according to the acquired transaction execution voting result and the locally generated transaction execution passing voting result.
One aspect of the present application provides a computer device, comprising: a processor, a memory, a network interface;
the processor is connected to the memory and the network interface, wherein the network interface is used for providing a data communication function, the memory is used for storing a computer program, and the processor is used for calling the computer program to execute the method in the embodiment of the present application.
An aspect of the embodiments of the present application provides a computer-readable storage medium storing a computer program, where the computer program includes program instructions, which, when executed by a processor, perform a method as in the embodiments of the present application.
In the embodiment of the present application, after the first block is generated by the first node, the target transaction execution result is determined in the local transaction execution results for the historical blocks, which have been locally generated by the first node, because the first node broadcasts the sequenced first block and also broadcasts the latest transaction execution result, that is, the target transaction execution result, at the same time, at least two second nodes can not only perform sequencing consensus on the first block, but also perform transaction execution result consensus on the target block (that is, the block corresponding to the target transaction execution result). As described above, by asynchronously processing the sequencing consensus and the transaction execution result consensus of the first node, that is, after the first node completes sequencing the first tile, the second node does not need to wait for the first node to output the transaction execution result of the first tile, and can directly generate the next tile on the basis of the first tile, thereby efficiently advancing the generation of the tile.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a system architecture diagram according to an embodiment of the present application;
fig. 2 is a schematic view of a scenario of data processing based on a block chain according to an embodiment of the present application;
fig. 3 is a schematic flowchart of a data processing method based on a block chain according to an embodiment of the present application;
fig. 4a is a schematic view of a scenario of data processing based on a block chain according to an embodiment of the present application;
fig. 4b is a schematic view of a scenario of data processing based on a block chain according to an embodiment of the present application;
fig. 5 is a schematic view of a scenario of data processing based on a block chain according to an embodiment of the present application;
fig. 6 is a schematic view of a scenario of data processing based on a block chain according to an embodiment of the present application;
fig. 7 is a schematic view of a scenario of data processing based on a block chain according to an embodiment of the present application;
fig. 8 is a schematic flowchart of a data processing method based on a blockchain according to an embodiment of the present application;
fig. 9 is a schematic structural diagram of a data processing apparatus based on a block chain according to an embodiment of the present application;
fig. 10 is a schematic structural diagram of a data processing apparatus based on a block chain according to an embodiment of the present application;
FIG. 11 is a schematic structural diagram of a computer device according to an embodiment of the present disclosure;
fig. 12 is a schematic structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Please refer to fig. 1, which is a schematic diagram of a system architecture according to an embodiment of the present application. With the rapid development of network technology and the emphasis of enterprises on data security, the blockchain is greatly emphasized and applied. When a block is newly generated by a common node of the block chain, it needs to be broadcasted to other common nodes to commonly identify the new block, as shown in fig. 1, the common node 101 is referred to as a first node, the common node cluster 102 is referred to as at least two second nodes, the common node cluster 102 may include a common node 1021, common nodes 1022 and …, and a common node 1023, and the common node 101 and the common node cluster 102 belong to the same common network. Each consensus node (including the consensus node 101 and the consensus node cluster 102) can receive data sent from the outside during normal operation, and perform block consensus based on the received data. In order to ensure data intercommunication between the respective common nodes, there may be a data connection between each common node, that is, there may be a data connection between the common node 101 and the common node 1021, the common nodes 1022 and …, and the common node 1023, and the common nodes may perform data or block transmission through the data connection. For example, when the consensus node 101 obtains transaction data from the transaction pool, the consensus node 101 packages the transaction data into a block and broadcasts the block to the consensus node cluster 102. The cluster of consensus nodes 102 performs consensus, verification, storage, etc. on the block according to a consensus algorithm, so that the data (i.e., the block) stored on all the consensus nodes can be kept consistent.
Each common node of the storage block chain has a node identifier corresponding thereto, and each common node may store node identifiers of other common nodes having a connection relationship with itself, so that the generated blocks or data are broadcast to other common nodes according to the node identifiers of the other common nodes in the following, for example, a node identifier list shown in table 1 may be maintained in the common node 101, where the node identifier list stores node names and node identifiers of the common nodes in the common node cluster 102.
TABLE 1
Node name Node identification
Consensus node
1021 117.114.151.174
Consensus node 1022 117.116.189.145
Consensus node 1023 119.123.789.258
The node identifier may be an Internet Protocol (IP) address and any other information that can be used to identify the consensus node, and only the IP address is used as an example in table 1.
Further, to facilitate understanding, some terms are described below:
1. block chains: in a narrow sense, a block chain is a chain data structure taking a block as a basic unit, and the prior transaction history is verified by utilizing a digital abstract in the block, so that the block chain is suitable for the requirements of tamper resistance and expandability under a distributed accounting scene; in a broad sense, blockchain also refers to distributed accounting techniques implemented by blockchain architecture, including distributed consensus, privacy and security protection, peer-to-peer communication techniques, network protocols, intelligent contracts, and the like. The goal of the blockchain is to implement a distributed data record ledger that allows only additions and not deletions. The basic structure of the ledger bottom layer is a linear linked list. The linked list is composed of a series of 'blocks', the Hash (Hash) value of the previous block is recorded in the subsequent block, and whether each block (and the transaction in the block) is legal or not can be quickly checked by calculating the Hash value. If a node in the network proposes to add a new block, the block must be acknowledged through a consensus mechanism.
2. Block (Block): recording all transaction data and status results, etc. occurring over a period of time is a consensus on the current ledger status. Specifically, for the block chain, each time transaction data is written, i.e. the transaction process described above, a block is created.
3. Chain (Chain): the blocks are connected in series according to the occurrence sequence and are log records of the state change of the whole account book.
4. A consensus mechanism: the verification and confirmation of transaction data are completed in a short time through voting of special nodes, the goal is to make all core nodes store consistent block chain diagrams, which are algorithms for achieving distributed consensus, such as Proof of Work (POW), Proof of rights and interests (PoS), and a bayesian consensus algorithm (PBFT).
Referring to fig. 1 again, when the consensus node 101 acquires partial transaction data in the transaction pool, the transaction data is sequenced first, and then a first block is generated according to the sequenced transaction data, where an arrangement order of the transaction data in the first block is a sequencing result. At this time, after the sequencing is completed, the consensus node 101 may propagate the first block to the consensus node cluster 102, so that the consensus node cluster 102 performs sequencing consensus on the first block, and it is not necessary for the consensus node 101 of the present application to wait until the transaction execution result of the first block is generated before broadcasting the first block. And while broadcasting the first block, the consensus node 101 may also broadcast the latest transaction execution result for the history block (wherein the block height of the history block is lower than the block height of the first block, and the broadcasted latest transaction execution result is generated by the consensus node 101) to the consensus node cluster 102. For example, the first block generated by the consensus node 101 is block 5 (numeral 5 represents a block height, i.e. the block height is 5), and the consensus node 101 may currently only generate the transaction execution results corresponding to blocks 1-3, and if the block corresponding to the transaction execution results broadcasted in the current consensus network is block 1-2, the consensus node 101 may broadcast the transaction execution results corresponding to the locally generated block 3 to the consensus node cluster 102 together, so that the entire consensus network may not only perform sequencing consensus on the block 5, but also perform transaction execution result consensus on the block 3. It can be seen that the present application separates the sequencing process and the transaction execution result generation process in an asynchronous manner, i.e., the module for executing sequencing is not associated with the module for generating transaction execution results. Therefore, the block generated by sequencing can lead the generated transaction execution result, and the sequenced blocks are broadcasted in advance, so that the sequencing consensus of the blocks can be completed in advance, the generation of the blocks can be effectively promoted, and the consensus speed is improved.
It is understood that the methods provided by the embodiments of the present application may be performed by a computer device, including but not limited to a terminal or a server. The consensus node in the embodiment of the present application may be a computer device.
The common node 101 and the common node cluster 102 composed Of the common node 1021, the common nodes 1022, …, and the common node 1023 in fig. 1 may include a mobile phone, a tablet computer, a notebook computer, a handheld computer, an intelligent sound, a mobile internet device (MID, a mobile internet device), a Point Of Sale (POS) machine, a wearable device (e.g., a smart watch, a smart bracelet, etc.), and the like.
Further, please refer to fig. 2, which is a schematic view of a block chain-based data processing scenario provided in an embodiment of the present application. As shown in fig. 2, after the first node 10 acquires the transaction data, the transaction data is sequenced to obtain the sequenced transaction data 11, and then the previous block 128 is acquired in the buffer 13, and a first block 129 is generated according to the block header of the previous block 128 and the sequenced transaction data 11. The above-mentioned cache region 13 includes blocks 125, …, a previous block 128 and a first block 129, and the blocks (also including blocks 125, …, a previous block 128 and a first block 129) in the cache region 13 are well-sequenced blocks, and except for the newly generated first block 129, other blocks have completed sequencing consensus in the consensus network, that is, at least two second nodes associated with the first node 10 respectively pass through the sequencing consensus on the above-mentioned blocks 125, … and the previous block 128, but have not yet performed transaction execution result consensus in the consensus network, as shown in fig. 2, the first node has generated a transaction execution result 1251 corresponding to the block 125, and has not yet generated a local transaction execution result of the blocks after the block 125 (also including the previous block 128).
The blocks 121, …, and 124 in fig. 2 not only complete the sequencing consensus in the consensus network, but also complete the transaction execution result consensus, that is, at least two second nodes associated with the first node 10 pass the transaction execution result consensus on the above-mentioned blocks 121, …, and 124, respectively, so that the blocks 121-124 can be written into the local ledger 12, wherein the block 124 is a previous block of the block 125, that is, the block 124 is a parent block of the block 125. The local transaction execution results of the first node 10 include transaction execution results 1211 and … corresponding to block 121, transaction execution result 1241 corresponding to block 124 in the local ledger 12, and transaction execution result 1251 corresponding to block 125 in the cache area 13. Since the transaction execution results 1211 and … corresponding to the block 121 and the transaction execution result 1241 corresponding to the block 124 have been broadcast in the consensus network, the transaction execution result 1251 corresponding to the block 125 is the target transaction execution result of the first node 10 (also the transaction execution result that has not been broadcast in the consensus network).
As described above, after the first node 10 generates the first block 129, the latest local transaction execution result (i.e. the transaction execution result 1251 in fig. 2) and the mercker tree root certificate 14 are broadcast to at least two second nodes while the first block 129 is broadcast to at least two second nodes, where the mercker tree root certificate 14 is a mercker tree root formed by all local transaction execution results (including the transaction execution results 1211 and …, the transaction execution result 1241, and the transaction execution result 1251) of the first node 10, and the mercker tree root certificate 14 is used for the at least two second nodes to agree on the transaction execution result of the block (i.e. the block 125) corresponding to the target transaction execution result.
Taking the second node 20 of the at least two second nodes as an example, as shown in fig. 2, the local account 22 of the second node 20 includes blocks 121, … and block 124, where the block 121 in the local account 22 belonging to the second node 20 is identical to the block 121 in the local account 12 belonging to the first node 10, and similarly, the block 124 in the local account 22 is identical to the block 124 in the local account 12, and the rest of the blocks in the local account 22 are also identical. The cache 23 of the second node 20 comprises the blocks 125, … and the preceding block 128, wherein the block 125 in the cache 23 belonging to the second node 20 is identical to the block 125 in the cache 13 belonging to the first node 10, and similarly, the remaining blocks in the cache 23 are the same. When the first node 10 broadcasts the first block 129, the transaction execution result 1251 and the mercker tree root certificate 14 to the second node 20, the second node 20 has not generated the transaction execution result corresponding to the block 125, and the second node 20 has locally generated the transaction execution results 1212, … corresponding to the block 121 and the transaction execution result 1242 corresponding to the block 124, at this time, the second node 20 can perform the consensus of sequencing on the first block 129, and also perform the consensus of transaction execution result on the block 125 corresponding to the target transaction execution result in advance according to the mercker tree root certificate 14 and the target transaction execution result, which includes the following specific processes: the second node 20 generates the tacle certificate to be verified according to the local transaction execution result (including the transaction execution results 1212 and … and the transaction execution result 1242) and the target transaction execution result (i.e., the transaction execution result 1251), and performs the transaction execution result consensus on the block 125 according to the tacle root certificate to be verified and the tacle root certificate 14.
For the first node 10, since the sequencing consensus and the transaction execution result consensus can be asynchronously performed, the first node 10 can preferentially complete the sequencing consensus of the blocks 121 to 129 through the sequencing module, and the transaction execution result processing module can also asynchronously generate the transaction execution results of the blocks 121 to 129 one by one, that is, the generation of the transaction execution results does not need to wait in the process of generating the blocks through the sequencing module, so that the generation of the blocks can be efficiently advanced, and the block consensus speed is improved.
In the embodiment of the present application, the first node 10 generating the first block 129 and generating the transaction execution result for the block 125, and the second node 20 receiving the first block 129, the target transaction execution result, and the mercker tree root certificate 14 are described, but other common nodes may also perform block data processing according to the embodiment of the present application.
Further, please refer to fig. 3, which is a flowchart illustrating a data processing method based on a block chain according to an embodiment of the present application. As shown in fig. 3, the data processing procedure includes the following steps:
in step S101, a first block is generated.
Specifically, the first node acquires a second block and transaction data; the second block is generated by a target node of the at least two second nodes; the first node sequences the transaction data and generates a block hash parameter according to the second block and the sequenced transaction data; the first node generates the first block according to the block hash parameter and the sequenced transaction data; the second block is a previous block of the first block.
The block chain is formed by serially connecting "blocks", please refer to fig. 2 again, and it is assumed that the block 121 is a starting block in the local account 12 of the first node 10, the starting block includes a block header and a block body, the block header can store hash values, version numbers, timestamps, difficulty values, and the like of the acquired transaction data, and the block body stores the transaction data; the next block of the starting block takes the starting block as a parent block, the next block also comprises a block head and a block body, the block head can store the hash value of the transaction data of the current block, the block head hash value, the version number, the timestamp, the difficulty value and the like of the parent block, and the like, so that the block data stored in each block in the local account book 12 are associated with the block data stored in the parent block, and the safety of the input information in the block is ensured.
When the first node 10 acquires the transaction data, sequencing the transaction data, that is, sequencing the transaction execution sequence of the transaction data in the first block 129, storing the sequenced transaction data 11 into a local memory pool, updating a hash tree used for recording the transaction data, updating an update timestamp to be the time when the transaction data is received, trying different random numbers, performing hash value calculation on the sequenced transaction data 11 for multiple times, and generating a hash value corresponding to each transaction data and a mercker tree root in a block header; then, the first node 10 acquires the previous block 128, determines the block head hash value of the parent block of the first block 129 according to the previous block 128, and generates the block hash parameter according to the block head hash value of the parent block and the sequenced transaction data 11, where the block hash parameter is each parameter included in the block head of the first block 129, such as the block head hash value, the block head hash value of the parent block, the block height, the merckel root, the block generation signature, the timestamp, and the like.
The first node 10 generates a block header and a block body according to the block hash parameter and the sequenced transaction data 11 to obtain a first block 129, and stores the newly generated block 129 into the buffer area 13, at this time, the first node 10 completes sequencing consensus on the first block 129, and the transaction execution result is not calculated for each piece of transaction data in the first block 129.
Step S102, obtaining a local transaction execution result.
Specifically, the first node obtains a local transaction execution result locally generated for the history block; the block height of the first block is greater than the block height of the history block.
Referring to fig. 2 again, as shown in fig. 2, the local account book 12 of the first node 10 includes blocks 121, … and 124, the blocks 121, … and 124 have already been identified in the consensus network by the transaction execution result, and the first node 10 has generated the transaction execution results corresponding to the blocks 121, … and 124, i.e. the transaction execution results 1211 and … and the transaction execution result 1251. The cache 13 of the first node 10 includes the blocks 125, …, the previous block 128 and the first block 129, but the block for calculating the transaction execution result includes only the block 125, i.e. the transaction execution result 1251, so the local transaction execution result of the first node 10 includes the transaction execution results 1211, …, the transaction execution result 1241 and the transaction execution result 1251.
It should be noted that the first block 129 is generated by the first node 10, but the blocks (also including the blocks 121, …, and 124) in the local ledger 12 and the blocks (the blocks 125, …, and the previous block 1028) in the cache area 13 are not necessarily generated by the first node 10, or only a small part of the blocks are generated by the first node 10, and most of the blocks are generated by the at least two second nodes associated with the first node 10, please refer to fig. 4a together, which is a schematic view of a scenario of data processing based on a block chain provided in the embodiment of the present application. As shown in fig. 4a, the consensus node 40, the consensus nodes 30, …, the first node 10, and the second node 20 form a consensus node cluster, the consensus nodes in the consensus node cluster acquire transaction data from the transaction pool in turn according to a certain rule to generate blocks, as shown in fig. 4a, the block 125 is generated by the consensus node 40, that is, after the consensus node 40 acquires the transaction data from the transaction pool, the transaction data is sequenced and identified by itself, and the specific sequencing and identification process may refer to the sequencing and identification process of the first block 129 in the step S101, which is not described herein again, and after the sequencing and identification of the transaction data is completed, the block 125 is generated, and the consensus node 40 respectively sends the newly generated block 125 (the transaction execution result of the block 125 is not generated yet) to the consensus node 30, the block 125 is generated according to node identifiers of other consensus nodes (including the consensus node 30, the first node 10, and the second node 20) …, a first node 10, a second node 20. The consensus node 30 performs sequencing consensus on the blocks 125, and after sequencing consensus on the blocks 125 is obtained and sequencing pass consensus results for the blocks 125 sent by the first node 10, … and the second node 20 are obtained, the blocks 125 are cached in a cache area; similarly, the first node 10 performs sequencing consensus on the block 125, and after obtaining sequencing passing consensus results for the block 125 sent by the consensus nodes 30 and … and the second node 20 respectively through sequencing consensus on the block 125, buffers the block 125 into a buffer; the second node 20 performs the sequence consensus on the block 125, acquires the sequence passing consensus on the block 125, which is sent by the consensus nodes 30 and … and the first node 20, and then buffers the block 125 in the buffer.
Please refer to fig. 4b, which is a schematic view of a block chain-based data processing scenario according to an embodiment of the present application. In the above, the consensus nodes in the consensus node cluster acquire transaction data from the transaction pool in turn according to a certain rule to generate blocks by packaging, as shown in fig. 4b, according to the rotation rule, the first node 10 acquires transaction data from the transaction pool, generates the first block 129 according to the transaction data, and when the ordering consensus on the first block 129 is completed, also generates the transaction execution result of the block 125 in the buffer (i.e. the transaction execution result 1251 in fig. 2), thus while broadcasting the first tile 129 to the consensus node 40, the consensus nodes 30, …, and the second node 20, the transaction results for the block 125 are also broadcast to the consensus node 40, the consensus nodes 30, …, and the second node 20, so that the consensus node 40, the consensus nodes 30, …, and the second node 20 agree on the results of the transaction executions performed on the block 125. The sequencing consensus process of the block 129 by the consensus node cluster may refer to the sequencing consensus process of the block 125 in the embodiment corresponding to fig. 4a, which is not described herein again. After the consensus node cluster performs consensus on the transaction execution results of the blocks 125, each consensus node stores the locally generated transaction execution results and the blocks 125 in association with the local ledger, that is, after the consensus node 40 completes the consensus on the transaction execution results of the blocks 125, the locally generated transaction execution results 1254 for the blocks 125 and the blocks 125 in association with the local ledger; after completing the consensus of the transaction execution results for the block 125, the consensus node 30 stores the locally generated transaction execution result 1253 for the block 125 and the block 125 association into the local ledger; after completing the consensus of the transaction execution results for the tile 125, the consensus node 20 stores the locally generated transaction execution result 1252 for the tile 125 and the tile 125 association into the local ledger, as well as other consensus nodes in the consensus node cluster.
It should be noted that, in the embodiment of the present application, the sequence of steps S101 and S102 is not limited, and step S101 may occur first, step S102 may occur first, or step S101 and step S102 may occur simultaneously.
Step S103, determining a target transaction execution result.
Specifically, the first node determines a broadcasted transaction execution result in the local transaction execution results according to the transaction execution results broadcasted by the at least two second nodes; the first node determines the transaction execution result except the broadcasted transaction execution result in the local transaction execution result as a target transaction execution result; the block height of the target block is greater than the block height corresponding to the broadcasted transaction execution result.
Referring to fig. 2 again, as shown in step S102, the local transaction execution result of the first node 10 includes the transaction execution results 1211 and … in the local ledger 12, the transaction execution result 1241, and the transaction execution result 1251 in the cache area 13. Since at least two second nodes have previously broadcast transaction execution results corresponding to block 121, …, and transaction execution results corresponding to block 124, the target transaction execution result may be determined to be transaction execution result 1251 corresponding to block 125.
Step S104, the first block and the target transaction execution result are broadcasted.
Specifically, the first node generates a tacle root certificate according to the local transaction execution result; the first node broadcasts the first block, the target transaction execution result and the Mercker tree root certificate to the at least two second nodes; the Mercker root certificate is used for the at least two second nodes to agree on the transaction execution result of the target block.
As can be seen from the above description, the consensus is divided into two parts, namely a sequencing consensus and a transaction execution result consensus, the sequencing consensus is completed by the sequencing module, and the transaction execution module completes the transaction execution result consensus, because the sequencing module and the transaction execution module are independent of each other, the sequencing consensus and the transaction execution result consensus are completed independently, for the first node 10 (at this time, the first node 10 may be regarded as a block node), the sequencing module may generate the first block 129, and the transaction execution module may generate the transaction execution result 1251. After the first node 10 generates the first block 129, the first block 129 can be broadcast immediately without waiting for the transaction execution result of the first block 129 to be generated, taking the second node 20 of the at least two second nodes as an example, therefore, the second node 20 can directly generate the next block after obtaining the transaction data from the transaction pool on the basis of the first block 129 without concerning the generation progress of the transaction execution result. Further, the first node 10 may send the newly generated first block 129 and the target transaction execution result to at least two second nodes according to the node identifications of other common nodes.
Step S105, performing sequencing consensus on the first block.
Specifically, the at least two second nodes obtain the root of the mercker tree in the first block and the hash value of the transaction data; the at least two second nodes generate a root of the Merck tree to be verified according to the hash value of the transaction data in the first block; when the Merck tree root in the first block is the same as the Merck tree root to be verified, the at least two second nodes verify the validity of the transaction data in the first block; when the transaction data in the first block is legal data, the at least two second nodes broadcast sequencing pass voting results aiming at the first block to at least two consensus nodes; the at least two second nodes acquire the sequencing voting result aiming at the first block and sent by other nodes, determine the sequencing consensus result of the first block according to the acquired sequencing voting result and the locally generated sequencing passing voting result, namely the at least two second nodes count the number of the sequencing passing voting results as the passing vote number, and when the passing vote number is equal to or more than the consensus passing threshold value, the at least two second nodes determine the sequencing consensus result of the first block as the consensus passing result.
Taking the second node 20 of the at least two second nodes as an example, the sequence consensus process of the other consensus nodes for the first block 129 is the same as described below. Please refer to fig. 5, which is a schematic view of a block chain-based data processing scenario according to an embodiment of the present application. As shown in fig. 5, the first node 10 broadcasts the mercker tree root certificate 14, the target transaction execution result (i.e., the transaction execution result 1251), and the first block 129 to the second node 20, and after the second node 20 acquires the first block 129, the second node acquires sequenced transaction data from the block of the first block 129, where the sequenced transaction data includes data corresponding to n transactions, such as transaction data 1, transaction data 2, transaction data 3, …, and transaction data n, and n is a positive integer. According to the generation method of the Mercker tree root, the second node 20 firstly generates Hash 1 according to transaction data 1 and transaction data 2, generates Hash 2 according to transaction data 3 and transaction data 4 until Hash m is generated according to transaction data (n-1) and transaction data n, further generates Hash according to Hash 1 and Hash 2, …, and further generates Hash according to Hash 1 and Hash 2 until only one Hash value is generated, wherein the Hash value is the Mercker tree root to be verified 100b, m is a positive integer, and m is n/2.
Then the second node 20 obtains the mercker tree root 100a from the hash parameters in the block header of the first block 129, detects the consistency 100c between the mercker tree root 100a and the mercker tree root 100b to be verified, and when the mercker tree root 100a in the first block 129 is different from the mercker tree root 100b to be verified, the second node 20 may determine that the first block 129 has illegal parameters; when the mercker tree root 100a in the first block 129 is the same as the mercker tree root 100b to be verified, the second node 20 needs to further verify the validity of the sequenced transaction data in the first block 129, for example, if the content of the transaction data 1 is "100 money in the current XX account and 10 money is paid this time", the transaction data may be determined to be valid data, if the content of the transaction data 2 is "90 money in the current XX account and 100 money is paid this time", the transaction data may be determined to be invalid data, and when the transaction data in the first block 129 are both valid data, the second node 20 recognizes by sequencing for the first block 129.
Step S106, the transaction execution result consensus is performed on the target block.
Specifically, the at least two second nodes obtain the tacher root voucher broadcast by the first node; the Merck root voucher is a voucher generated based on a result of the execution of the transaction generated by the first node; the target transaction execution result is a transaction execution result except a transaction execution result broadcasted in the consensus network, among the transaction execution results generated by the first node; the at least two second nodes acquire locally generated local transaction execution results aiming at the historical blocks; the block height of the first block is larger than that of the historical block; the at least two second nodes generate a root certificate of the Merck tree to be verified according to the local transaction execution result and the target transaction execution result; and the at least two second nodes carry out transaction execution result consensus on the target block according to the Mercker tree root certificate to be verified and the Mercker tree root certificate.
Please refer to fig. 6, which is a schematic view of a block chain-based data processing scenario according to an embodiment of the present application. As shown in fig. 6, the first node 10 broadcasts the merck tree root certificate 14, the target transaction execution result 1251 and the first block 129 to the second node 20, after the second node 20 obtains the target transaction execution result 1251, first obtains the generated local transaction execution result for the history block, where the local transaction execution result includes the transaction execution results 1212 and … in the local ledger 22 and the transaction execution result 1242, and at this time, the cache 23 includes the blocks 125 and … and the previous block 128, but the transaction execution result for the block 125 is not yet generated, and then the second node 20 may generate the merck tree root certificate 24 to be verified according to the transaction execution results 1212 and …, the transaction execution result 1242 and the target transaction execution result 1251. Verifying the consistency 205 of the mercker root certificate 24 to be verified and the mercker root certificate 14, wherein when the mercker root certificate 24 to be verified and the mercker root certificate 14 are not the same, the second node 20 does not agree on the result of the transaction execution for the target block; when the mercker root certificate 24 to be verified and the mercker root certificate 14 are the same, the second node 20 recognizes the result of the transaction execution for the target block.
Through the merkel root certificate 14, the second node 20 can perform the transaction execution result consensus on the block 125 in advance without generating the local transaction execution result of the block 125, so that the transaction execution result consensus speed of the block 125 is increased.
Optionally, in fig. 6, the second node 20 is described as not generating the transaction execution result for the target block (i.e. the block 125), and when the second node generates the transaction execution result for the target block, the to-be-verified mercker tree root credential may be generated according to the locally generated transaction execution results 1212 and …, the transaction execution result 1242, and the local transaction execution result for the block 125, and then the consistency between the to-be-verified mercker tree root credential and the mercker tree root credential 14 is verified, and the subsequent process is consistent with the verification of the consistency 205 between the to-be-verified mercker tree root credential 24 and the mercker tree root credential 14, so details are not repeated again.
It should be noted that, in the embodiment of the present application, the sequence of steps S105 and S106 is not limited, and step S105 may occur first, step S106 may occur first, or step S105 and step S106 may occur simultaneously.
Step S107, broadcasting the sequencing consensus result and the transaction execution consensus result.
Specifically, referring to fig. 5, when the second node 20 completes the sequence consensus on the first block 129, the sequence consensus result is broadcasted to at least two consensus nodes (including the first node 10), specifically: when the mercker tree root 100a in the first block 129 is not the same as the mercker tree root 100b to be verified, or the transaction data in the first block 129 is not all legal, the second node 20 may determine that the first block 129 has illegal parameters, and at this time, the second node 20 broadcasts the unsuccessful-sequencing voting result for the first block 109 to at least two common nodes; when the root 100a of the mercker tree in the first block 129 is the same as the root 100b of the mercker tree to be verified and the transaction data in the first block 129 are both legal transactions, the at least two second nodes broadcast the sequencing-pass voting result for the first block to at least two common nodes.
Meanwhile, the second node 20 obtains the sequencing voting result for the first block 129 sent by the at least two consensus nodes, please refer to fig. 7, which is a schematic view of a scenario of data processing based on a block chain according to an embodiment of the present application. As shown in fig. 7, assuming that the consensus network includes a first node 10, a second node 20, a consensus node 30, a consensus node 40, a consensus node 50 and a consensus node 60, when the first node 10 newly generates the first block 129, the first block 129 is broadcasted to the consensus node 30, the consensus node 40, the consensus node 50, the consensus node 60 and the second node 20 through the node identifier. The consensus node 30, the consensus node 40, the consensus node 50, the consensus node 60, and the second node 20 perform sequencing consensus on the first block 129, and broadcast the corresponding sequencing voting result according to the sequencing consensus result. Taking the second node 20 as an example, the consensus algorithm used is the byzantine 2/3, as shown in fig. 7, the voting result of the consensus node 30, the voting result of the consensus node 40, the voting result of the first node 10, and the voting result of the consensus node 60 acquired by the second node 20 are all pass votes, and the voting result of the second node 20 itself is a pass vote, and 5 pass votes are acquired in total, so that the condition of the byzantine 2/3 is satisfied even when the voting result of the consensus node 50 is a fail vote (that is, the sequencing consensus result of the consensus node 50 for the first block 129 is a sequencing fail voting result), and therefore, the second node 20 can determine that the sequencing consensus result of the first block 129 is a sequencing consensus, and store the block 129 in the cache area 23.
Optionally, when the second node 20 receives the first block 129 broadcast by the first node 10, the transaction data may be obtained from the transaction pool, and then the block 130 may be generated according to the transaction data, or after the second node 20 recognizes the first block 129 by sequencing, the block 130 may be generated, which is not limited herein.
Further, referring to fig. 6, when the second node 20 completes the transaction execution consensus on the block 125, the transaction execution consensus is broadcasted to at least two consensus nodes (including the first node 10), specifically: when the mercker tree root certificate 24 to be verified and the mercker tree root certificate 14 are not the same, the second node 20 broadcasts a failure voting result for the transaction of the target block to at least two consensus nodes; the transaction execution failure voting result indicates that the second node 20 does not agree with the transaction execution result for the target block; when the Merck root certificate 24 to be verified and the Merck root certificate 14 are the same, the second node 20 broadcasts a result of a transaction execution pass vote for the target block to at least two consensus nodes; the transaction execution result indicates that the second node 20 agrees with the transaction execution result for the target block through the voting result.
As well as performing the sequencing consensus on the first block 129, the second node 20 may also obtain the voting result of the transaction execution for the target block sent by other consensus nodes, and the specific process thereof may refer to the embodiment corresponding to fig. 7, which is not described herein again.
Step S108, the target block and the target transaction execution result are stored.
Specifically, the first node obtains the transaction execution voting results respectively sent by the at least two second nodes; the transaction execution voting result is a voting result that the transaction execution results are identified with respect to the target block; the first node counts the number of the transaction execution voting results which belong to the passing of the votes in the transaction execution voting results to be used as the number of the passing votes; when the number of the passing votes is equal to or greater than a consensus pass threshold, the first node determines that a consensus result of the transaction execution results of the target block is a consensus pass result; when the number of pass votes is less than a consensus pass threshold, the first node determines that the consensus result of the transaction execution results of the target block is a consensus failure result; when the result of the transaction execution of the target block is a result of passing the common identification, the first node stores the target block and the result of the transaction execution of the target block in association with each other in the block chain.
The transaction execution voting results respectively sent by the at least two second nodes are counted according to a byzantine 2/3 consensus algorithm, that is, only in the transaction execution voting results respectively sent by the at least two second nodes, if 2/3 of the transaction execution voting results belong to voting passes, the first node determines that the consensus result of the transaction execution results of the target block is a consensus pass result, and if the transaction execution voting results less than 2/3 belong to the voting passes, the first node determines that the consensus result of the transaction execution results of the target block is a consensus fail result, and the first node needs to audit the local account book.
Alternatively, other consensus algorithms may be used to count the voting results of the transactions respectively sent by the at least two second nodes, which is not limited herein.
Step S109, store the target block and the local target transaction execution result.
Specifically, taking the second node of the at least two second nodes as an example for description, referring to fig. 6 again, when the target block (i.e. the block 125) is identified by the transaction execution result and the second node 20 subsequently generates the local transaction execution result 1252 for the block 125, the second node 20 stores the target block and the local transaction execution result 1252 in the local account book 22 in an associated manner.
Optionally, the description still uses one of the at least two second nodes, and the storage processes of other second nodes are the same. If the first node 10 broadcasts the target transaction execution result for the target block, and the second node 20 has locally generated the transaction execution result for the target block, the second node 20 may immediately store the target block and the local target transaction execution result in the local account book 22 when the target blocks are identified by the transaction execution result.
In the embodiment of the present application, after the first block is generated by the first node, the target transaction execution result is determined in the local transaction execution results for the historical blocks, which have been locally generated by the first node, because the first node broadcasts the sequenced first block and also broadcasts the latest transaction execution result, that is, the target transaction execution result, at the same time, at least two second nodes can not only perform sequencing consensus on the first block, but also perform transaction execution result consensus on the target block (that is, the block corresponding to the target transaction execution result). As described above, by asynchronously processing the sequencing consensus and the transaction execution result consensus of the first node, that is, after the first node completes sequencing the first tile, the second node does not need to wait for the first node to output the transaction execution result of the first tile, and can directly generate the next tile on the basis of the first tile, thereby efficiently advancing the generation of the tile. According to the target transaction execution result, the second node can still perform the transaction execution result consensus on the target block under the condition that the second node does not generate the local transaction execution result of the target block, so that the transaction execution result consensus speed of the target block is accelerated, and the consensus speed is further improved.
Further, please refer to fig. 8, which is a flowchart illustrating a data processing method based on a block chain according to an embodiment of the present application. In the embodiment of the present application, a second node device is used as an execution subject for description, and as shown in fig. 8, the data processing process includes the following steps:
step S201, a second node acquires a first block broadcast by a first node and a target transaction execution result; the first block and the target transaction execution result are both generated by the first node.
Specifically, when a first node generates a first block in a common node cluster, the newly generated first block needs to be sequentially identified, and similarly, a newly generated target transaction execution result also needs to be identified, so that the first node broadcasts the first block and the target transaction execution result to other common nodes (including a second node) in the common node cluster where the first node is located.
In step S202, the second node performs sequencing consensus on the first tile.
Specifically, the second node obtains the root of the mercker tree in the first block and the hash value of the transaction data; the second node generates a root of the Merck tree to be verified according to the hash value of the transaction data in the first block; when the Merck tree root in the first block is the same as the Merck tree root to be verified, the second node verifies the validity of the transaction data in the first block; when the transaction data in the first block is legal data, the second node broadcasts sequencing-pass voting results aiming at the first block to at least two consensus nodes; the at least two common nodes include the first node; the second node acquires the sequencing voting result sent by the at least two consensus nodes for the first block, and determines the sequencing consensus result of the first block according to the acquired sequencing voting result and the locally generated sequencing pass voting result.
When the first block is identified through sequencing, the second node acquires transaction data; the second node sequences the transaction data and generates a block hash parameter of a second block according to the first block and the sequenced transaction data; the second node generates the second block according to the block hash parameter of the second block and the sequenced transaction data; the first block is a subsequent block to the second block.
Step S203, the second node performs a transaction execution result consensus on the target block according to the target transaction execution result; the target block is a block corresponding to the target transaction execution result, the block height of the first block is larger than that of the target block, and the target block is a block which is known by sequencing.
Specifically, the second node obtains the tacle root certificate broadcasted by the first node; the Merck root voucher is a voucher generated based on a result of the execution of the transaction generated by the first node; the target transaction execution result is a transaction execution result except a transaction execution result broadcasted in the consensus network, among the transaction execution results generated by the first node; the second node acquires a local transaction execution result which is locally generated and aims at the historical block; the block height of the first block is larger than that of the historical block; the second node acquires the highest block height in the blocks corresponding to the local transaction execution result; if the highest block height is smaller than the block height of the target block, the second node generates the Merck root certificate to be verified according to the local transaction execution result and the target transaction execution result.
When the Merck root certificate to be verified and the Merck root certificate are the same, the second node broadcasts a transaction execution passing voting result aiming at the target block to the at least two consensus nodes; the transaction execution represents that the second node is commonly identified through the transaction execution result aiming at the target block through the voting result; the second node acquires the transaction execution voting result aiming at the target block and sent by the at least two consensus nodes; and the second node determines a transaction execution consensus result of the target block according to the acquired transaction execution voting result and a locally generated transaction execution passing voting result.
Step S204, when the target block is identified by the transaction execution result and the second node has generated the transaction execution result of the target block, the second node stores the target block and the transaction execution result of the target block generated by the second node in a block chain in a related manner.
Specifically, please refer to step S109 in the embodiment corresponding to fig. 3, which is not described herein again.
In the embodiment of the present application, after the first block is generated by the first node, the target transaction execution result is determined in the local transaction execution results for the historical blocks, which have been locally generated by the first node, because the first node broadcasts the sequenced first block and also broadcasts the latest transaction execution result, that is, the target transaction execution result, at the same time, at least two second nodes can not only perform sequencing consensus on the first block, but also perform transaction execution result consensus on the target block (that is, the block corresponding to the target transaction execution result). As described above, by asynchronously processing the sequencing consensus and the transaction execution result consensus of the first node, that is, after the first node completes sequencing the first tile, the second node does not need to wait for the first node to output the transaction execution result of the first tile, and can directly generate the next tile on the basis of the first tile, thereby efficiently advancing the generation of the tile. According to the target transaction execution result, the second node can still perform the transaction execution result consensus on the target block under the condition that the second node does not generate the local transaction execution result of the target block, so that the transaction execution result consensus speed of the target block is accelerated, and the consensus speed is further improved.
Further, please refer to fig. 9, which is a schematic structural diagram of a data processing apparatus based on a block chain according to an embodiment of the present application. The data processing means may be a computer program (including program code) running on a computer device, for example, an application software; the data processing device can be used for executing the corresponding steps in the method provided by the embodiment of the application. As shown in fig. 9, the data processing apparatus 1 may be used in the computer device in the embodiment corresponding to fig. 3 and fig. 8, specifically, the data processing apparatus 1 may include: a block generation module 11, a local result acquisition module 12, a broadcast block result module 13, and a first storage block result module 14.
A block generation module 11, configured to generate a first block;
a local result obtaining module 12, configured to obtain a local transaction execution result for the history block that has been locally generated; the block height of the first block is larger than that of the historical block;
a broadcast block result module 13, configured to determine a target transaction execution result from the local transaction execution results, and broadcast the first block and the target transaction execution result to at least two second nodes, so that the at least two second nodes perform sequencing consensus on the first block and perform transaction execution result consensus on the target block; the target block is a block corresponding to the target transaction execution result, and the target block is a block which passes sequencing consensus;
the first block result storage module 14 is configured to store the target block and the target transaction execution result in a block chain in a related manner when the target block is identified by the transaction execution result.
Specific functional implementation manners of the block generating module 11, the local result obtaining module 12, the broadcast block result module 13, and the first storage block result module 14 may refer to steps S101 to S108 in the corresponding embodiment of fig. 3, which is not described herein again.
Referring back to fig. 9, the block generation module 11 may include: a fetch data unit 111, a sequence data unit 112, and a generate block unit 113.
An acquiring data unit 111, configured to acquire the second block and the transaction data; the second block is generated by a target node of the at least two second nodes;
a sequencing data unit 112, configured to sequence the transaction data, and generate a block hash parameter according to the second block and the sequenced transaction data;
a block generation unit 113 configured to generate the first block according to the block hash parameter and the sequenced transaction data; the second block is a previous block of the first block.
The specific functional implementation manner of the data obtaining unit 111, the sequencing data unit 112, and the block generating unit 113 may refer to step S101 in the embodiment corresponding to fig. 3, and is not described herein again.
Referring to fig. 9 again, the broadcast block result module 13 may include: a determine broadcast results unit 131 and a determine target results unit 132.
A broadcast result determining unit 131, configured to determine a broadcast transaction execution result in the local transaction execution results according to the transaction execution results broadcast by the at least two second nodes;
a target determination result unit 132, configured to determine, as a target transaction execution result, a transaction execution result other than the broadcasted transaction execution result in the local transaction execution result; the block height of the target block is greater than the block height corresponding to the broadcasted transaction execution result.
Specific functional implementation manners of the broadcast result determining unit 131 and the target result determining unit 132 may refer to steps S102 to S103 in the corresponding embodiment of fig. 3, which is not described herein again.
Referring to fig. 9 again, the broadcast block result module 13 may further include: a generation voucher unit 133 and a broadcast result voucher unit 134.
A voucher generating unit 133, configured to generate a tacle root voucher according to the local transaction execution result;
a broadcast result voucher unit 134 for broadcasting the first block, the target transaction execution result and the mercker tree root voucher to the at least two second nodes; the Mercker root certificate is used for the at least two second nodes to agree on the transaction execution result of the target block.
The specific functional implementation manners of the credential generating unit 133 and the credential broadcasting unit 134 may refer to step S104 in the embodiment corresponding to fig. 3, which is not described herein again.
Referring back to fig. 9, the first block result module 14 may include: a vote result unit 141, a consensus determination unit 142, and a block result storage unit 143.
A voting result acquiring unit 141, configured to acquire the voting results of the transactions executed by the at least two second nodes respectively; the transaction execution voting result is a voting result that the transaction execution results are identified with respect to the target block;
a consensus determining unit 142, configured to determine a consensus of the transaction execution results for the target block according to the transaction execution voting result;
a block result storage unit 143, configured to store the target block and the target transaction execution result in the block chain in an associated manner when a result of the consensus of the transaction execution results of the target blocks is a consensus passing result.
The specific functional implementation manners of the vote obtaining result unit 141, the consensus determining result unit 142, and the block storage result unit 143 may refer to step S108 in the corresponding embodiment of fig. 3, which is not described herein again.
Referring back to fig. 9, the unit 142 for determining the consensus result may include: the statistical vote passes through sub-unit 1421 and the determine consensus result sub-unit 1422.
A statistics voting pass sub-unit 1421 for counting the number of the transaction execution voting results belonging to the voting pass among the above transaction execution voting results as the number of pass votes;
a consensus determining result subunit 1422, configured to determine that the consensus result of the transaction execution results of the target block is a consensus passing result when the number of pass votes is equal to or greater than a consensus passing threshold;
the consensus determining result subunit 1422 is further configured to determine that the consensus of the transaction execution results of the target block is a consensus failure result when the number of pass votes is smaller than a consensus pass threshold.
The specific functional implementation manner of the statistical voting pass sub-unit 1421 and the consensus determination result sub-unit 1422 may refer to step S108 in the embodiment corresponding to fig. 3, which is not described herein again.
In the embodiment of the present application, after the first block is generated by the first node, the target transaction execution result is determined in the local transaction execution results for the historical blocks, which have been locally generated by the first node, because the first node broadcasts the sequenced first block and also broadcasts the latest transaction execution result, that is, the target transaction execution result, at the same time, at least two second nodes can not only perform sequencing consensus on the first block, but also perform transaction execution result consensus on the target block (that is, the block corresponding to the target transaction execution result). As described above, by asynchronously processing the sequencing consensus and the transaction execution result consensus of the first node, that is, after the first node completes sequencing the first tile, the second node does not need to wait for the first node to output the transaction execution result of the first tile, and can directly generate the next tile on the basis of the first tile, thereby efficiently advancing the generation of the tile. According to the target transaction execution result, the second node can still perform the transaction execution result consensus on the target block under the condition that the second node does not generate the local transaction execution result of the target block, so that the transaction execution result consensus speed of the target block is accelerated, and the consensus speed is further improved.
Further, please refer to fig. 10, which is a schematic structural diagram of a data processing apparatus based on a block chain according to an embodiment of the present application. The data processing means may be a computer program (including program code) running on a computer device, for example, an application software; the data processing device can be used for executing the corresponding steps in the method provided by the embodiment of the application. As shown in fig. 10, the data processing apparatus 2 may be used in the computer device in the embodiment corresponding to fig. 3 and fig. 8, specifically, the data processing apparatus 2 may include: a block result obtaining module 21, a sequence consensus block module 22, a consensus target result module 23, and a second block result storing module 24.
An obtaining block result module 21, configured to obtain a first block broadcasted by the first node and a target transaction execution result; the first block and the target transaction execution result are both generated by the first node;
a sequencing consensus block module 22, configured to perform sequencing consensus on the first block;
a consensus target result module 23, configured to perform a transaction execution result consensus on the target block according to the target transaction execution result; the target block is a block corresponding to the target transaction execution result, the block height of the first block is larger than that of the target block, and the target block is a block which is known by sequencing;
a second block result storage module 24, configured to store the target block and the transaction execution result of the target block generated by the second node into a block chain in an associated manner when the target block is identified by the transaction execution result and the second node has generated the transaction execution result of the target block.
Specific functional implementation manners of the block obtaining result module 21, the sequencing consensus block module 22, the consensus target result module 23, and the second block storing result module 24 may refer to steps S201 to S204 in the embodiment corresponding to fig. 8, which is not described herein again.
Referring back to fig. 10, the sequencing consensus block module 22 may include: a get chunk hash value unit 221, a generate to-be-verified root unit 222, a verify data legitimacy unit 223, a broadcast sequencing through result unit 224, and a get sequencing vote result unit 225.
A block hash value obtaining unit 221, configured to obtain a hash value of the root of the mercker tree and the transaction data in the first block;
a root to be verified generating unit 222, configured to generate a root of a mercker tree to be verified according to the hash value of the transaction data in the first block;
a verification data validity unit 223, configured to verify validity of the transaction data in the first block when the root of the mercker tree in the first block is the same as the root of the mercker tree to be verified;
a broadcast sequencing-pass result unit 224, configured to broadcast a sequencing-pass voting result for the first block to at least two consensus nodes when the transaction data in the first block is legal; the at least two common nodes include the first node;
a obtaining sequencing voting result unit 225, configured to obtain the sequencing voting result sent by the at least two consensus nodes for the first block, and determine the sequencing consensus result of the first block according to the obtained sequencing voting result and the locally generated sequencing pass voting result.
Specific functional implementation manners of the block hash value obtaining unit 221, the root to be verified generating unit 222, the data verification legal unit 223, the broadcast sequencing result passing unit 224, and the sequencing vote result obtaining unit 225 may refer to step S202 in the embodiment corresponding to fig. 8, and are not described herein again.
Referring back to fig. 10, the sequencing consensus block module 22 may further include: a get transaction data unit 226, a generate chunk hash parameter unit 227, and a generate second chunk unit 228.
A transaction data acquiring unit 226, configured to acquire transaction data when the first block passes the sequencing consensus;
a block hash parameter generation unit 227, configured to sequence the transaction data, and generate a block hash parameter of a second block according to the first block and the sequenced transaction data;
a second block generation unit 228, configured to generate the second block according to the block hash parameter of the second block and the sequenced transaction data; the first block is a subsequent block to the second block.
The specific functional implementation manners of the transaction data obtaining unit 226, the block hash parameter generating unit 227, and the second block generating unit 228 may refer to step S202 in the corresponding embodiment of fig. 8, which is not described herein again.
Referring again to fig. 10, the consensus target result module 23 may include: a broadcast certificate acquiring unit 231, a local transaction result acquiring unit 232, a to-be-verified certificate generating unit 233, and a consensus block transaction result unit 234.
A obtaining broadcast certificate unit 231, configured to obtain a tacle root certificate broadcasted by the first node; the Merck root voucher is a voucher generated based on a result of the execution of the transaction generated by the first node; the target transaction execution result is a transaction execution result except a transaction execution result broadcasted in the consensus network, among the transaction execution results generated by the first node;
a local transaction result obtaining unit 232, configured to obtain a local transaction execution result that is locally generated and is for the history block; the block height of the first block is larger than that of the historical block;
a to-be-verified voucher generating unit 233, configured to generate a to-be-verified tacle root voucher according to the local transaction execution result and the target transaction execution result;
the consensus block transaction result unit 234 is configured to perform a transaction execution result consensus on the target block according to the tacle root certificate to be verified and the tacle root certificate.
The specific functional implementation manners of the broadcast credential obtaining unit 231, the local transaction result obtaining unit 232, the to-be-verified credential generating unit 233, and the consensus block transaction result unit 234 may refer to step S203 in the corresponding embodiment of fig. 8, which is not described herein again.
Referring back to fig. 10, the generating the to-be-verified credential unit 233 may include: a get block height subunit 2331 and a generate to-be-verified voucher subunit 2332.
An acquire block height subunit 2331, configured to acquire a highest block height in the blocks corresponding to the local transaction execution result;
a generate to-be-verified voucher sub-unit 2332, configured to generate the to-be-verified tacle root voucher according to the local transaction execution result and the target transaction execution result if the highest block height is smaller than the block height of the target block.
The specific functional implementation of the block height obtaining subunit 2331 and the to-be-verified credential generating subunit 2332 may refer to step S203 in the corresponding embodiment of fig. 8, which is not described herein again.
Referring to fig. 10 again, the consensus block transaction result unit 234 may include: the broadcast transaction passes through a result subunit 2341, a get transaction vote results subunit 2342, and a determine transaction consensus results subunit 2343.
A broadcast transaction passing result subunit 2341, configured to broadcast a transaction execution passing voting result for the target block to the at least two consensus nodes when the tacl root credential to be verified is the same as the tacl root credential; the transaction execution represents that the second node is commonly identified through the transaction execution result aiming at the target block through the voting result;
a get transaction vote result subunit 2342, configured to get the result of performing vote on the transaction of the target block sent by the at least two consensus nodes;
a determine transaction consensus result subunit 2343, configured to determine a transaction execution consensus result of the target block according to the obtained transaction execution voting result and a locally generated transaction execution passing voting result.
For a specific functional implementation manner of the broadcast transaction passing result subunit 2341, the obtaining transaction voting result subunit 2342, and the determining transaction consensus result subunit 2343, reference may be made to step S203 in the embodiment corresponding to fig. 8, which is not described herein again.
In the embodiment of the present application, after the first block is generated by the first node, the target transaction execution result is determined in the local transaction execution results for the historical blocks, which have been locally generated by the first node, because the first node broadcasts the sequenced first block and also broadcasts the latest transaction execution result, that is, the target transaction execution result, at the same time, at least two second nodes can not only perform sequencing consensus on the first block, but also perform transaction execution result consensus on the target block (that is, the block corresponding to the target transaction execution result). As described above, by asynchronously processing the sequencing consensus and the transaction execution result consensus of the first node, that is, after the first node completes sequencing the first tile, the second node does not need to wait for the first node to output the transaction execution result of the first tile, and can directly generate the next tile on the basis of the first tile, thereby efficiently advancing the generation of the tile. According to the target transaction execution result, the second node can still perform the transaction execution result consensus on the target block under the condition that the second node does not generate the local transaction execution result of the target block, so that the transaction execution result consensus speed of the target block is accelerated, and the consensus speed is further improved.
Further, please refer to fig. 11, which is a schematic structural diagram of a computer device according to an embodiment of the present application. As shown in fig. 11, the computer device 1000 may include: the processor 1001, the network interface 1004, and the memory 1005, and the computer device 1000 may further include: a user interface 1003, and at least one communication bus 1002. Wherein a communication bus 1002 is used to enable connective communication between these components. The user interface 1003 may include a Display screen (Display) and a Keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a standard wireless interface. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). The memory 1005 may be a high-speed RAM memory or a non-volatile memory (e.g., at least one disk memory). The memory 1005 may optionally be at least one memory device located remotely from the processor 1001. As shown in fig. 11, a memory 1005, which is a kind of computer-readable storage medium, may include therein an operating system, a network communication module, a user interface module, and a device control application program.
In the computer device 1000 shown in fig. 11, the network interface 1004 may provide a network communication function; the user interface 1003 is an interface for providing a user with input; and the processor 1001 may be used to invoke a device control application stored in the memory 1005 to implement:
generating a first block;
acquiring a local transaction execution result which is locally generated and aims at the historical block; the block height of the first block is larger than that of the historical block;
determining a target transaction execution result from the local transaction execution results, broadcasting the first block and the target transaction execution result to at least two second nodes, so that the at least two second nodes perform sequencing consensus on the first block and perform transaction execution result consensus on the target block; the target block is a block corresponding to the target transaction execution result, and the target block is a block which passes sequencing consensus;
and when the target blocks are identified by the transaction execution result, the target blocks and the target transaction execution result are stored in a block chain in a related manner.
In one embodiment, the processor 1001 performs the following steps when generating the first block:
acquiring a second block and transaction data; the second block is generated by a target node of the at least two second nodes;
sequencing the transaction data, and generating a block hash parameter according to the second block and the sequenced transaction data;
generating the first block according to the block hash parameter and the sequenced transaction data; the second block is a previous block of the first block.
In one embodiment, when the processor 1001 determines the target transaction execution result from the local transaction execution results, the following steps are specifically performed:
determining the broadcasted transaction execution result in the local transaction execution results according to the transaction execution results broadcasted by the at least two second nodes;
determining transaction execution results except the broadcasted transaction execution result in the local transaction execution result as target transaction execution results; the block height of the target block is greater than the block height corresponding to the broadcasted transaction execution result.
In one embodiment, the processor 1001, when broadcasting the first partition and the target transaction execution result to at least two second nodes, specifically performs the following steps:
generating a Merck tree root certificate according to the local transaction execution result;
broadcasting the first block, the target transaction execution result and the Mercker root certificate to the at least two second nodes; the Mercker root certificate is used for the at least two second nodes to agree on the transaction execution result of the target block.
In one embodiment, when the first node stores the target block and the target transaction execution result in association with each other in a block chain when the target block is identified by the transaction execution result, the processor 1001 specifically performs the following steps:
obtaining the transaction execution voting results respectively sent by the at least two second nodes; the transaction execution voting result is a voting result that the transaction execution results are identified with respect to the target block;
determining a consensus result of the transaction execution results aiming at the target block according to the transaction execution voting result;
and when the consensus result of the transaction execution result of the target block is a consensus passing result, the target block and the target transaction execution result are stored in the block chain in a correlated manner.
In one embodiment, when the processor 1001 determines the consensus result of the transaction execution results for the target block according to the transaction execution voting result, the following steps are specifically performed:
counting the number of the transaction execution voting results belonging to the voting passage in the transaction execution voting results as the number of the passage votes;
when the number of the passing votes is equal to or larger than a consensus passing threshold, determining a consensus result of the transaction execution results of the target blocks as a consensus passing result;
and when the passing vote number is less than the consensus passing threshold value, determining the consensus result of the transaction execution results of the target blocks as a consensus failure result.
In the embodiment of the present application, after the first block is generated by the first node, the target transaction execution result is determined in the local transaction execution results for the historical blocks, which have been locally generated by the first node, because the first node broadcasts the sequenced first block and also broadcasts the latest transaction execution result, that is, the target transaction execution result, at the same time, at least two second nodes can not only perform sequencing consensus on the first block, but also perform transaction execution result consensus on the target block (that is, the block corresponding to the target transaction execution result). As described above, by asynchronously processing the sequencing consensus and the transaction execution result consensus of the first node, that is, after the first node completes sequencing the first tile, the second node does not need to wait for the first node to output the transaction execution result of the first tile, and can directly generate the next tile on the basis of the first tile, thereby efficiently advancing the generation of the tile. According to the target transaction execution result, the second node can still perform the transaction execution result consensus on the target block under the condition that the second node does not generate the local transaction execution result of the target block, so that the transaction execution result consensus speed of the target block is accelerated, and the consensus speed is further improved.
Further, please refer to fig. 12, which is a schematic structural diagram of a computer device according to an embodiment of the present application. As shown in fig. 12, the computer device 2000 may include: processor 2001, network interface 2004, and memory 2005, computer device 2000 may further include: a user interface 2003, and at least one communication bus 2002. The communication bus 2002 is used to implement connection communication between these components. The user interface 2003 may include a Display (Display) and a Keyboard (Keyboard), and the optional user interface 2003 may further include a standard wired interface and a standard wireless interface. The network interface 2004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). The memory 2005 may be a high-speed RAM memory, or may be a non-volatile memory (e.g., at least one disk memory). The memory 2005 may optionally also be at least one memory device located remotely from the aforementioned processor 2001. As shown in fig. 12, the memory 2005, which is a type of computer-readable storage medium, may include therein an operating system, a network communication module, a user interface module, and a device control application program.
In the computer device 2000 shown in fig. 12, the network interface 2004 may provide a network communication function; and the user interface 2003 is primarily used to provide an interface for user input; and processor 2001 may be used to invoke the device control application stored in memory 2005 to implement:
acquiring a first block broadcast by a first node and a target transaction execution result; the first block and the target transaction execution result are both generated by the first node;
sequencing the first block;
performing transaction execution result consensus on the target block according to the target transaction execution result; the target block is a block corresponding to the target transaction execution result, the block height of the first block is larger than that of the target block, and the target block is a block which is known by sequencing;
when the target block is identified by the transaction execution result and the second node has generated the transaction execution result of the target block, the target block and the transaction execution result of the target block generated by the second node are stored in a block chain in a related manner.
In one embodiment, the processor 2001 performs the following steps when performing the sequence consensus on the first block:
acquiring a Merck tree root in the first block and a hash value of transaction data;
generating a root of a Merck tree to be verified according to the hash value of the transaction data in the first block;
verifying the validity of the transaction data in the first block when the Mercker tree root in the first block is the same as the Mercker tree root to be verified;
broadcasting sequencing-pass voting results for the first block to at least two consensus nodes when the transaction data in the first block is legal; the at least two common nodes include the first node;
and obtaining the sequencing voting result of the first block sent by the at least two consensus nodes, and determining the sequencing consensus result of the first block according to the obtained sequencing voting result and the locally generated sequencing passing voting result.
In one embodiment, the processor 2001 further performs the following steps when performing the sequence consensus on the first block:
when the first block is identified through sequencing, acquiring transaction data;
sequencing the transaction data, and generating a block hash parameter of a second block according to the first block and the sequenced transaction data;
generating the second block according to the block hash parameter of the second block and the sequenced transaction data; the first block is a subsequent block to the second block.
In one embodiment, when the processor 2001 performs the transaction execution result consensus on the target block according to the target transaction execution result, the following steps are specifically performed:
acquiring a Merck tree root certificate broadcasted by the first node; the Merck root voucher is a voucher generated based on a result of the execution of the transaction generated by the first node; the target transaction execution result is a transaction execution result except a transaction execution result broadcasted in the consensus network, among the transaction execution results generated by the first node;
acquiring a local transaction execution result which is locally generated and aims at the historical block; the block height of the first block is larger than that of the historical block;
generating a tacher root certificate to be verified according to the local transaction execution result and the target transaction execution result;
and performing transaction execution result consensus on the target block according to the Mercker root certificate to be verified and the Mercker root certificate.
In an embodiment, when the processor 2001 generates the root voucher of the mercker tree to be verified according to the local transaction execution result and the target transaction execution result, the following steps are specifically performed:
acquiring the highest block height in the blocks corresponding to the local transaction execution result;
and if the highest block height is smaller than the block height of the target block, generating the Mercker tree root certificate to be verified according to the local transaction execution result and the target transaction execution result.
In one embodiment, when the processor 2001 performs the consensus of the transaction execution result for the target block according to the tacle root certificate to be verified and the tacle root certificate, the following steps are specifically performed:
when the Merck root certificate to be verified and the Merck root certificate are the same, broadcasting a transaction execution passing voting result aiming at the target block to the at least two consensus nodes; the transaction execution represents that the second node is commonly identified through the transaction execution result aiming at the target block through the voting result;
obtaining the transaction execution voting result aiming at the target block and sent by the at least two consensus nodes;
and determining a transaction execution consensus result of the target block according to the acquired transaction execution voting result and the locally generated transaction execution passing voting result.
In the embodiment of the present application, after the first block is generated by the first node, the target transaction execution result is determined in the local transaction execution results for the historical blocks, which have been locally generated by the first node, because the first node broadcasts the sequenced first block and also broadcasts the latest transaction execution result, that is, the target transaction execution result, at the same time, at least two second nodes can not only perform sequencing consensus on the first block, but also perform transaction execution result consensus on the target block (that is, the block corresponding to the target transaction execution result). As described above, by asynchronously processing the sequencing consensus and the transaction execution result consensus of the first node, that is, after the first node completes sequencing the first tile, the second node does not need to wait for the first node to output the transaction execution result of the first tile, and can directly generate the next tile on the basis of the first tile, thereby efficiently advancing the generation of the tile. According to the target transaction execution result, the second node can still perform the transaction execution result consensus on the target block under the condition that the second node does not generate the local transaction execution result of the target block, so that the transaction execution result consensus speed of the target block is accelerated, and the consensus speed is further improved.
An embodiment of the present application further provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, where the computer program includes program instructions, and when the program instructions are executed by a processor, the method for processing data based on a block chain provided in each step in fig. 3 and 8 is implemented, for specific reference, the implementation manner provided in each step in fig. 3 and 8 may be referred to, and details of the implementation manner are not described herein again.
The computer readable storage medium may be the data processing apparatus provided in any of the foregoing embodiments or an internal storage unit of the computer device, such as a hard disk or a memory of the computer device. The computer readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a Smart Memory Card (SMC), a Secure Digital (SD) card, a flash card (flash card), and the like, provided on the computer device. Further, the computer-readable storage medium may also include both an internal storage unit and an external storage device of the computer device. The computer-readable storage medium is used for storing the computer program and other programs and data required by the computer device. The computer readable storage medium may also be used to temporarily store data that has been output or is to be output.
The terms "first," "second," and the like in the description and in the claims and drawings of the embodiments of the present application are used for distinguishing between different objects and not for describing a particular order. Furthermore, the terms "comprises" and any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, apparatus, product, or apparatus that comprises a list of steps or elements is not limited to the listed steps or modules, but may alternatively include other steps or modules not listed or inherent to such process, method, apparatus, product, or apparatus.
Those of ordinary skill in the art will appreciate that the elements and algorithm steps of the examples described in connection with the embodiments disclosed herein may be embodied in electronic hardware, computer software, or combinations of both, and that the components and steps of the examples have been described in a functional general in the foregoing description for the purpose of illustrating clearly the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The method and the related apparatus provided by the embodiments of the present application are described with reference to the flowchart and/or the structural diagram of the method provided by the embodiments of the present application, and each flow and/or block of the flowchart and/or the structural diagram of the method, and the combination of the flow and/or block in the flowchart and/or the block diagram can be specifically implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block or blocks of the block diagram. These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block or blocks of the block diagram. These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block or blocks.
The above disclosure is only for the purpose of illustrating the preferred embodiments of the present application and is not to be construed as limiting the scope of the present application, so that the present application is not limited thereto, and all equivalent variations and modifications can be made to the present application.

Claims (15)

1. A data processing method based on a block chain is characterized by comprising the following steps:
a first node generates a first block;
the first node acquires a local transaction execution result which is locally generated and aims at the historical block; the block height of the first block is greater than the block height of the historical block;
the first node determines a target transaction execution result from the local transaction execution results, broadcasts the first block and the target transaction execution result to at least two second nodes, so that the at least two second nodes perform sequencing consensus on the first block and perform transaction execution result consensus on the target block; the target block is a block corresponding to the target transaction execution result, and the target block is a block which passes sequencing consensus;
and when the target block is identified by the transaction execution result, the first node stores the target block and the target transaction execution result into a block chain in an associated manner.
2. The method of claim 1, wherein the first node generates a first block comprising:
the first node acquires a second block and transaction data; the second block is generated by a target node of the at least two second nodes;
the first node sequences the transaction data and generates a block hash parameter according to the second block and the sequenced transaction data;
the first node generates the first block according to the block hash parameter and the sequenced transaction data; the second block is a successor block to the first block.
3. The method of claim 1, wherein the first node determining a target trade execution result from the local trade execution results comprises:
the first node determines the broadcasted transaction execution result in the local transaction execution results according to the transaction execution results broadcasted by the at least two second nodes;
the first node determines the transaction execution results except the broadcasted transaction execution result in the local transaction execution results as target transaction execution results; the block height of the target block is larger than the block height corresponding to the broadcasted transaction execution result.
4. The method of claim 1, wherein broadcasting the first block and the target transaction execution result to at least two second nodes comprises:
the first node generates a Merck tree root voucher according to the local transaction execution result;
the first node broadcasts the first block, the target transaction execution result and the Mercker tree root voucher to the at least two second nodes; the merkel root credentials are used for the at least two second nodes to agree on the result of the transaction execution on the target block.
5. The method of claim 1, wherein when the target block is identified by the transaction execution result, the first node stores the target block and the target transaction execution result in a block chain in association with each other, comprising:
the first node acquires the transaction execution voting results respectively sent by the at least two second nodes; the transaction execution voting result is a voting result which is obtained by performing transaction execution result consensus on the target block;
the first node determines a consensus result of the transaction execution results aiming at the target block according to the transaction execution voting result;
and when the consensus result of the transaction execution result of the target block is a consensus passing result, the first node stores the target block and the target transaction execution result into the block chain in an associated manner.
6. The method of claim 5, wherein the first node determining a consensus result of the transaction execution results for the target block based on the transaction execution voting results comprises:
the first node counts the number of the transaction execution voting results belonging to the vote passing in the transaction execution voting results to be used as the number of passing votes;
when the number of pass votes is equal to or greater than a consensus pass threshold, the first node determines a consensus result of the transaction execution results of the target block as a consensus pass result;
when the pass vote number is smaller than a consensus pass threshold, the first node determines that the consensus result of the transaction execution results of the target blocks is a consensus failure result.
7. A data processing method based on a block chain is characterized by comprising the following steps:
the second node acquires a first block broadcasted by the first node and a target transaction execution result; the first block and the target transaction execution result are both generated by the first node;
the second node performs sequencing consensus on the first block;
the second node performs transaction execution result consensus on the target block according to the target transaction execution result; the target block is a block corresponding to the target transaction execution result, the block height of the first block is larger than that of the target block, and the target block is a block which is known by sequencing;
when the target block is identified by the transaction execution result and the second node generates the transaction execution result of the target block, the second node stores the target block and the transaction execution result of the target block generated by the second node into a block chain in an associated manner.
8. The method of claim 7, wherein the second node has a common knowledge of the ordering of the first tile, comprising:
the second node acquires a Merck tree root in the first block and a hash value of transaction data;
the second node generates a root of the Merck tree to be verified according to the hash value of the transaction data in the first block;
when the Merck tree root in the first block is the same as the Merck tree root to be verified, the second node verifies the validity of the transaction data in the first block;
when the transaction data in the first block is legal data, the second node broadcasts sequencing-through voting results for the first block to at least two consensus nodes; the at least two consensus nodes comprise the first node;
and the second node acquires the sequencing voting results sent by the at least two consensus nodes for the first block, and determines the sequencing consensus result of the first block according to the acquired sequencing voting results and the locally generated sequencing passing voting result.
9. The method of claim 8, further comprising:
when the first block is identified through sequencing, the second node acquires transaction data;
the second node sequences the transaction data, and generates a block hash parameter of a second block according to the first block and the sequenced transaction data;
the second node generates the second block according to the block hash parameter of the second block and the sequenced transaction data; the first block is a successor block to the second block.
10. The method of claim 7, wherein the second node performing a transaction execution result consensus on the target block according to the target transaction execution result comprises:
the second node acquires the Mercker tree root certificate broadcasted by the first node; the Merck root credential is a credential generated from a transaction execution result generated by the first node; the target transaction execution result is a transaction execution result except for a transaction execution result broadcasted in the consensus network in the transaction execution results generated by the first node;
the second node acquires a local transaction execution result which is locally generated and aims at the historical block; the block height of the first block is greater than the block height of the historical block;
the second node generates a root certificate of the Merck tree to be verified according to the local transaction execution result and the target transaction execution result;
and the second node performs transaction execution result consensus on the target block according to the Mercker tree root certificate to be verified and the Mercker tree root certificate.
11. The method of claim 10, wherein the second node generating a tacle root credential to be verified based on the local transaction execution result and the target transaction execution result comprises:
the second node acquires the highest block height in the blocks corresponding to the local transaction execution result;
and if the highest block height is smaller than the block height of the target block, the second node generates the root voucher of the Mercker tree to be verified according to the local transaction execution result and the target transaction execution result.
12. The method according to claim 10, wherein the second node performs a consensus of the transaction execution result for the target block according to the tacher root certificate to be verified and the tacher root certificate, comprising:
when the Merck root certificate to be verified and the Merck root certificate are the same, the second node broadcasts a transaction execution passing voting result aiming at the target block to the at least two common recognition nodes; the transaction execution characterizes the second node to agree through the transaction execution result aiming at the target block through a voting result;
the second node acquires the transaction execution voting results sent by the at least two consensus nodes aiming at the target block;
and the second node determines a transaction execution consensus result of the target block according to the acquired transaction execution voting result and a locally generated transaction execution passing voting result.
13. A blockchain-based data processing apparatus, comprising:
a block generation module for generating a first block;
the local result acquisition module is used for acquiring a local transaction execution result which is locally generated and aims at the historical block; the block height of the first block is greater than the block height of the historical block;
a broadcast block result module, configured to determine a target transaction execution result from the local transaction execution results, and broadcast the first block and the target transaction execution result to at least two second nodes, so that the at least two second nodes perform sequencing consensus on the first block and perform transaction execution result consensus on the target block; the target block is a block corresponding to the target transaction execution result, and the target block is a block which passes sequencing consensus;
the first storage block result module is used for storing the target block and the target transaction execution result into a block chain in a related manner when the target block is identified by the transaction execution result.
14. A computer device, comprising: a processor, a memory, and a network interface;
the processor is connected to the memory and the network interface, wherein the network interface is configured to provide data communication functions, the memory is configured to store program code, and the processor is configured to call the program code to perform the steps of the method according to any one of claims 1 to 12.
15. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program comprising program instructions which, when executed by a processor, perform the steps of the method of any one of claims 1 to 12.
CN202010322029.7A 2020-04-22 2020-04-22 Block chain-based data processing method, device, equipment and storage medium Active CN111556115B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010322029.7A CN111556115B (en) 2020-04-22 2020-04-22 Block chain-based data processing method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010322029.7A CN111556115B (en) 2020-04-22 2020-04-22 Block chain-based data processing method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111556115A true CN111556115A (en) 2020-08-18
CN111556115B CN111556115B (en) 2023-04-21

Family

ID=72002464

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010322029.7A Active CN111556115B (en) 2020-04-22 2020-04-22 Block chain-based data processing method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111556115B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112291372A (en) * 2020-12-28 2021-01-29 腾讯科技(深圳)有限公司 Asynchronous posting method, device, medium and electronic equipment for block chain
CN112508573A (en) * 2021-01-29 2021-03-16 腾讯科技(深圳)有限公司 Transaction data processing method and device and computer equipment
CN112988818A (en) * 2021-04-30 2021-06-18 支付宝(杭州)信息技术有限公司 Block chain transaction execution method, block chain node and control device
CN114338673A (en) * 2021-12-30 2022-04-12 马上消费金融股份有限公司 Transaction data processing method, device, equipment, system and storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109377232A (en) * 2018-12-20 2019-02-22 众安信息技术服务有限公司 The transaction method for sequencing and equipment of block chain based on DAG
CN109408551A (en) * 2018-08-06 2019-03-01 杭州复杂美科技有限公司 Data query method and system, common recognition method and system, equipment and storage medium
CN109785170A (en) * 2019-01-21 2019-05-21 中国联合网络通信集团有限公司 Method of insuring based on block chain, the system of insuring based on block chain
CN110011974A (en) * 2019-03-07 2019-07-12 深圳市融汇通金科技有限公司 Bookkeeping methods, device, terminal and the computer readable storage medium of block chain
CN110648136A (en) * 2019-09-10 2020-01-03 杭州秘猿科技有限公司 Consensus and transaction synchronous parallel processing method and device and electronic equipment
CN110659988A (en) * 2019-09-10 2020-01-07 杭州秘猿科技有限公司 Parallel processing method and device for block chain consensus and execution and electronic equipment
CN111046069A (en) * 2019-11-11 2020-04-21 支付宝(杭州)信息技术有限公司 Aggregation calculation method, device and equipment in block chain type account book

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109408551A (en) * 2018-08-06 2019-03-01 杭州复杂美科技有限公司 Data query method and system, common recognition method and system, equipment and storage medium
CN109377232A (en) * 2018-12-20 2019-02-22 众安信息技术服务有限公司 The transaction method for sequencing and equipment of block chain based on DAG
CN109785170A (en) * 2019-01-21 2019-05-21 中国联合网络通信集团有限公司 Method of insuring based on block chain, the system of insuring based on block chain
CN110011974A (en) * 2019-03-07 2019-07-12 深圳市融汇通金科技有限公司 Bookkeeping methods, device, terminal and the computer readable storage medium of block chain
CN110648136A (en) * 2019-09-10 2020-01-03 杭州秘猿科技有限公司 Consensus and transaction synchronous parallel processing method and device and electronic equipment
CN110659988A (en) * 2019-09-10 2020-01-07 杭州秘猿科技有限公司 Parallel processing method and device for block chain consensus and execution and electronic equipment
CN111046069A (en) * 2019-11-11 2020-04-21 支付宝(杭州)信息技术有限公司 Aggregation calculation method, device and equipment in block chain type account book

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112291372A (en) * 2020-12-28 2021-01-29 腾讯科技(深圳)有限公司 Asynchronous posting method, device, medium and electronic equipment for block chain
CN112508573A (en) * 2021-01-29 2021-03-16 腾讯科技(深圳)有限公司 Transaction data processing method and device and computer equipment
CN112988818A (en) * 2021-04-30 2021-06-18 支付宝(杭州)信息技术有限公司 Block chain transaction execution method, block chain node and control device
CN113760999A (en) * 2021-04-30 2021-12-07 支付宝(杭州)信息技术有限公司 Block chain transaction execution method, block chain node and control device
CN114338673A (en) * 2021-12-30 2022-04-12 马上消费金融股份有限公司 Transaction data processing method, device, equipment, system and storage medium

Also Published As

Publication number Publication date
CN111556115B (en) 2023-04-21

Similar Documents

Publication Publication Date Title
US11270307B2 (en) Blockchain-based transaction processing method and apparatus, and electronic device
CN111556115B (en) Block chain-based data processing method, device, equipment and storage medium
CN111600720B (en) Data processing method, device and equipment based on block chain and readable storage medium
CN111382456B (en) Proposal message processing method, device, equipment and storage medium
CN111445333B (en) Block generation method, device, computer equipment and storage medium
CN111444211B (en) Block chain consensus node checking method, device, equipment and storage medium
CN111080295A (en) Block chain-based electronic contract processing method and equipment
CN110570196A (en) Transaction data processing method and device, terminal equipment and storage medium
CN111461885B (en) Consensus network management method, device, computer and readable storage medium
CN111654395B (en) Voting information processing method, device, equipment and storage medium
CN109656778A (en) Data capture method, device, computer equipment and storage medium
JP7325894B2 (en) Data processing method, device, device and computer program based on blockchain
CN113326165B (en) Data processing method and device based on block chain and computer readable storage medium
CN111209339B (en) Block synchronization method, device, computer and storage medium
CN111343212B (en) Message processing method, device, equipment and storage medium
CN108882230B (en) Call record management method, device and system
CN111507840A (en) Block chain consensus method, device, computer and readable storage medium
CN108471422B (en) Method, device, server and medium for judging remote login
CN112417052A (en) Data synchronization method, device, equipment and storage medium in block chain network
CN112650734B (en) Block repairing method and related device
US20240015037A1 (en) Data processing method and apparatus for consensus network, program product, device, and medium
CN117522551A (en) Blockchain transaction management method, device, equipment, storage medium and program product
CN117354255A (en) Transaction processing method, apparatus, product, device and medium of block chain network
CN117453654A (en) Version processing method and device based on block chain and related equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40027388

Country of ref document: HK

SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant