CN108876384B - Transaction data processing method and device - Google Patents

Transaction data processing method and device Download PDF

Info

Publication number
CN108876384B
CN108876384B CN201811094967.5A CN201811094967A CN108876384B CN 108876384 B CN108876384 B CN 108876384B CN 201811094967 A CN201811094967 A CN 201811094967A CN 108876384 B CN108876384 B CN 108876384B
Authority
CN
China
Prior art keywords
node
batch
transaction data
block
transaction
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.)
Active
Application number
CN201811094967.5A
Other languages
Chinese (zh)
Other versions
CN108876384A (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.)
Union Mobile Pay Co Ltd
Original Assignee
Union Mobile Pay 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 Union Mobile Pay Co Ltd filed Critical Union Mobile Pay Co Ltd
Priority to CN201811094967.5A priority Critical patent/CN108876384B/en
Publication of CN108876384A publication Critical patent/CN108876384A/en
Application granted granted Critical
Publication of CN108876384B publication Critical patent/CN108876384B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • 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
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3825Use of electronic signatures

Landscapes

  • Business, Economics & Management (AREA)
  • Engineering & Computer Science (AREA)
  • Accounting & Taxation (AREA)
  • Computer Security & Cryptography (AREA)
  • Finance (AREA)
  • Strategic Management (AREA)
  • Physics & Mathematics (AREA)
  • General Business, Economics & Management (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer And Data Communications (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention relates to the technical field of internet, and discloses a method and a device for processing transaction data, which are used for reducing the pressure on a network and the consumption of resources during the processing of the transaction data in a block chain and improving the processing efficiency of the transaction data in the block chain. The method comprises the following steps: a first node in a blockchain receives transaction data in a network; when the transaction data and unprocessed other transaction data stored in the first node meet a preset condition of being packaged into a batch, packaging the transaction data and the other transaction data into a batch by the first node, wherein the batch comprises the transaction data and the other transaction data; and the first node broadcasts the batch signature to a second node in the block chain, wherein the second node is different from the first node.

Description

Transaction data processing method and device
Technical Field
The invention relates to the technical field of internet, in particular to a method and a device for processing transaction data.
Background
The block chain is a mode of citizen participation accounting and has the characteristics of decentralization and distrust. In the prior art, in the process of processing transaction data by using a blockchain, each node in a blockchain network receives one transaction data submitted by a user, the received transaction data is signed, and each signed transaction data is broadcasted to other nodes in the network.
Disclosure of Invention
The embodiment of the invention provides a transaction data processing method and device, which are used for reducing the pressure on a network and the consumption on resources during transaction data processing in a block chain and improving the transaction data processing efficiency in the block chain.
In a first aspect, an embodiment of the present invention provides a method for processing transaction data, including:
a first node in a blockchain receives transaction data in a network;
when the transaction data and unprocessed other transaction data stored in the first node meet a preset condition of being packaged into a batch, packaging the transaction data and the other transaction data into a batch by the first node, wherein the batch comprises the transaction data and the other transaction data;
and the first node broadcasts the batch signature to a second node in the block chain, wherein the second node is different from the first node.
Optionally, the preset condition includes any one or more of the following:
the sum of the transaction number of the transaction data and the other transaction data is greater than a transaction number threshold, the sum of the data volume of the transaction data and the other transaction data is greater than a data volume threshold, and the first node starts timing when storing the first transaction data in the other transaction data until the timing duration reaches a duration threshold.
Optionally, the batch further includes an identification ID of the batch, and after the first node packages the transaction data and the other transaction data into a batch, the method further includes:
storing the batch in a first raw batch queue of the first node;
the first node processes the batch sending service processing module to obtain a processed first transaction result set;
and storing the first transaction result set and the ID in a first block header corresponding to the first node.
Optionally, after the first node broadcasts the batch to the second node in the area chain, the method further includes:
the second node performs signature verification on the received batch, and stores the batch in a second original batch queue of the second node if the signature verification is successful;
the second node sends the batch to the business processing module for processing to obtain a processed second transaction result set;
and storing the second transaction result set and the ID in a second block header corresponding to a second node.
Optionally, after the first node obtains the first transaction result set and the second node obtains the second transaction result set, the method further includes:
the first node and the second node perform consensus operation on the batch to obtain a consensus result;
if the block successfully identified in the common identification result is the block generated by the second block head and the transaction data in the batch, the second node broadcasts the ID, the second block head and the second transaction result set to the first node, and stores the block in a local account book of the second node;
if the block successfully identified in the common identification result is the block generated by the first block head and the transaction data in the batch, the first node broadcasts the ID, the first block head and the first transaction result set to the second node, and stores the block in a local account book of the first node.
Optionally, if a successfully identified block in the consensus result is a block generated by the second block header and the transaction data in the batch, after the first node receives the ID broadcast by the second node, the second block header, and the second transaction result set, the method further includes:
and the first node acquires the batch from the first original batch queue according to the ID, assembles the transaction data in the batch and the second block head into an original block, stores the original block in a local account book of the first node, and deletes the successfully processed transaction data in the batch stored in the first original batch queue according to the second transaction result.
Optionally, if a successfully identified block in the consensus result is a block generated by the first block header and the transaction data in the batch, after the second node receives the ID broadcast by the first node, the first block header, and the first transaction result set, the method further includes:
and the second node acquires the batch from the second original batch queue according to the ID, assembles the transaction data in the batch and the first block head into an original block, stores the original block in a local account book of the second node, and deletes the successfully processed transaction data in the batch stored in the second original batch queue according to the first transaction result.
Optionally, if a block successfully identified in the identification result is a block generated by the second block header and the transaction data in the batch, and after the second node stores the block in a local account book of the second node, the method further includes:
the second node deletes the batch stored in the second original batch queue;
or
If the block successfully identified in the identification result is the block generated by the first block header and the transaction data in the batch, and after the first node stores the block in a local account book of the first node, the method further includes:
the first node deletes the batch stored in the first raw batch queue.
Optionally, before the transaction data and the unprocessed other transaction data stored in the first node satisfy a preset condition packaged as a batch, the method includes:
storing the transaction data in a latest batch generated in the first node, where the other transaction data is stored in the latest batch, and when the transaction data and the unprocessed other transaction data stored in the first node satisfy a preset condition for being packaged as a batch, the specific steps are as follows:
when the transaction data and the other transaction data meet a preset condition of being packaged into a batch, packaging the latest batch to form the batch;
or
Storing the transaction data in a transaction pool of a first node, where the transaction pool stores the other transaction data, and when the transaction data and the unprocessed other transaction data stored in the first node satisfy a preset condition for packaging as a batch, the method specifically includes: and generating batches according to the transaction data and the other transaction data and packaging the batches when the transaction data and the other transaction data meet the preset condition of packaging the batches.
In a second aspect, an embodiment of the present invention provides a transaction data processing apparatus, including:
the receiving unit is used for receiving transaction data in the network through a first node in the block chain;
the packaging unit is used for packaging the transaction data and other unprocessed transaction data stored in the first node into a batch when the transaction data and the other transaction data meet a preset condition of packaging into the batch, wherein the batch comprises the transaction data and the other transaction data;
and the broadcasting unit is used for broadcasting the batch signature to a second node in the block chain through the first node, wherein the second node is different from the first node.
Optionally, the preset condition includes any one or more of the following:
the sum of the transaction number of the transaction data and the other transaction data is greater than a transaction number threshold, the sum of the data volume of the transaction data and the other transaction data is greater than a data volume threshold, and the first node starts timing when storing the first transaction data in the other transaction data until the timing duration reaches a duration threshold.
Optionally, the batch further includes an identification ID of the batch, and the apparatus further includes a storage unit, where the storage unit includes a first original batch queue of the first node, and is configured to:
storing the batch, and processing the batch sending service processing module through the first node to obtain a processed first transaction result set;
and storing the first transaction result set and the ID in a first block header corresponding to the first node.
Optionally, the storage unit includes a second original batch queue of the second node, and is configured to:
performing signature verification on the batch received by the second node, and storing the batch in the second original batch queue if the signature verification is successful;
sending the batch to the business processing module for processing based on the second node to obtain a processed second transaction result set;
and storing the second transaction result set and the ID in a second block header corresponding to a second node.
Optionally, the apparatus further comprises a consensus unit configured to:
performing consensus operation on the batch through the first node and the second node to obtain a consensus result;
if the block successfully identified in the identification result is the block generated by the second block head and the transaction data in the batch, broadcasting the ID, the second block head and the second transaction result set to the first node based on the second node, and storing the block in a local account book of the second node;
if the block successfully identified in the common identification result is the block generated by the first block head and the transaction data in the batch, broadcasting the ID, the first block head and the first transaction result set to the second node based on the first node, and storing the block in a local account book of the first node.
Optionally, the consensus unit is further configured to:
and acquiring the batch from the first original batch queue based on the first node according to the ID, assembling the transaction data in the batch and the second block head into an original block, storing the original block in a local account book of the first node, and deleting the successfully processed transaction data in the batch stored in the first original batch queue according to the second transaction result.
Optionally, the consensus unit is further configured to:
and the second node acquires the batch from the second original batch queue according to the ID, assembles the transaction data in the batch and the first block head into an original block, stores the original block in a local account book of the second node, and deletes the successfully processed transaction data in the batch stored in the second original batch queue according to the first transaction result.
Optionally, the consensus unit is further configured to:
deleting the batches stored in the second original batch queue based on the second node;
or
The consensus unit is further configured to:
deleting the batch stored in the first raw batch queue based on the first node.
Optionally, the receiving unit is further configured to:
storing the transaction data in a latest batch generated in the first node, wherein the latest batch stores the other transaction data, and when the transaction data and the other transaction data meet a preset condition of being packaged into a batch, packaging the latest batch to form the batch;
or
And storing the transaction data in a transaction pool of a first node, wherein the transaction pool stores the other transaction data, and when the transaction data and the other transaction data meet a preset condition of being packaged into a batch, generating a batch according to the transaction data and the other transaction data, and packaging the batch.
In the embodiment of the present invention, after a first node in a block chain receives transaction data in a network, it is determined whether the transaction data, that is, the transaction data received this time, and unprocessed other transaction data stored in the first node satisfy a preset condition packaged as a batch, where the preset condition may be that a sum of transaction numbers of the transaction data received this time and unprocessed other transaction data received before is greater than a transaction number threshold, or that a sum of data amounts of the transaction data received this time and unprocessed other transaction data received before is greater than a data amount threshold, or that a timing time length starts to reach a time length threshold when the first transaction data in unprocessed other transaction data received before is received, and so on.
When the preset condition of packaging as batch is met, the received transaction data and other unprocessed transaction data stored in the first node are packaged as batch, and the batch is broadcasted after batch signature, so that the problems that in the prior art, when one batch of transaction data is respectively signed and broadcasted, frequent network operation is required to cause larger network pressure and resource consumption are avoided, the effects of reducing the pressure generated on the network and the consumption on resources during the transaction data processing in the block chain are achieved, and meanwhile, a plurality of batches of transaction data can be processed simultaneously in a batch mode, so that the beneficial technical effect of improving the transaction data processing efficiency in the block chain is achieved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention.
FIG. 1 is a flow chart of a transaction data processing method according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of transaction data processing according to an embodiment of the present invention;
FIG. 3 is a flowchart of a first node processing a batch according to an embodiment of the present invention;
FIG. 4 is a diagram illustrating a transaction result set according to an embodiment of the present invention;
FIG. 5 is a flowchart of a second node processing a batch according to an embodiment of the present invention;
FIG. 6 is a schematic diagram of another transaction data processing scheme provided by an embodiment of the present invention;
fig. 7 is a schematic diagram of a transaction data processing apparatus according to an embodiment of the invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the technical solutions of the present invention. All other embodiments obtained by a person skilled in the art without any inventive work based on the embodiments described in the present application are within the scope of the protection of the technical solution of the present invention.
Some concepts related to the embodiments of the present invention are described below.
Block chains: i.e., Blockchain, is a distributed infrastructure and a computing paradigm that verifies and stores data using a block chain data structure, generates and updates data using a distributed node consensus algorithm and maintains its consistency among nodes, guarantees security of data transmission and access using a cryptographic manner, and programs and operates data using an intelligent contract composed of automated script codes, and simply, a block chain is a chain of blocks connected one by one.
Block head: head, is a data structure that identifies block uniqueness and validity.
Zone block body: the set of transactions in a block, which may also be referred to as transaction data, in general.
Block: the block is composed of a block head and a block body.
Batch: batch, which refers to a collection of transactions (transaction data), typically constitutes a block of zones.
Batch number: i.e., Batch ID, identification of the Batch.
Bit sequence: a data structure for recording transaction results in binary digits.
The following describes a method for processing transaction data according to an embodiment of the present invention with reference to the accompanying drawings.
Referring to fig. 1, a method for processing transaction data according to an embodiment of the present invention includes:
step 101: a first node in the blockchain receives transaction data in the network.
In this embodiment of the present invention, the blockchain may include a plurality of nodes, where a first node in step 101 is any node in the blockchain that can receive transaction data in a network, the network in step 101 refers to a blockchain network (hereinafter, referred to as simply a network), and the transaction data in the network may be transaction data submitted to the first node in the network by a terminal device, so that the first node receives the transaction data; the transaction data in the network may also be transaction data submitted to the first node in the network based on the client in the terminal device, or may also be transaction data submitted to the first node in the network in other manners.
In this embodiment of the present invention, after the step 101 is executed and before the step 102 is executed, the first node may further check the received transaction data to verify whether the received transaction data is reliable, and execute the step 102 when the received transaction data is verified to be reliable.
Step 102: when the transaction data and unprocessed other transaction data stored in the first node meet a preset condition of being packaged into a batch, the first node packages the transaction data and the other transaction data into a batch, and the batch comprises the transaction data and the other transaction data.
In the embodiment of the present invention, after the first node receives the transaction data submitted to the network, the first node may determine whether the transaction data and other unprocessed transaction data stored in the first node satisfy the preset condition for being packaged as a batch.
The preset condition may be that the sum of the transaction number of the data transaction received in step 101 and the unprocessed other transaction data stored in the first node is greater than a transaction number threshold, where the transaction number threshold may be set according to actual needs, such as 100, 1000, or the like.
The preset condition may also be that the sum of the data traffic received in step 101 and the data volume of the unprocessed other transaction data stored in the first node is greater than a data volume threshold, where the data volume threshold may be set according to actual needs, such as set to 1M (mega), or set to 2M, and so on.
The preset condition may also be that the first node starts timing when receiving the first transaction data in the other transaction data mentioned above until the timing duration reaches the duration threshold, where the first transaction data in the other transaction data refers to: in the other transaction data, the first node receives a transaction data first. The duration threshold may be set according to actual needs, such as set to 3s (seconds), or set to 5s, and so on. Of course, in practical applications, the preset condition may be any combination of the above listed conditions, or may be other conditions that are not listed and can reduce the number of signatures.
When the data transaction received in step 102 and the unprocessed other transaction data (hereinafter, referred to as other transaction data) stored in the first node satisfy the preset condition of being packaged as a batch, a batch may be packaged as shown in fig. 2, assuming that the transaction data received in step 101 is txidn and the unprocessed other transaction data stored in the first node is txid1 to txidn-1, then txid1 to txidn are packaged as a batch Batchn when txid1 to txidn satisfy the preset condition of being packaged as a batch, then the transaction data txid1 to txidn are included in the batch Batchn, and in practical applications, an identification ID may be set for the packaged batch, the identification ID of the batch may also be referred to as a batch number, and then the transaction data txid1 to txidn and the batch ID of the batch may be included in the batch Batchn.
Step 103: the first node broadcasts the batch signature to a second node in the blockchain, the second node being different from the first node.
Continuing with the example that the encapsulated batch shown in fig. 2 is Batchn, in the embodiment of the present invention, a signature verification may be performed on the encapsulated batch, that is, Batchn, and then the signature verified Batchn is broadcast to a second node in the blockchain, where the second node refers to any node participating in accounting in the blockchain, for example, when only one node 2 participating in accounting in the blockchain is provided, the first node in step 103 may send the batch, that is, the signature verification of the batch, to the node 2, and when the nodes participating in accounting in the blockchain include the node 2, the node 3, and the node 4, the first node in step 103 may send the batch, that is, the signature verification of the Batchn, to the node 2, the node 3, and the node 4, respectively.
Therefore, by the above method, after the first node in the blockchain receives transaction data in the network, it is determined whether the transaction data, that is, the transaction data received this time, and the unprocessed other transaction data stored in the first node satisfy the preset condition of being packaged as a batch, where the preset condition may be that the sum of the number of transactions of the transaction data received this time and the unprocessed other transaction data received before is greater than the threshold of the number of transactions, or that the sum of the data amount of the transaction data received this time and the unprocessed other transaction data received before is greater than the threshold of the data amount, or that the timing duration reaches the duration threshold when the first transaction data in the unprocessed other transaction data received before is started to be timed, and so on.
When the preset condition of packaging as batch is met, the received transaction data and other unprocessed transaction data stored in the first node are packaged as batch, and the batch is broadcasted after batch signature, so that the problems that in the prior art, when one batch of transaction data is respectively signed and broadcasted, frequent network operation is required to cause larger network pressure and resource consumption are avoided, the effects of reducing the pressure generated on the network and the consumption on resources during the transaction data processing in the block chain are achieved, and meanwhile, a plurality of batches of transaction data can be processed simultaneously in a batch mode, so that the beneficial technical effect of improving the transaction data processing efficiency in the block chain is achieved.
Alternatively, in this embodiment of the present invention, the first node may generate an empty batch first, where the empty batch refers to a batch in which no transaction data is stored, and then, after the first node receives the transaction data, the transaction data may be stored in the empty batch until the transaction data stored in the empty batch meets a preset condition for batch packaging of the empty batch (the preset condition is specifically described in step 102 above), the empty batch in which the transaction data is stored is batch packaged to form a batch, and then the formed batch is processed as described above. And then the first node generates a new empty batch again for storing the received transaction data, and packages the new empty batch to form a batch when the transaction data stored in the new empty batch meets the preset condition for packaging the new empty batch, wherein the process is not repeated here.
Alternatively, in this embodiment of the present invention, the first node may also directly store the received transaction data in a transaction pool of the first node, where the transaction pool is a storage unit in the first node for storing unprocessed transaction data, then determine whether the unprocessed transaction data stored in the transaction pool satisfies a preset condition for packaging into a batch, and if not, when the first node receives the transaction data next time, store the received transaction data in the transaction pool until the unprocessed transaction data stored in the transaction pool satisfies the preset condition for packaging into a batch, package the unprocessed transaction data stored in the transaction pool into a batch, and then process the formed batch as described above.
Alternatively, in this embodiment of the present invention, the batch packaged in step 102 may further include an identification ID of the batch, so that after step 102 is executed, the flow shown in fig. 3 may also be executed.
The process shown in fig. 3 includes:
step 301: storing the batch in a first raw batch queue of the first node;
step 302: the first node processes the batch sending service processing module to obtain a processed first transaction result set;
step 303: and storing the first transaction result set and the ID in a first block header corresponding to the first node.
With continuing reference to fig. 2 and fig. 3, in the embodiment of the present invention, an original batch queue for storing encapsulated batches may be set in each node, i.e., the first node and the second node, in the blockchain, and for convenience of description, the original batch queue for storing encapsulated batches set in the first node is referred to as a first original batch queue, i.e., orgBatch in fig. 2, and the original batch queue for storing encapsulated batches set in the second node is referred to as a second original batch queue, so that after the first node encapsulates the received transaction data and the unprocessed other transaction data stored in the first node into batches according to the received transaction data this time, the batches may be stored in the first original batch queue, and then the first node may further send the batches to the transaction processing module so as to process all transaction data included in the batches to obtain a transaction result set, for convenience of description, this set of transaction results is referred to as a first set of transaction results.
In the embodiment of the present invention, a transaction result set may be recorded in a manner of a bit sequence, and assuming that a packaged batch is taken as Batchn as an example, after the first node sends Batchn to the service processing module for service processing, an obtained first transaction result set is as shown in fig. 4, each binary bit represents one transaction result, in the embodiment of the present invention, 0 represents a transaction failure, and 1 represents a transaction success. The first node may then store the obtained first transaction result set and the batch number, i.e., ID, of Batchn in the first block header corresponding to the first node.
Similarly, after the second node in the block chain receives the batch broadcast by the first node, the process shown in fig. 5 may be further performed, including:
step 501: the second node performs signature verification on the received batch, and stores the batch in a second original batch queue of the second node if the signature verification is successful;
step 502: the second node sends the batch to the business processing module for processing to obtain a processed second transaction result set;
step 503: and storing the second transaction result set and the batch ID in a second block header corresponding to a second node.
That is, after the second node receives the batch broadcast by the first node, the second node may perform signature check on the batch first to verify the reliability of the batch, as shown in fig. 6, in the embodiment of the present invention, the second node may also perform other checks on the batch, for example, verify whether the batch is repeated, verify whether the batch is old, verify whether some parameters of the batch are legal, and the like, which are not listed here. If the second node fails to verify the signature or otherwise verify the batch, the transaction data that failed to verify in the batch may be deleted directly, but the position of the transaction data in the batch is maintained (the positions of the transactions in different nodes and the same batch are kept consistent). Assuming the signature verification of the batch is successful, the batch may be stored to a second original batch queue in the second node.
In the embodiment of the present invention, the second node may further send the verified batch to the service processing module for processing, to obtain a processed second transaction result set, where the second transaction result set may also be identified by using a bit sequence, that is, each binary bit in the bit sequence represents a transaction result, and 0 represents a transaction failure, and 1 represents a transaction success. The second node may then store the obtained second transaction result set and the received batch number, i.e., ID, in a second block header corresponding to the second node.
It should be noted that, when the second node participating in accounting in the blockchain includes a plurality of nodes, for example, node 2, node 3, and node 4, each of the node 2, node 3, and node 4 may execute the process shown in fig. 5, and correspondingly, the node 2 may store the batch successfully verified in the original batch queue corresponding to the node 2, and the node 2 may further process the batch sent by the service processing module to obtain a processed transaction result set, and the node 3 and the node 4 are similar, and thus the description is not repeated here.
In an optional manner, in this embodiment of the present invention, after the first node obtains the first transaction result set and the second node obtains the second transaction result set, the first node and the second node may further perform a consensus operation on the batch to obtain a consensus result, where in this embodiment of the present invention, the obtained consensus result includes at least two cases:
in the first case:
if the block successfully identified in the common identification result of the first node and the second node for the common identification operation of the batch is the block generated by the second block head and the transaction data in the batch, the second node broadcasts the ID of the batch, the second block head and the second transaction result set to the first node, and stores the block in a local account book of the second node.
That is, in the first case, the successfully identified region in the consensus result is the second chunk header and the chunk generated from the transaction data in the batch, and at this time, the second node may broadcast the batch ID, the second chunk header, and the second set of transaction results to the first node in the network. Continuing with the batch as described above as the batch, when only one node 2 participating in accounting is involved in the blockchain, the second node refers to node 2, and then the successful region is the block generated by the node 2 block header and the transaction data in the batch, then the node 2 may send the block header 2 corresponding to node 2, the ID of batch, and the transaction result set 2 corresponding to node 2 to the first node. Meanwhile, the node 2 can also directly delete batch Batchn stored in the original queue in the node 2, namely the batch deletion can be carried out in batch, the deletion of one transaction in the prior art is avoided, and therefore the overall performance of the block chain is further improved under the condition that the transaction number in the block is more.
Then, after the first node receives the above information sent by the node 2, the first node acquires a batch corresponding to the ID of the batch from the batches stored in the first original batch queue, that is, the batch of the batch, according to the ID of the batch, assembles the transaction data in the batch and the block header 2 into an original block, and then stores the original block in the local account book of the first node, and then the first node may also delete the transaction data successfully processed in the batch of the batch stored in the first original batch queue according to the transaction result set 2 corresponding to the node 2. Since in the embodiment of the present invention, a bit sequence is used to represent the transaction result set, where 0 represents transaction failure and 1 represents transaction success, the first section deletes the transaction data successfully processed in the batch Batchn stored in the first raw batch queue according to the transaction result set 2, that is, the first section deletes the transaction data with bit sequence 1 in the batch Batchn stored in the first raw batch queue corresponding to the transaction result set 2.
When the nodes participating in accounting in the blockchain include the node 2, the node 3, and the node 4, if the successfully identified area is the block generated by the block header of the node 4 and the transaction data in the batch, then the second node refers to the node 4, and the node 4 sends the block header 4 corresponding to the node 4, the ID of the batch n, and the transaction result set 4 corresponding to the node 4 to the first node, the node 2, and the node 3, respectively, and meanwhile, the node 4 may also directly delete the batch stored in the original queue in the node 4.
Then, after the first node, the node 2, and the node 3 receive the information sent by the node 4, each of the first node, the node 2, and the node 3 will obtain a batch corresponding to the ID of the batch from the batches stored in the corresponding original batch queue, that is, the batch of the batch, according to the ID of the batch, assemble the transaction data in the batch and the corresponding block header into an original block, and then store the original block in the local account book, and may delete the transaction data successfully processed in the batch of the batch stored in the corresponding original batch queue according to the transaction result set 4 corresponding to the node 4. And will not be repeated here.
In the second case:
if the block successfully identified in the common identification result of the first node and the second node in the batch common identification operation is the block generated by the first block head and the transaction data in the batch, the first node broadcasts the ID, the first block head and the first transaction result set to the second node, and stores the block in a local account book of the first node.
In the second case, the area in the consensus result where the consensus is successful is the first block header and the block generated by the transaction data in the batch, at this time, the first node may broadcast the batch ID, the first block header, and the first transaction result set to the second node in the network, and at the same time, the first node may directly delete the batch Batchn stored in the first original queue.
Continuing with batch as described above as an example, when only one node 2 participating in accounting is in the blockchain, the first node may broadcast the ID of the batch, the first chunk header, and the first transaction result set to the node 2 in the network, and after receiving the information, the node 2 acquires the batch corresponding to the ID of batch, that is, the batch Batchn, from the batch stored in the original batch queue corresponding to the node 2 according to the ID of batch, assembles the transaction data in batch and the chunk header 2 (the chunk header corresponding to the node 2) into an original chunk, stores the original chunk in the local account book of the node 2, and then deletes the transaction data successfully processed in the batch Batchn stored in the original batch queue corresponding to the node 2 according to the first transaction result set. When nodes participating in accounting in the blockchain include the node 2, the node 3, and the node 4, the first node may broadcast the batch ID, the first blockhead, and the first transaction result set to the node 2, the node 3, and the node 4 in the network, each of the nodes 2, the node 3, and the node 4 may obtain a batch corresponding to the batch ID of Batchn from batches stored in a corresponding original batch queue according to the ID of Batchn, that is, the batch Batchn, assemble transaction data in the Batchn and the corresponding blockhead into an original block, and then store the original block in a corresponding local account book.
Therefore, according to the method, in the embodiment of the present invention, after the node in the block chain performs the batch consensus operation, the block is broadcasted without using the broadcast block, and only the block header, the batch number, and the transaction result set need to be broadcasted to other nodes, so that the network bandwidth is reduced, the overhead of network resources is further saved, and when the transaction is recovered, the whole batch is deleted, and the overall performance of the block chain is further improved under the condition that the number of transactions in the block is increased.
Based on the same inventive concept, an embodiment of the present invention provides a transaction data processing apparatus, and for specific implementation of a transaction data processing method of the apparatus, reference may be made to the description of the above method embodiment, and repeated details are not repeated, as shown in fig. 7, the apparatus includes:
a receiving unit 70, configured to receive transaction data in a network through a first node in a blockchain;
an encapsulating unit 71, configured to encapsulate the transaction data and the other transaction data stored in the first node as a batch when the transaction data and the other unprocessed transaction data satisfy a preset condition for encapsulating into a batch, where the batch includes the transaction data and the other transaction data;
a broadcasting unit 72, configured to broadcast, by the first node, the batch signature to a second node in the block chain, where the second node is different from the first node.
Optionally, the preset condition includes any one or more of the following:
the sum of the transaction number of the transaction data and the other transaction data is greater than a transaction number threshold, the sum of the data volume of the transaction data and the other transaction data is greater than a data volume threshold, and the first node starts timing when storing the first transaction data in the other transaction data until the timing duration reaches a duration threshold.
Optionally, the batch further includes an identification ID of the batch, and the apparatus further includes a storage unit 73, where the storage unit includes a first original batch queue of the first node, and is configured to:
storing the batch, and processing the batch sending service processing module through the first node to obtain a processed first transaction result set;
and storing the first transaction result set and the ID in a first block header corresponding to the first node.
Optionally, the storage unit includes a second original batch queue of the second node, and is configured to:
performing signature verification on the batch received by the second node, and storing the batch in the second original batch queue if the signature verification is successful;
sending the batch to the business processing module for processing based on the second node to obtain a processed second transaction result set;
and storing the second transaction result set and the ID in a second block header corresponding to a second node.
Optionally, the apparatus further comprises a consensus unit 74 for:
performing consensus operation on the batch through the first node and the second node to obtain a consensus result;
if the block successfully identified in the identification result is the block generated by the second block head and the transaction data in the batch, broadcasting the ID, the second block head and the second transaction result set to the first node based on the second node, and storing the block in a local account book of the second node;
if the block successfully identified in the common identification result is the block generated by the first block head and the transaction data in the batch, broadcasting the ID, the first block head and the first transaction result set to the second node based on the first node, and storing the block in a local account book of the first node.
Optionally, the consensus unit is further configured to:
and acquiring the batch from the first original batch queue based on the first node according to the ID, assembling the transaction data in the batch and the second block head into an original block, storing the original block in a local account book of the first node, and deleting the successfully processed transaction data in the batch stored in the first original batch queue according to the second transaction result.
Optionally, the consensus unit is further configured to:
and the second node acquires the batch from the second original batch queue according to the ID, assembles the transaction data in the batch and the first block head into an original block, stores the original block in a local account book of the second node, and deletes the successfully processed transaction data in the batch stored in the second original batch queue according to the first transaction result.
Optionally, the consensus unit is further configured to:
deleting the batches stored in the second original batch queue based on the second node;
or
The consensus unit is further configured to:
deleting the batch stored in the first raw batch queue based on the first node.
Optionally, the receiving unit is further configured to:
storing the transaction data in a latest batch generated in the first node, wherein the latest batch stores the other transaction data, and when the transaction data and the other transaction data meet a preset condition of being packaged into a batch, packaging the latest batch to form the batch;
or
And storing the transaction data in a transaction pool of a first node, wherein the transaction pool stores the other transaction data, and when the transaction data and the other transaction data meet a preset condition of being packaged into a batch, generating a batch according to the transaction data and the other transaction data, and packaging the batch.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be 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 diagram block or blocks.
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 diagram block or blocks.
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 diagram block or blocks.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.

Claims (14)

1. A method of processing transaction data, comprising:
a first node in a blockchain receives transaction data in a network;
when the transaction data and unprocessed other transaction data stored in the first node meet a preset condition of being packaged into a batch, packaging the transaction data and the other transaction data into a batch by the first node, wherein the batch comprises the transaction data and the other transaction data;
the first node broadcasts the batch signature to a second node in the block chain, wherein the second node is different from the first node;
the second node performs signature verification on the received batch, and stores the batch in a second original batch queue of the second node if the signature verification is successful;
the second node sends the batch to the business processing module for processing to obtain a processed second transaction result set;
and the first node and the second node perform consensus operation on the batch to obtain a consensus result, wherein the consensus result is used for indicating a block with successful consensus.
2. The method of claim 1, wherein the preset conditions include any one or more of:
the sum of the transaction number of the transaction data and the other transaction data is greater than a transaction number threshold, the sum of the data volume of the transaction data and the other transaction data is greater than a data volume threshold, and the first node starts timing when storing the first transaction data in the other transaction data until the timing duration reaches a duration threshold.
3. The method of claim 2, wherein the batch further includes an identification, ID, of the batch, and wherein after the first node packages the transaction data with the other transaction data into a batch, the method further comprises:
storing the batch in a first raw batch queue of the first node;
the first node processes the batch sending service processing module to obtain a processed first transaction result set;
and storing the first transaction result set and the ID in a first block header corresponding to the first node.
4. The method of claim 3, wherein the second node sends the batch to the business process module for processing, and after obtaining a second set of processed transaction results, the method further comprises:
storing the second transaction result set and the ID in a second block header corresponding to a second node.
5. The method of claim 4, wherein the first node and the second node perform a consensus operation on the batch, and after obtaining a consensus result, the method further comprises:
if the block successfully identified in the common identification result is the block generated by the second block head and the transaction data in the batch, the second node broadcasts the ID, the second block head and the second transaction result set to the first node, and stores the block in a local account book of the second node;
if the block successfully identified in the common identification result is the block generated by the first block head and the transaction data in the batch, the first node broadcasts the ID, the first block head and the first transaction result set to the second node, and stores the block in a local account book of the first node.
6. The method of claim 5, wherein if the successfully identified block in the consensus result is the second block header and the block generated by the transaction data in the batch, the first node receives the ID broadcast by the second node, the second block header, and the second set of transaction results, the method further comprising:
and the first node acquires the batch from the first original batch queue according to the ID, assembles the transaction data in the batch and the second block head into an original block, stores the original block in a local account book of the first node, and deletes the successfully processed transaction data in the batch stored in the first original batch queue according to the second transaction result set.
7. The method of claim 5, wherein if the block successfully identified in the consensus result is the first block header and the block generated by the transaction data in the batch, the second node receives the ID broadcast by the first node, the first block header, and the first set of transaction results, the method further comprising:
and the second node acquires the batch from the second original batch queue according to the ID, assembles the transaction data in the batch and the first block head into an original block, stores the original block in a local account book of the second node, and deletes the successfully processed transaction data in the batch stored in the second original batch queue according to the first transaction result.
8. The method of any one of claims 5-7, wherein if a block successfully identified in the consensus result is a block generated by the second block header and the transaction data in the batch, the second node stores the block in a local ledger of the second node, the method further comprising:
the second node deletes the batch stored in the second original batch queue;
or
If the block successfully identified in the identification result is the block generated by the first block header and the transaction data in the batch, and after the first node stores the block in a local account book of the first node, the method further includes:
the first node deletes the batch stored in the first raw batch queue.
9. The method of claim 1, wherein before the transaction data and the unprocessed other transaction data stored in the first node satisfy a predetermined condition for packaging as a batch, the method comprises:
storing the transaction data in a latest batch generated in the first node, where the other transaction data is stored in the latest batch, and when the transaction data and the unprocessed other transaction data stored in the first node satisfy a preset condition for being packaged as a batch, the specific steps are as follows:
when the transaction data and the other transaction data meet a preset condition of being packaged into a batch, packaging the latest batch to form the batch;
or
Storing the transaction data in a transaction pool of a first node, where the transaction pool stores the other transaction data, and when the transaction data and the unprocessed other transaction data stored in the first node satisfy a preset condition for packaging as a batch, the method specifically includes: and generating batches according to the transaction data and the other transaction data and packaging the batches when the transaction data and the other transaction data meet the preset condition of packaging the batches.
10. An apparatus for processing transaction data, comprising:
the receiving unit is used for receiving transaction data in the network through a first node in the block chain;
the packaging unit is used for packaging the transaction data and other unprocessed transaction data stored in the first node into a batch when the transaction data and the other transaction data meet a preset condition of packaging into the batch, wherein the batch comprises the transaction data and the other transaction data;
a broadcasting unit, configured to broadcast, by the first node, the batch signature to a second node in the block chain, where the second node is different from the first node;
the storage unit comprises a second original batch queue of the second node and is used for performing signature verification on the batch received by the second node, if the signature verification is successful, the batch is stored in the second original batch queue, and the batch is sent to the service processing module for processing based on the second node to obtain a processed second transaction result set;
and the consensus unit is used for performing consensus operation on the batch through the first node and the second node to obtain a consensus result.
11. The apparatus of claim 10, wherein the preset conditions include any one or more of:
the sum of the transaction number of the transaction data and the other transaction data is greater than a transaction number threshold, the sum of the data volume of the transaction data and the other transaction data is greater than a data volume threshold, and the first node starts timing when storing the first transaction data in the other transaction data until the timing duration reaches a duration threshold.
12. The apparatus as recited in claim 11, wherein said batch further includes an identification ID of said batch, said storage unit further including a first original batch queue of said first node for:
storing the batch, and processing the batch sending service processing module through the first node to obtain a processed first transaction result set;
and storing the first transaction result set and the ID in a first block header corresponding to the first node.
13. The apparatus of claim 12, wherein the storage unit is further to:
storing the second transaction result set and the ID in a second block header corresponding to a second node.
14. The apparatus of claim 13, wherein the consensus unit is further configured to:
if the block successfully identified in the identification result is the block generated by the second block head and the transaction data in the batch, broadcasting the ID, the second block head and the second transaction result set to the first node based on the second node, and storing the block in a local account book of the second node;
if the block successfully identified in the common identification result is the block generated by the first block head and the transaction data in the batch, broadcasting the ID, the first block head and the first transaction result set to the second node based on the first node, and storing the block in a local account book of the first node.
CN201811094967.5A 2018-09-19 2018-09-19 Transaction data processing method and device Active CN108876384B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811094967.5A CN108876384B (en) 2018-09-19 2018-09-19 Transaction data processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811094967.5A CN108876384B (en) 2018-09-19 2018-09-19 Transaction data processing method and device

Publications (2)

Publication Number Publication Date
CN108876384A CN108876384A (en) 2018-11-23
CN108876384B true CN108876384B (en) 2021-11-05

Family

ID=64324492

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811094967.5A Active CN108876384B (en) 2018-09-19 2018-09-19 Transaction data processing method and device

Country Status (1)

Country Link
CN (1) CN108876384B (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109660601A (en) * 2018-11-26 2019-04-19 北京瑞卓喜投科技发展有限公司 A kind of block chain common recognition method and block chain are known together device
US20200302433A1 (en) * 2018-11-27 2020-09-24 Its, Inc. Distributed ledger settlement transactions
US20200167769A1 (en) * 2018-11-27 2020-05-28 Its, Inc. Distributed ledger settlement transactions
CN110009316A (en) * 2018-12-14 2019-07-12 阿里巴巴集团控股有限公司 Event-handling method and device, electronic equipment based on block chain
CN112966311A (en) * 2019-03-15 2021-06-15 创新先进技术有限公司 Intelligent contract checking method and device and electronic equipment
CN110648137B (en) * 2019-04-26 2021-08-20 腾讯科技(深圳)有限公司 Block processing method, node and system
CN110544096B (en) * 2019-09-05 2023-12-12 腾讯科技(深圳)有限公司 Block chain-based data acquisition method, device, equipment and storage medium
CN112988414A (en) * 2021-02-07 2021-06-18 杭州复杂美科技有限公司 Block chain transaction batch broadcasting method, computer equipment and storage medium
CN112769583A (en) * 2021-02-07 2021-05-07 杭州复杂美科技有限公司 Block chain broadcasting method, computer device and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106453636A (en) * 2016-11-22 2017-02-22 深圳银链科技有限公司 Credible block generation method and system
CN106656974A (en) * 2016-10-17 2017-05-10 江苏通付盾科技有限公司 Block chain grouping consensus method and system
CN107807951A (en) * 2017-09-18 2018-03-16 联动优势科技有限公司 A kind of block chain generation method, data verification method, node and system
CN108182635A (en) * 2017-12-18 2018-06-19 深圳前海微众银行股份有限公司 Block chain common recognition method, system and computer readable storage medium
CN108241968A (en) * 2017-03-26 2018-07-03 杭州复杂美科技有限公司 The method that front end processor participates in block chain common recognition

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170236120A1 (en) * 2016-02-11 2017-08-17 Oracle International Corporation Accountability and Trust in Distributed Ledger Systems
US10417217B2 (en) * 2016-08-05 2019-09-17 Chicago Mercantile Exchange Inc. Systems and methods for blockchain rule synchronization

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106656974A (en) * 2016-10-17 2017-05-10 江苏通付盾科技有限公司 Block chain grouping consensus method and system
CN106453636A (en) * 2016-11-22 2017-02-22 深圳银链科技有限公司 Credible block generation method and system
CN108241968A (en) * 2017-03-26 2018-07-03 杭州复杂美科技有限公司 The method that front end processor participates in block chain common recognition
CN107807951A (en) * 2017-09-18 2018-03-16 联动优势科技有限公司 A kind of block chain generation method, data verification method, node and system
CN108182635A (en) * 2017-12-18 2018-06-19 深圳前海微众银行股份有限公司 Block chain common recognition method, system and computer readable storage medium

Also Published As

Publication number Publication date
CN108876384A (en) 2018-11-23

Similar Documents

Publication Publication Date Title
CN108876384B (en) Transaction data processing method and device
CN106372868B (en) Verification method and device for transaction data written into block chain
CN109345388B (en) Block chain intelligent contract verification method and device and storage medium
CN108053211B (en) Transaction processing method and device based on block chain
US20180240114A1 (en) Transaction verification in a consensus network
CN110060161B (en) Client service implementation method and service assembly for block chain transaction repetition prevention
CN111614761B (en) Block chain message transmission method, device, computer and readable storage medium
CN110784521B (en) Block chain consensus method, electronic device and storage medium
CN106357694B (en) Access request processing method and device
TW202101350A (en) Method and device for cross-chain transmission of authenticable message based on processing module
CN112837163A (en) Block chain based batch transaction uplink method and system
CN111294390A (en) Block data rapid synchronization method, device, equipment and storage medium
CN110659905B (en) Transaction verification method, device, terminal equipment and storage medium
CN112600664A (en) Delayed transaction generation method, delayed transaction execution device and storage medium
CN112328565A (en) Resource sharing method and device based on block chain
CN112181677A (en) Service processing method and device, storage medium and electronic device
CN113935010A (en) Mobile banking login method and device based on block chain and 5G message
CN113409047B (en) Data processing method, device and equipment based on block chain and readable storage medium
CN115409507A (en) Block processing method, block processing device, computer equipment and storage medium
CN113905012A (en) Communication method, device, equipment and medium
CN107145342B (en) Method and device for processing channel information of application
CN110888892B (en) Block synchronization method, device and storage medium
CN112488835A (en) Service processing method, electronic device and readable storage medium
CN109377362B (en) Transaction data processing method and device
CN114092093B (en) Block chain transaction processing method and device, electronic equipment and readable medium

Legal Events

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