CN109347803B - Data processing method, device, equipment and medium for block chain - Google Patents

Data processing method, device, equipment and medium for block chain Download PDF

Info

Publication number
CN109347803B
CN109347803B CN201811089410.2A CN201811089410A CN109347803B CN 109347803 B CN109347803 B CN 109347803B CN 201811089410 A CN201811089410 A CN 201811089410A CN 109347803 B CN109347803 B CN 109347803B
Authority
CN
China
Prior art keywords
synchronization
block
group
synchronous
signature
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
CN201811089410.2A
Other languages
Chinese (zh)
Other versions
CN109347803A (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.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and 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 Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN201811089410.2A priority Critical patent/CN109347803B/en
Publication of CN109347803A publication Critical patent/CN109347803A/en
Application granted granted Critical
Publication of CN109347803B publication Critical patent/CN109347803B/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
    • 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/3247Cryptographic 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 involving digital signatures
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/08Network architectures or network communication protocols for network security for authentication of entities
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/10Network architectures or network communication protocols for network security for controlling access to devices or network resources
    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention discloses a data processing method, a data processing device, data processing equipment and a data processing medium for a block chain. The method is applied to the block chain node and comprises the following steps: receiving a synchronization group creation transaction request initiated by any node; determining at least one block as a synchronous block of the synchronous group according to the synchronous group establishing transaction request; determining a synchronization signature of the synchronization group according to the synchronization block; and recording the synchronous signature as transaction data in a block. According to the technical scheme of the embodiment of the invention, the synchronous signature is stored in the block as the transaction data, so that the probability of tampering the synchronous signature is reduced. Meanwhile, if any node in the block chain wants to acquire the block data, the block data can be verified by taking the synchronization group as a unit, a new thought is provided for verifying the block chain data by the node in the block chain, and the verification mode of the block data is optimized.

Description

Data processing method, device, equipment and medium for block chain
Technical Field
Embodiments of the present invention relate to a block chain technology, and in particular, to a method, an apparatus, a device, and a medium for processing data of a block chain.
Background
The blockchain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism and an encryption algorithm.
In the existing block chain technology, when a certain node needs to synchronously acquire block chain data from other nodes, multiple verification needs to be performed on the received data to determine validity, legality, data correctness and the like of a block, and the verification process needs to occupy a large amount of processing resources of a processor, which takes a long time.
Disclosure of Invention
The embodiment of the invention provides a data processing method, a data processing device, equipment and a medium for a block chain, which are used for optimizing a verification mode of block data.
In a first aspect, an embodiment of the present invention provides a data processing method for a block chain, where the method is applied to a block chain node, and the method includes:
receiving a synchronization group creation transaction request initiated by any node;
determining at least one block as a synchronous block of the synchronous group according to the synchronous group establishing transaction request;
determining a synchronization signature of the synchronization group according to the synchronization block;
and recording the synchronous signature as transaction data in a block.
In a second aspect, an embodiment of the present invention further provides a data processing method for a block chain, which is applied to a block chain node, and includes:
if the synchronous group use requirement is generated, initiating a synchronous group creation transaction request;
and transmitting the synchronization group creation transaction request to a block chain network to request a current block generation node to process according to the synchronization group creation transaction request, determining a synchronization block included in a synchronization group, determining a synchronization signature of the synchronization group according to the synchronization block, and recording the synchronization signature as transaction data in a block.
In a third aspect, an embodiment of the present invention further provides a data processing apparatus for a blockchain, where the data processing apparatus is configured in a blockchain node, and the apparatus includes:
a transaction request receiving module, configured to receive a synchronization group creation transaction request initiated by any node;
a synchronization block determination module, configured to determine at least one block as a synchronization block of the synchronization group according to the synchronization group creation transaction request;
a synchronous signature determining module, configured to determine a synchronous signature of the synchronization group according to the synchronization block;
and the recording module is used for recording the synchronous signature as transaction data in a block.
In a fourth aspect, an embodiment of the present invention further provides a data processing apparatus for a blockchain, where the data processing apparatus is configured in a blockchain node, and the apparatus includes:
the transaction request initiating module is used for initiating a synchronization group to establish a transaction request if a synchronization group use requirement is generated;
and the transaction request transmission module is used for transmitting the synchronization group creation transaction request to a blockchain network so as to request the current block generation node to process according to the synchronization group creation transaction request, determine the synchronization block included in the synchronization group, determine the synchronization signature of the synchronization group according to the synchronization block, and record the synchronization signature as transaction data in the block.
In a fifth aspect, an embodiment of the present invention further provides an apparatus, where the apparatus includes:
one or more processors;
storage means for storing one or more programs;
when the one or more programs are executed by the one or more processors, the one or more processors implement the data processing method of the blockchain according to any one of the first aspect or the data processing method of the blockchain according to the second aspect.
In a sixth aspect, the present invention further provides a medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the data processing method of the blockchain according to any one of the first aspect or implements the data processing method of the blockchain according to the second aspect.
According to the data processing method, device, equipment and medium of the block chain, provided by the embodiment of the invention, after a synchronization group creation transaction request initiated by any node is received, a synchronization group is constructed according to the synchronization group creation transaction request, the synchronization signature of the synchronization group is determined according to the synchronization blocks forming the synchronization group, and then the synchronization signature is stored in the block as transaction data, so that the probability of tampering the synchronization signature is reduced. If any node in the block chain wants to acquire the block data, the block data can be verified by taking the synchronization group as a unit, a new thought is provided for verifying the block chain data by the node in the block chain, and the verification mode of the block data is optimized.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained according to the drawings without inventive efforts.
Fig. 1 is a flowchart of a data processing method for a block chain according to an embodiment of the present invention;
fig. 2 is a flowchart of a data processing method of a block chain according to a second embodiment of the present invention;
fig. 3 is a flowchart of a data processing method of a block chain according to a third embodiment of the present invention;
fig. 4 is a flowchart of a data processing method of a blockchain according to a fourth embodiment of the present invention;
fig. 5 is a flowchart of a data processing method of a blockchain according to a fifth embodiment of the present invention;
fig. 6 is a flowchart of a data processing method of a blockchain according to a sixth embodiment of the present invention;
fig. 7 is a flowchart of a data processing method of a blockchain according to a seventh embodiment of the present invention;
fig. 8 is a flowchart of a data processing method of a blockchain according to an eighth embodiment of the present invention;
fig. 9 is a flowchart of a data processing method of a blockchain according to a ninth embodiment of the present invention;
fig. 10 is a flowchart of a data verification method for a blockchain according to a tenth embodiment of the present invention;
fig. 11 is a schematic structural diagram of a data processing apparatus of a block chain according to an eleventh embodiment of the present invention;
fig. 12 is a schematic structural diagram of a block chain data verification apparatus according to a twelfth embodiment of the present invention;
fig. 13 is a schematic structural diagram of an apparatus provided in the thirteenth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Example one
Fig. 1 is a flowchart of a data processing method of a blockchain according to an embodiment of the present invention, which is applicable to a data processing situation in a blockchain network, for example, a scenario in which a certain node needs to synchronously acquire blockchain data from other nodes in the blockchain network. The applicable blockchain may be a public chain, a private chain, or a federation chain. The whole set of method is realized by the matching execution of an initiator and a receiver of the transaction request for establishing the synchronization group in the block chain. The method may be performed by a blockchain data processing apparatus, which may be implemented in software and/or hardware, and may be integrated in a computing device carrying blockchain nodes. Referring to fig. 1, the method specifically includes:
s110, receiving a synchronization group creation transaction request initiated by any node.
Any node can be any node with synchronization requirement in the block chain, and can also be a node with set authority; but also the current tile generating node, etc. The synchronization group is composed of one or more blocks; the synchronization group creation transaction request is a transaction request for creating a synchronization group, and may be an intelligent contract including a synchronization group creation rule or the like. Optionally, the synchronization group creation transaction request may include: the synchronization group includes information such as a block identifier of the block, a synchronization point position required to be set by the synchronization group, a signature mode of the synchronization group, or an identifier of the synchronization group. The synchronization point may refer to the end position of the synchronization group, and the start position of the synchronization group may be set by default, for example, each synchronization group starts from the last synchronization point by default, or starts from the 0 th block by default.
For example, receiving a synchrony group creation transaction request initiated by any node may include: receiving a synchronous group creating transaction request initiated by any node in real time. Specifically, if a blockchain needs to be synchronized, if any node in the blockchain is a node added to the blockchain, or if the blockchain lacks part or all of the blockchain nodes due to communication quality or other factors such as malicious attack, a synchronization group use requirement is locally generated, a synchronization group creation transaction request is initiated according to the synchronization group use requirement, and the synchronization group creation transaction request is transmitted to the blockchain network; the local node receives a synchronous group creating transaction request initiated by any node in the block chain in real time.
In order to ensure the safety and reliability of the block data, the receiving of the synchronization group creation transaction request initiated by any node may further include, for example: carrying out authority verification on the initiating node; and if the authority verification is passed, accepting the synchronization group creation transaction request, and otherwise rejecting the synchronization group creation transaction request.
Specifically, the local node may locally maintain an identification index table of a node having an authority to initiate creating a synchronization group in a block chain network, and after receiving a synchronization group creation transaction request, may obtain an identification of an initiating node of the synchronization group creation transaction request, and search the identification of the initiating node in the index table; if the synchronous group is found to be correct, determining that the identity of the initiating node is legal, and the initiating node has the authority of initiating the synchronous group creation, and receiving a synchronous group creation transaction request initiated by the initiating node; if the identity identifier of the initiating node is not found or the identity identifier of the initiating node is not matched with the found identity identifier, determining that the initiating node does not have the authority of initiating the synchronous group creation, and rejecting the synchronous group creation transaction request.
It should be noted that, in order to further control the authority for initiating creation of the synchronization group, the node with set authority may control the creation of the synchronization group, for example, the central node. Illustratively, the authority verification of the initiating node may include: and verifying the identity of the creator of the synchronization group creation transaction request by adopting the control authority public key. The central node in the block chain has a control authority, and the control authority private key is adopted to encrypt part of the content of the synchronization group creation transaction request to indicate the identity, so that the local node can decrypt part of the content at least containing the identity of the creator in the synchronization group creation transaction request by adopting the control authority public key after acquiring the synchronization group creation transaction request. Subsequently, the creator identity obtained by decryption may be sent to a set verification node for verification, or the creator identity obtained by decryption may be matched with a prestored identity for verification. Each node in the blockchain may locally maintain a table storing the identity of each node. The identity may be a node identity or a network IP address, etc.
Note that the local node in this embodiment generates a node for the current block.
S120, according to the transaction request created by the synchronization group, at least one block is determined as the synchronization block of the synchronization group.
Wherein, the synchronization block is a block constituting a synchronization group. The number of the synchronization blocks of the synchronization group can be one or more; if the number of blocks in a synchronization group is greater than or equal to 2, the synchronization blocks in the same synchronization group may be consecutive blocks or non-consecutive blocks. And there may be an overlap of blocks between different sync groups.
Alternatively, the synchronization block of the synchronization group may be determined according to a block identifier or a synchronization point, etc. required for the synchronization group included in the synchronization group creation transaction request. The block identifier is a flag for uniquely identifying a certain block, and may be an ID or a number of the block, and optionally, the block identifier in this embodiment is a block ID; the synchronization point may also be referred to as an insertion point, and is used to indicate the position of the first or last block in the synchronization group; optionally, the number of synchronization points may be set according to needs, for example, only one synchronization point may be set at the last block of the synchronization group; a synchronization point may also be set at both the first tile and the last tile.
S130, determining a synchronization signature of the synchronization group according to the synchronization block.
The synchronization signature is an identifier for uniquely identifying or determining a certain synchronization group, and may be used to represent information of a synchronization block included in the synchronization group, or the like. Optionally, the synchronous signature manner of the synchronization group may be a signature manner specified in the transaction request for creating the synchronization group, or a signature manner specified by the blockchain system, or a signature manner determined by the local node using its own public key, private key, or signature algorithm, such as SHA256, and the like. To facilitate subsequent querying and verification, and to increase the confidence of the synchronization signature, exemplary determining the synchronization signature of the synchronization group according to the synchronization block may further include: and determining the synchronous signature of the synchronous group according to the synchronous block and the identification of the initiating node for initiating the establishment of the synchronous group. The originating node identifier may be an ID or a network IP address of a node that initiates the creation of the synchronization group.
Specifically, different signature manners determine the degree of verification on the block data, and the following embodiments will describe in detail the implementation scheme of determining the synchronous signature of the synchronous group by using different signature manners. For example, the sync signature of the sync group may be obtained by performing hash signature according to the block id of each sync block in the sync group.
It should be noted that, in the present embodiment, the synchronization signature of the synchronization group is determined according to the synchronization block, and the association relationship among the synchronization block, the synchronization group, and the synchronization signature is indirectly indicated, so that convenience is brought to subsequent synchronization group query.
S140, recording the synchronization signature as transaction data in the block.
To reduce the probability of the native node tampering with the synchronization signature of the synchronization group, the synchronization signature may be stored in the chunk as transaction data after the synchronization signature of the synchronization group is determined from the synchronization chunk.
Optionally, recording the synchronization signature as transaction data in the block may include: taking the synchronous signature as transaction data through the current block generation node, and recording the transaction data in the current block; and sending the current block to other nodes for verification.
Specifically, if the local node is the current block generation node, the local node directly takes the synchronous signature of the synchronous group as transaction data and records the transaction data in the current block after determining the synchronous signature of the synchronous group according to the synchronous block; sending the current block to other nodes in the block chain for verification; after receiving the current block sent by the local node, other nodes process the transaction request for creating the synchronization group, calculate the synchronization signature of the synchronization group in the same way as the local node, if the synchronization signature is consistent with the synchronization signature in the current block, confirm that the current block is valid, and store the current block in a block chain; and if the current block identifier is inconsistent with the current block identifier, sending block failure information containing the current block identifier to other nodes in the block chain.
After the synchronous signature is used as transaction data and recorded in the block, if any node in the block chain wants to synchronize the block chain, the synchronous signature can be verified, and after the synchronous signature is verified, synchronization is performed by taking a synchronization group as a unit, so that the data synchronization rate is increased.
According to the technical scheme provided by the embodiment of the invention, after a synchronization group creation transaction request initiated by any node is received, the synchronization group is constructed according to the synchronization group creation transaction request, the synchronization signature of the synchronization group is determined according to the synchronization block forming the synchronization group, and then the synchronization signature is stored in the block as transaction data, so that the probability of tampering the synchronization signature is reduced. If any node in the block chain wants to acquire the block data, the block data can be verified by taking the synchronization group as a unit, a new thought is provided for verifying the block chain data by the node in the block chain, and the verification mode of the block data is optimized. If the method is used for a scene of the synchronous block data, a plurality of synchronous blocks can be verified at one time, and data synchronization is accelerated. In addition, because any node in the block chain can send a synchronization group creation transaction request to the block chain network in real time when the synchronization group is needed to perform block data synchronization, verification or query, the local node can receive the synchronization group creation transaction request initiated by any node in the block chain and execute the creation operation of the synchronization group, so that the creation of the synchronization group can be created in real time according to the actual situation, and the method has flexibility.
Example two
Fig. 2 is a flowchart of a data processing method of a block chain according to a second embodiment of the present invention, which is further optimized based on the foregoing embodiments. Referring to fig. 2, the method specifically includes:
s210, receiving a synchronization group creation transaction request initiated by any node.
S220, according to the transaction request created by the synchronization group, at least one block is determined as the synchronization block of the synchronization group.
And S230, determining the synchronous signature of the synchronous group according to the synchronous block.
S240, recording the synchronization signature as transaction data in the block.
And S250, storing the index data of the synchronization group in a local synchronization group index table.
The index data refers to data for assisting the nodes to quickly find the synchronization group information; may include a synchronization group id, an id of each synchronization block constituting the synchronization group, a synchronization signature of the synchronization group, and an id of a block where the synchronization signature is located. The synchronization group identification may be a number or name of the synchronization group, etc.; the block ID is a flag for uniquely identifying or identifying a certain block, and may be an ID or a number of the block.
The synchronous group index table is a table for storing different synchronous group index data according to a certain sequence or rule; for example, index data for different sync groups may be stored in terms of sync group identifications, a sync group may uniquely correspond to a row or a column in a sync group index table, and so on. Optionally, the synchronization group index table may be dynamically updated according to the synchronization group established in the block chain, such as addition, deletion, or replacement.
Specifically, after receiving a synchronization group creation transaction request and performing signature processing to verify transaction data, the local node stores mapping relationships of a synchronization group, a synchronization signature, a synchronization block and the like in a local synchronization group index table.
Illustratively, when a local node needs to query a synchronization group, the local node may query the required synchronization group in any one or more of the following ways:
1) index data of the synchronization group is looked up in a local synchronization group index table.
2) Initiating a synchronization group query transaction request, and requesting a current block generation node to traverse a block chain from back to front to query a synchronization group; the synchronization group query request refers to a request for querying a synchronization group, and may include a required synchronization group identifier or a synchronization group signature.
3) And sending a synchronization group query request to each node trusted by the local node, and requesting each node to query index data of the synchronization group in a local synchronization group index table and the like.
Specifically, when a local node needs to use a synchronization group synchronization block chain, if a synchronization group index table is locally stored, the local node can firstly query the local synchronization group index table, and if a synchronization group matched with the needed synchronization group exists, the local node can directly acquire index data of the synchronization group to perform synchronization operation; if no matched synchronization group exists, the local node can initiate a synchronization group query transaction request to each trusted node, so that each trusted node queries index data of the synchronization group in a local synchronization group index table after receiving the synchronization group query transaction request; and if the local node receives the non-queried information fed back by each node trusted by the local node, sending a synchronization group query transaction request to the current block generation node to request the current block generation node to traverse the block chain from the current block to the front so as to query the synchronization group. If the current chunk generating node also does not query a matching synchronization group, a synchronization group creation transaction request including the required synchronization group may be initiated.
It should be noted that, the above-mentioned manners of querying the required synchronization group may be performed independently; or the local query is firstly carried out, namely, the first mode, and then the mode of sending the synchronous group query transaction request, namely, the second or third mode, can be used for querying.
According to the technical scheme provided by the embodiment of the invention, after the synchronization group is constructed and the synchronization signature of the synchronization group is stored in the block, the node in the block chain can locally maintain a synchronization group index table, and the index data of the synchronization group is stored in the local synchronization group index table, so that convenience is provided for subsequent query, verification, synchronization data and the like.
EXAMPLE III
Fig. 3 is a flowchart of a data processing method of a block chain according to a third embodiment of the present invention, and this embodiment further explains a synchronization group creation transaction request initiated by any node on the basis of the foregoing embodiments. Referring to fig. 3, the method specifically includes:
s310, receiving a synchronous group creation proposal request initiated by any node.
The proposal request is that when any node in the block chain needs to execute a certain transaction, such as an intelligent contract, a proposal transaction request is initiated, and the current block generation node requires to feed back a voting result to other nodes; the proposal request may include at least one of: the sync block and signature scheme of the sync group to be constructed, etc. Alternatively, the proposal request may indicate the creation of the synchronization group in a default manner, e.g., the currently initiated synchronization group creation proposal request indicates the creation of a synchronization point at the current tile.
And S320, initiating a proposal voting notification according to the proposal request, and requiring other nodes to vote for the creation of the synchronization group.
Specifically, after receiving a synchronous group creation proposal request initiated by any node, the local node initiates a voting notification, so that other nodes in the block chain vote for the creation of the synchronous group; the local node receives the voting results fed back by other nodes and summarizes the voting results.
And S330, receiving the synchronous group creation intelligent contract in the proposal request according to the voting result, and using the intelligent contract as the synchronous group creation transaction request.
It should be noted that, in this embodiment, the synchronization group creation transaction request is carried in the synchronization group creation proposal request as an intelligent contract, and may be stored in the block after the synchronization group creation transaction request is executed to obtain the transaction data.
Specifically, the local node may determine the voting result according to a voting ratio, which may be set by default or specified by the synchronization group creation proposal request. If the voting result shows that the synchronous group to be created in the proposal request has performability, receiving the synchronous group creation intelligent contract in the proposal request, and taking the synchronous group creation intelligent contract as a synchronous group creation transaction request; and if the voting result shows that the synchronization group to be created in the proposal request does not accord with the specification and the like, rejecting the synchronization group in the proposal request to create the intelligent contract.
S340, according to the transaction request created by the synchronization group, at least one block is determined as the synchronization block of the synchronization group.
S350, determining a synchronization signature of the synchronization group according to the synchronization block.
And S360, recording the synchronous signature as transaction data in the block.
According to the technical scheme provided by the embodiment of the invention, the local node votes the synchronous group creation proposal request based on the intelligent contract, determines whether the synchronous group creation intelligent contract in the proposal request is accepted as the synchronous group creation transaction request according to the voting result, executes the subsequent synchronous group creation process and further controls the number of created synchronous groups; meanwhile, the transaction request created based on the intelligent contract is stored in the block chain after the code segment is executed to generate the transaction data, and therefore the fact that the transaction data are difficult to tamper is guaranteed.
Example four
Fig. 4 is a flowchart of a data processing method of a block chain according to a fourth embodiment of the present invention, and this embodiment provides an operation manner for determining at least one block as a synchronization block of a synchronization group according to a synchronization group creation transaction request based on the foregoing embodiment. Referring to fig. 4, the method specifically includes:
s410, receiving a synchronization group creation transaction request initiated by any node.
S420, according to the transaction request created by the synchronization group, determining the current block as the synchronization block of the synchronization group.
The current block refers to a block currently being or already generated in the blockchain network, and is a newly generated block in the blockchain network. It should be noted that when a sync group includes a sync block, it is equivalent to that the sync signature can be used to replace the block identifier to some extent. Or set to have a higher priority for the sync signature than the block id of the sync block. The technical scheme provides more flexible selection space for the verification processing of the block.
For example, since each block header data includes the block id of the previous block, and the block id of a block is determined according to the signature of the transaction data, etc., the modification of a transaction data will result in the block id being modified in a linked manner, i.e., all subsequent block ids will need to be modified. In order to avoid linkage modification, when a local node or other nodes need to modify the transaction data in a certain block, a synchronization group at least comprising the block where the modified transaction data is located can be established. Preferably, a synchrony group including only the block in which the modified transaction data resides may be established.
It should be noted that the local node defaults to use the current block as the sync block of the sync group.
Specifically, the local node may perform query in the block chain according to a block identifier of the current block included in the synchronization group creation transaction request or an identifier of specific transaction data included in the current block, and if the block identifier exists and is correct, determine the current block as the synchronization block of the synchronization group; if the block identifier is not present or incorrect, the synchronization group creation transaction request can be regarded as invalid, and the local node sends invalid information including the synchronization group creation transaction request to the blockchain system.
The local node can also determine a block corresponding to the synchronization point according to the synchronization point included in the synchronization group creation transaction request, and determine the block as the synchronization block of the synchronization group; in order to accurately obtain the synchronization block corresponding to the synchronization group, two synchronization points may be set at the current block position, and the last block and the first block determined according to the two synchronization points are the same block, and then the current block is used as the synchronization block of the synchronization group.
S430, determining a synchronization signature of the synchronization group according to the synchronization block.
S440, recording the synchronization signature as transaction data in the block.
According to the technical scheme of the embodiment of the invention, as the synchronization group only has one synchronization block, the local node can determine the synchronization signature of the synchronization group by adopting a simple signature algorithm according to the block identifier of the synchronization block, namely, the synchronization group signature is adopted to replace the block identifier. When other subsequent nodes need to perform the synchronization block chain on the synchronization group, when the synchronization group is verified, transaction data in the synchronization block does not need to be processed one by one, only the signature algorithm same as that of the local node is used for calculating the synchronous signature, and the calculated signature of the synchronization group is matched with the synchronous signature of the synchronization group, so that the verification process is simplified, and the verification process is accelerated. Meanwhile, if the synchronous block of the synchronous group is a modified block, the synchronous signature mode of the synchronous group is adopted, so that the phenomenon that block identifiers obtained by processing the transaction data in the synchronous block one by one do not accord with the block identifiers stored in the blocks due to modification of the transaction data in the conventional block verification mode can be avoided. Since the synchronous signature is recorded in the block, the synchronous signature is approved and effectively supervised by other nodes, and therefore, when the synchronous signature is used for replacing the block identifier to perform a verification function, a tamper-proof function of the block data can be performed. In addition, since the sync group is updatable, a chunk may belong to multiple sync groups, and all sync groups may not be active at the same time, for example, the last created sync group is used as the active sync group to which the chunk belongs.
EXAMPLE five
Fig. 5 is a flowchart of a data processing method of a block chain according to a fifth embodiment of the present invention, and this embodiment further provides an operation manner for determining at least two blocks as sync blocks of a sync group according to a transaction request for creating the sync group based on the foregoing embodiment. Referring to fig. 5, the method specifically includes:
s510, receiving a synchronization group creation transaction request initiated by any node.
S520, according to the synchronization group creation transaction request, determining the current block and at least one continuous block in the preamble as the synchronization block of the synchronization group.
Wherein the consecutive blocks correspond to non-consecutive blocks. At least two blocks are contiguous if there is no discontinuity between any two blocks of the at least two blocks.
Specifically, the local node may also determine the current block and at least one consecutive block in front of the current block as the synchronization block of the synchronization group according to a block identifier required to be included in the synchronization group creation transaction request, or a synchronization point position required to be set by the synchronization group. For example, the end block of the synchronization group may be determined according to the synchronization point included in the synchronization group creation transaction request, and the block between the current block and the end block may be determined as the synchronization block of the synchronization group. The local node can also locate a certain block according to the block identifier included in the synchronization group creation transaction request, and take the continuous blocks starting from the block to the current block in the block chain as the synchronization blocks of the synchronization group, and the like.
It should be noted that, the positions of the synchronization points are different, and the established synchronization groups are different; for example, the current block is the 300 th block, and if the synchronization point is set at the 200 th block position, the 200 th to 300 th blocks are a synchronization group; if the synchronization point is set at the 100 th block position, the 100 th to 300 th blocks are a synchronization group, and so on.
S530, determining a synchronization signature of the synchronization group according to the synchronization block.
S540 records the synchronization signature as transaction data in the block.
According to the technical scheme provided by the embodiment of the invention, the blocks form a synchronization group, and other subsequent nodes need to perform a synchronization block chain on the synchronization group, so that only one time of a synchronization signature of the synchronization group needs to be verified, and each block in the synchronization group does not need to be verified, thereby simplifying the verification process.
Illustratively, the operation of determining at least one block from the synchronization group creation transaction request as a synchronization block of the synchronization group may further include at least one of:
1) and determining at least two continuous m-n blocks as synchronous blocks of the synchronous group according to the synchronous group creating transaction request.
2) And determining continuous blocks starting from the first block to the current block as the synchronous blocks of the synchronous group according to the synchronous group creating transaction request.
It should be noted that the current macroblock is continuously updated as the blockchain network operates, so that the synchronization macroblocks between different synchronization groups overlap. For example, if the current block is the 10 th block, the 0 th block to the 10 th block in the block chain have a synchronization group; if the current block is changed to the 20 th block, the 0 th block to the 20 th block are a sync group, and so on. For example, if a new current block is generated in the block chain, and after a synchronization group is created according to the new current block, a previously created synchronization group in the block chain may be failed by default. For example, after the 0 th to 20 th blocks are created as a sync group, the sync group created by the 0 th to 10 th blocks is disabled, and so on. In this embodiment, the synchronization point is default to be set at the current block position, and serves as the last block of the synchronization group, and the first block is default to be the 0 th block.
Specifically, the local node may determine that the current block is the last block of the synchronization group according to the position of the synchronization point included in the synchronization group creation transaction request, and use a continuous block from 0 to the current block in the block chain as the synchronization block of the synchronization group. The local node can also locate the current block according to the block identification included in the synchronization group creation transaction request, and take the continuous blocks starting from 0 to the current block in the block chain as the synchronization blocks of the synchronization group. If the synchronization group creation transaction request is a creation instruction, the local node directly sets a synchronization point at the current block position after acquiring the synchronization group creation transaction request, and determines a synchronization block of the synchronization group and the like from a continuous block starting from 0 to the synchronization point position.
In this embodiment, the synchronization group established from 0 is more suitable for a node newly added in the block chain system to synchronize the block chain, and only one time of the synchronization signature of the synchronization group needs to be verified, and each block in the synchronization group does not need to be verified, thereby simplifying the verification process. In order to avoid excessive setting of the synchronization points, it may be preferable to create the synchronization group in the manner of 2) or 3).
EXAMPLE six
Fig. 6 is a flowchart of a data processing method of a block chain according to a sixth embodiment of the present invention, and this embodiment further provides an operation manner of determining at least one block as a synchronization block of a synchronization group according to a synchronization group creation transaction request based on the foregoing embodiment. Referring to fig. 8, the method specifically includes:
s610, receiving a synchronization group creation transaction request initiated by any node.
S620, according to the target block determining condition in the transaction request for creating the synchronization group, determining the target block, and using the target block as the synchronization block of the synchronization group.
Wherein the target block determination condition may include at least one of: 1) setting a block of a serial number; 2) including setting blocks of transaction data; 3) and setting the block generated by the block generation node. Specifically, the search can be performed in the block chain according to the set serial number of the block, and the matched block is determined as the target block; the blocks in the block chain can be positioned according to the set identification of the transaction data, so that the target blocks are determined; or acquiring the block generated by the block generation node in the block chain according to the set block generation node identifier, and determining the block generated by the block generation node as the target block.
Specifically, after the local node acquires the synchronization group creation transaction request, it may perform query in the block chain according to a target block determination condition included in the synchronization group creation transaction request, determine a target block, and use the target block as a synchronization block of the synchronization group. In this embodiment, the blocks in the synchronization group can be dynamically selected according to actual requirements, thereby further improving the flexibility of the use of the synchronization group.
S630, determining a synchronization signature of the synchronization group according to the synchronization block.
S640 records the synchronization signature as transaction data in the block.
According to the technical scheme provided by the embodiment of the invention, the blocks in the synchronization group can be dynamically determined according to the conditions, so that the use flexibility of the synchronization group is further improved. Meanwhile, when the synchronization group is used for data synchronization, only one time of synchronization signature of the synchronization group needs to be verified, and each block in the synchronization group does not need to be verified, so that the verification process is simplified.
EXAMPLE seven
Fig. 7 is a flowchart of a data processing method of a block chain according to a seventh embodiment of the present invention, and this embodiment provides a way to determine a synchronization signature of a synchronization group according to a synchronization block based on the foregoing embodiments. Referring to fig. 7, the method specifically includes:
s710, receiving a synchronization group creation transaction request initiated by any node.
S720, according to the transaction request created by the synchronization group, at least one block is determined as the synchronization block of the synchronization group.
And S730, sequentially stringing the block identifications of the synchronous blocks together, and performing signature calculation to form the synchronous signature of the currently created synchronous group.
Specifically, after determining the synchronization blocks of the synchronization group according to the synchronization group creation transaction request, the local node obtains the block identifier of each synchronization block from the block header of each synchronization block, connects the block identifiers of the synchronization blocks together according to the number sequence of the synchronization blocks to serve as an integral identifier, and signs the integral identifier by using a signature mode specified in the synchronization group creation transaction request, a public key, a private key or a signature algorithm such as SHA256 of the local node, and forms the synchronization signature of the currently created synchronization group.
To further improve the security of the synchronization signature and increase the complexity of the synchronization signature, exemplary determining the synchronization signature of the synchronization group according to the synchronization block may further include: and establishing a Meckel tree by using the block identifier of each synchronous block, and taking the root of the Meckel tree as a synchronous signature. Specifically, after determining the synchronization blocks of the synchronization group according to the transaction request created by the synchronization group, the machine node acquires the block identifier of each synchronization block from the block header of the synchronization block, generates a mekerr tree by using a mekerr tree algorithm according to the block identifier of each synchronization block, and uses the root of the mekerr tree as the synchronization signature of the synchronization group.
In addition, the security of the synchronous signature is further improved, the reliability of the synchronous signature is increased, and the probability of the local node being false is reduced. For example, determining the synchronization signature of the synchronization group according to the synchronization block may further include: determining a synchronization signature of a synchronization group according to the synchronization block and associated information, wherein the associated information comprises at least one of the following items: creator information and creation time information.
Creator information refers to node information such as node identification for creating a synchronization group; the creation time information refers to a local timestamp at which the native node created the synchrony group.
Specifically, the local node may sequentially string the identifiers of the synchronization blocks together to form an overall identifier, add creator information and creation time information to the overall identifier to form a new overall identifier, and sign the new overall identifier to form a synchronization signature of the currently created synchronization group. The local node may also use the root of the meikert tree, creator information, and creation time information together as a synchronization signature of the synchronization group after generating the meikert tree by using the meikert tree algorithm according to the block identifier of each synchronization block.
S740, records the synchronization signature as transaction data in the block.
Specifically, the synchronous signature is used as transaction data by the current block generation node and is recorded in the current block; and sending the current block to other nodes for verification. After receiving the current block sent by the local node, other nodes firstly acquire creation time information from the synchronous signature, compare the creation time information with the current local time of the local node, if the time difference is not within a preset time threshold, the local node is possibly subjected to a false phenomenon, a subsequent verification process of the synchronous signature is not performed, and verification failure information is directly fed back; if the time difference value is within a preset time threshold value, other nodes can calculate the synchronous signature of the synchronous group in the same way as the local node, and if the synchronous signature is consistent with the synchronous signature in the current block, the current block is determined to be valid and stored in a block chain; and if the current block identifier is inconsistent with the current block identifier, sending block failure information containing the current block identifier to other nodes in the block chain.
According to the technical scheme provided by the embodiment of the invention, different synchronous signature algorithms are adopted to determine the synchronous signature of the synchronous group according to the synchronous block and the actual situation, so that the synchronous signature is more flexibly used; meanwhile, the synchronous signature is determined according to the synchronous block, and the fact that the synchronous signature follows a certain rule and the incidence relation among the synchronous block, the synchronous group and the synchronous signature are indirectly shown, so that convenience is brought to follow-up synchronous group query.
Example eight
Fig. 8 is a flowchart of a data processing method of a block chain according to an eighth embodiment of the present invention, which provides a way to determine a synchronization signature of a synchronization group according to a synchronization block based on the above embodiments. Referring to fig. 8, the method specifically includes:
s810, receiving a synchronization group creation transaction request initiated by any node.
S820, according to the transaction request for creating the synchronization group, at least one block is determined as the synchronization block of the synchronization group.
And S830, signing the block header data of each synchronous block to form sub-signatures, establishing a Merkel tree by adopting each sub-signature, and taking the root of the Merkel tree as a synchronous signature.
The block header data may include a previous block identifier, a timestamp of block creation, a random number, a target hash, a root of a merkel tree established by the transaction data in the block, and the like. The sub-signature may be a hash signature or the like.
Specifically, after determining the synchronization block of the synchronization group according to the synchronization group creation transaction request, the local node may obtain the block header data of the synchronization block from each synchronization block, perform sub-signature on the block header data of each synchronization block in a signature manner such as hash signature, generate a mekerr tree according to each sub-signature by using a mekerr tree algorithm, and use the root of the mekerr tree as the synchronization signature of the synchronization group.
In order to further improve the security of the synchronous signature, increase the credibility of the synchronous signature and reduce the probability of the false of the local node. For example, determining the synchronization signature of the synchronization group according to the synchronization block may further include: determining a synchronization signature of a synchronization group according to the synchronization block and associated information, wherein the associated information comprises at least one of the following items: creator information and creation time information. Creator information refers to node information such as node identification for creating a synchronization group; the creation time information refers to a local timestamp at which the native node created the synchrony group.
Specifically, the local node signs the block header data of each synchronization block to form a sub-signature, and after generating the meikel tree by adopting the meikel tree algorithm according to each sub-signature, the root of the meikel tree, creator information and creation time information are taken as the synchronization signature of the synchronization group.
S840, recording the synchronization signature as transaction data in the block.
According to the technical scheme provided by the embodiment of the invention, the block header data of each synchronous block is adopted to carry out signature to form the sub-signature, then the sub-signature is calculated by adopting a Merkel tree algorithm to generate the Merkel tree, and the root of the Merkel tree is used as the synchronous signature. By increasing the complexity of the synchronous signature, the safety of the synchronous signature is further improved and the reliability of the synchronous signature is increased.
For example, determining the synchronization signature of the synchronization group according to the synchronization block may further include: and performing signature calculation according to the synchronization block of the currently created synchronization group and the synchronization signature of at least one existing synchronization group to form the synchronization signature of the currently created synchronization group.
Specifically, after determining the synchronization block of the currently created synchronization group, the local node may first perform query from the local synchronization group index table to obtain the synchronization signature of the existing synchronization group included in the currently created synchronization group. For example, the sync blocks currently included in the created sync group are the 201 st block to the 300 th block; the existing synchronization group 1 is composed of the 0 th block to the 100 th block, the synchronization group 2 is composed of the 101 th block to the 200 th block, and the local node can combine the synchronization signature of the synchronization group 1 and the synchronization signature of the synchronization group 2, and the synchronization block of the current synchronization group to perform signature, so as to form the synchronization signature of the currently created synchronization group. The signature method used in this embodiment makes each synchronization group related to each other, but not isolated.
Example nine
Fig. 9 is a flowchart of a data processing method of a blockchain according to a ninth embodiment of the present invention, where the present embodiment is applicable to a data processing situation in a blockchain network, for example, a scenario in which a certain node needs to synchronously acquire blockchain data from other nodes in the blockchain network. The applicable blockchain may be a public chain, a private chain, or a federation chain. The whole set of method is realized by the matching execution of the initiator and the receiver of the synchronization group creation transaction request in the block chain. The method may be performed by a blockchain data processing apparatus, which may be implemented in software and/or hardware, and may be integrated in a computing device carrying blockchain nodes. Referring to fig. 9, the method specifically includes:
s910, if the synchronization group use requirement is generated, a synchronization group creation transaction request is initiated.
The synchronous group use requirement refers to a requirement generated when a synchronous group needs to be used; the synchronization group usage requirement may indicate blocks or transaction data, etc. included in the required synchronization group. Optionally, generating the synchronization group usage requirement may include: if the local needs the synchronous block chain, generating a synchronous group using requirement; if the data in the blockchain needs to be modified locally, a synchronization group usage requirement is generated, etc. The method can also comprise the following steps: when the local node loses part or all of the blocks due to the communication quality or other factors such as malicious attack, the local node needs to synchronously download the block chains, and the use requirement of the synchronization group is generated.
Exemplary synchronization group usage requirements may include: block synchronization requirements, block data query requirements, or block data verification requirements, etc. Specifically, the block synchronization requirement refers to a requirement generated when a node in a block chain needs to perform block data synchronization, and the block synchronization requirement may include a block identifier of a required synchronization block; the block data query requirement refers to a requirement generated when a block chain node needs to query one or more block data in a block chain, and may include a block identifier of a block to be queried or an identifier of transaction data to be queried; correspondingly, the block data verification requirement refers to a requirement generated when a block chain node needs to verify one or more block data in a block chain, and may include a block identifier of a block to be verified or an identifier of transaction data to be queried.
Specifically, if the local node is determined to be a node newly added to the blockchain network, a block synchronization requirement for acquiring a complete blockchain can be generated, a synchronization group creation transaction request is initiated according to the block synchronization requirement, so as to request the current block generation node to create a synchronization group required to be synchronized, and feedback is performed; the local node saves the synchronization group matched with the feedback of the current block generation node.
It should be noted that the block data query request and the block data verification request may be initiated by a lightweight node that does not locally store or store part of the block data. For example, if the local node is a lightweight node, a block data query request is generated when the block data needs to be queried. Since the local node does not store the block locally, when the block data query requirement is generated, a synchronization group creation transaction request can be sent to the conventional full node to request the full node to feed back the matched synchronization group.
To ensure security of the transaction data, exemplary initiating a synchrony group creation transaction request may include: and taking the synchronous group creation transaction request as an intelligent contract carried in the synchronous group creation proposal request. Specifically, the transaction request created based on the intelligent contract is stored in the blockchain after the code segment is executed to generate the transaction data, so that the transaction data is difficult to tamper.
S920, transmitting the synchronization group creation transaction request to the blockchain network, so as to request the current block generation node to process according to the synchronization group creation transaction request, determine the synchronization block included in the synchronization group and determine the synchronization signature of the synchronization group according to the synchronization block, and record the synchronization signature as transaction data in the block.
For example, the local node may receive the synchronization group, the synchronization signature, the synchronization block corresponding to the synchronization group, and the like fed back by the current block generation node, and store the synchronization group, the synchronization signature, the synchronization block corresponding to the synchronization group, and the like in the local synchronization group index table for subsequent verification or synchronization and the like.
According to the technical scheme provided by the embodiment of the invention, when a synchronization group is required to be used for block data synchronization, verification or query and the like, any node in the block chain can send a synchronization group creation transaction request to the block chain network in real time to request the current block generation node to execute the creation operation of the synchronization group, so that the creation of the synchronization group can be created in real time according to the actual situation, and the method has flexibility.
Example ten
Fig. 10 is a flowchart of a data verification method for a blockchain according to a tenth embodiment of the present invention, where this embodiment provides a data verification method for a blockchain with a synchronization group, and the method is applied to a solution for performing a data synchronization scenario from another node by any node in a blockchain network, and the method can be executed by a local node or another node in the blockchain network according to the ninth embodiment. Wherein the synchronization group can be created in the manner of the foregoing embodiment. The scheme of this embodiment is implemented by a data verification device of a block chain, which can be implemented in software and/or hardware, and can be generally configured in an electronic device of a block chain node. Referring to fig. 10, the method specifically includes:
s1010, initiating a block synchronization request to another node, and receiving a block fed back by the other node.
In this embodiment, when the block synchronization request is generated, the block synchronization request is sent to other nodes to download the synchronization block data. The other node may be any node storing a block chain, preferably a trusted node of the native node. The block synchronization request refers to a requirement generated when a node in a block chain needs to perform block data synchronization, and may include a block identifier of a required synchronization block.
Optionally, generating the block synchronization request may include at least one of: 1) if the local node is determined to be a node newly added into the block chain network, generating a block synchronization request for acquiring a complete block chain; 2) when the local node loses part or all blocks due to communication quality or other factors such as malicious attack, the local node needs to synchronously download the block chain, and a block synchronization request is generated; 3) generating a block synchronous request of a block to be queried according to the block data query request; 4) and generating a block synchronization request of the block to be verified according to the block data verification request.
The local node sends a block synchronization request to other nodes in the block chain network, and after receiving the block synchronization request sent by the local node, the other nodes acquire block data of a corresponding synchronization group and feed back the block data to the local node; and the local node receives the block data of the synchronization group fed back by other nodes and stores the block data locally.
S1020, determine a synchronization group to be synchronized with the block, and query a synchronization signature of the synchronization group from the block, wherein the synchronization group includes at least one synchronization block.
Specifically, the local node may perform synchronization group search in a locally maintained index table or a block chain according to a block identifier to be synchronized included in the block synchronization request, and if a matching synchronization group is found, determine the matching synchronization group as the synchronization group in which the block to be synchronized is located; if a matching synchronization group is not found, a synchronization group creation transaction request may be sent to the blockchain network to request the blockchain network to create the synchronization group to obtain the synchronization group. The locally maintained index table may be added with synchronization group information for query when the synchronization group is created.
Optionally, the method may further include: if it is determined that no matching synchrony group is required, a synchrony group creation transaction request is initiated.
After determining the synchronization group where the block to be synchronized is located, the local node may obtain the synchronization signature of the synchronization group from the block according to the synchronization group.
The execution sequence of the operations S1010 and S1020 is not limited, and the block data synchronization request may be initiated first, and the synchronized block data is received from other nodes, and then the corresponding synchronization group is matched to obtain the synchronization signature.
And S1030, calculating a synchronous signature according to the synchronous block, and comparing and verifying the synchronous signature with the acquired synchronous signature.
The sync block refers to a block constituting a sync group, and each sync group includes at least one sync block. Optionally, the obtained synchronization groups have different synchronization signature manners, and the local node has a different manner of calculating the synchronization signature according to the synchronization block.
Specifically, the local node may calculate a synchronization signature of the synchronization group according to the synchronization block, compare the calculated synchronization signature with the synchronization signature obtained from the block, and determine that the synchronization signature passes verification if the calculated synchronization signature and the synchronization signature are the same; and if not, determining that the synchronous signature of the synchronous group is not verified.
S1040, if the verification is passed, determining that the synchronization block of the synchronization group is verified.
Specifically, if the synchronization signature of the synchronization group passes the verification, determining that the synchronization block of the synchronization group passes the verification; and if the synchronization signature is not verified, determining that the synchronization block of the synchronization group is not verified.
It should be noted that, in this embodiment, the block identifier verification function of the sync block is directly replaced by the verification of the sync signature, or the verification priority of the sync signature may be set to be higher than the verification priority of the sync block. When block data is used for synchronization, the synchronization group is used as a unit for verification, and the block identification of each synchronization block does not need to be verified one by one, so that the verification process is simplified. In addition, since the synchronous signature is recorded in the block, the synchronous signature is approved and effectively supervised by other nodes, and meanwhile, the synchronous signature can also play a role in preventing the block data from being tampered.
When a node needs to download multiple sync blocks, for example, the entire block chain, it may belong to multiple consecutive sync groups. For example, querying for a synchronization group to be block matched may include: and inquiring one or more synchronization groups to be synchronized block matching.
Specifically, the synchronization group query may be performed according to the block identifier to be synchronized included in the block synchronization request, so as to obtain one or more synchronization groups matched with the block to be synchronized. If only one synchronization group is matched with the block to be synchronized, determining the synchronization group as a required synchronization group; and if a plurality of synchronous groups are matched with the block to be synchronized, determining the plurality of synchronous groups as the required synchronous groups. If there are multiple synchronization groups matched with a certain block to be synchronized, the last synchronization group created can be used as the valid synchronization group to which the block to be synchronized belongs according to the time of creating each synchronization group, thereby ensuring that the synchronization group acquired each time is created latest.
In the above scheme, the method may further include: and if at least one block in the blocks to be synchronized is determined to have no matched synchronization group, verifying according to the block identification of the block without matching. For example, when the block to be synchronized is 920 blocks, from front to back, every 100 blocks form a synchronization group, and the last 20 blocks do not belong to any synchronization group, the synchronization blocks belonging to the synchronization group can be verified according to the synchronization signature, and the blocks not belonging to the synchronization group are still verified according to the block identity.
According to the technical scheme provided by the embodiment of the invention, when block data is required to be used for synchronization, local nodes only need to compare and verify the synchronous signature obtained by calculation according to the synchronous blocks with the synchronous signature obtained from the blocks, and the block identification of each synchronous block does not need to be verified one by one.
EXAMPLE eleven
Fig. 11 is a schematic structural diagram of a data processing apparatus of a block chain according to an eleventh embodiment of the present invention, where the apparatus may be configured in a block chain node, and may execute a data processing method of a block chain according to any embodiment of the present invention, and the apparatus has functional modules and beneficial effects corresponding to the execution method. As shown in fig. 11, the apparatus includes:
a transaction request receiving module 1110, configured to receive a synchronization group creation transaction request initiated by any node;
a sync block determination module 1120, configured to determine at least one block as a sync block of a sync group according to the sync group creation transaction request;
a synchronization signature determination module 1130 configured to determine a synchronization signature of a synchronization group according to the synchronization block;
a recording module 1140 for recording the synchronization signature as transaction data in the block.
According to the technical scheme provided by the embodiment of the invention, after a synchronization group creation transaction request initiated by any node is received, the synchronization group is constructed according to the synchronization group creation transaction request, the synchronization signature of the synchronization group is determined according to the synchronization block forming the synchronization group, and then the synchronization signature is stored in the block as transaction data, so that the probability of tampering the synchronization signature is reduced. If any node in the block chain wants to acquire the block data, the block data can be verified by taking the synchronization group as a unit, a new thought is provided for verifying the block chain data by the node in the block chain, and the verification mode of the block data is optimized. If the method is used for a scene of the synchronous block data, a plurality of synchronous blocks can be verified at one time, and data synchronization is accelerated. In addition, because any node in the block chain can send a synchronization group creation transaction request to the block chain network in real time when the synchronization group is needed to perform block data synchronization, verification or query, the local node can receive the synchronization group creation transaction request initiated by any node in the block chain and execute the creation operation of the synchronization group, so that the creation of the synchronization group can be created in real time according to the actual situation, and the method has flexibility.
Illustratively, the apparatus may further include:
the verification module is used for carrying out authority verification on the initiating node;
and the judging module is used for accepting the synchronous group transaction creation request if the permission verification is passed, and rejecting the synchronous group transaction creation request if the permission verification is not passed.
Illustratively, the verification module may be specifically configured to:
and verifying the identity of the creator of the synchronization group creation transaction request by adopting the control authority public key.
Illustratively, the transaction request receiving module 1110 may be specifically configured to:
receiving a synchronous group creation proposal request initiated by any node; initiating a proposal voting notification according to the proposal request, and requiring other nodes to vote for the creation of the synchronous group; and receiving a synchronous group creation intelligent contract in the proposal request according to the voting result, and using the intelligent contract as a synchronous group creation transaction request.
It should be noted that the proposal request includes at least one of the following items: synchronization block and signature scheme.
Illustratively, the apparatus may further include:
and the storage module is used for recording the synchronous signature as transaction data in the block and then storing the index data of the synchronous group in a local synchronous group index table.
Illustratively, the apparatus may further include:
the query module is used for querying the index data of the synchronization group in a local synchronization group index table; or initiating a synchronization group query transaction request, and requesting the current block generation node to traverse the block chain from back to front to query the synchronization group.
Illustratively, the sync block determination module 1120 may be specifically configured to perform at least one of the following operations:
establishing a transaction request according to the synchronization group, and determining a current block as a synchronization block of the synchronization group;
establishing a transaction request according to the synchronization group, and determining a current block and at least one continuous block in the preamble as a synchronization block of the synchronization group;
and determining continuous blocks starting from the first block to the current block as the synchronous blocks of the synchronous group according to the synchronous group creating transaction request.
And determining a target block according to a target block determination condition in the synchronization group creation transaction request, and taking the target block as a synchronization block of the synchronization group.
Wherein the target block determination condition may include at least one of: setting a block of a serial number; including setting blocks of transaction data; and setting the block generated by the block generation node.
For example, the synchronization signature determination module 1130 may be specifically configured to perform at least one of the following operations:
sequentially stringing the block identifications of all the synchronous blocks together, and performing signature calculation to form a synchronous signature of the currently created synchronous group;
establishing a Meckel tree for the block identifier of each synchronous block, and taking the root of the Meckel tree as a synchronous signature;
signing the block header data of each synchronous block to form sub-signatures, establishing a Merkel tree by adopting each sub-signature, and taking the root of the Merkel tree as a synchronous signature;
and performing signature calculation according to the synchronization block of the currently created synchronization group and the synchronization signature of at least one existing synchronization group to form the synchronization signature of the currently created synchronization group.
For example, the sync signature determination module 1130 may be further configured to:
and determining the synchronous signature of the synchronous group according to the synchronous block and the identification of the initiating node for initiating the establishment of the synchronous group.
For example, the sync signature determination module 1130 may be further configured to:
determining a synchronization signature of a synchronization group according to the synchronization block and associated information, wherein the associated information comprises at least one of the following items: creator information and creation time information.
Illustratively, the recording module 1140 is specifically configured to:
taking the synchronous signature as transaction data through the current block generation node, and recording the transaction data in the current block; and sending the current block to other nodes for verification.
Example twelve
Fig. 12 is a schematic structural diagram of a data processing apparatus of a block chain according to a twelfth embodiment of the present invention, where the apparatus may be configured in a block chain node, and may execute a data verification method of a block chain according to any embodiment of the present invention, and has functional modules and beneficial effects corresponding to the execution method. As shown in fig. 12, the apparatus includes:
a transaction request initiating module 1210 for initiating a synchronization group creation transaction request if a synchronization group usage requirement is generated;
the transaction request transmission module 1220 is configured to transmit the synchronization group creation transaction request to the blockchain network, so as to request the current block generation node to process according to the synchronization group creation transaction request, determine the synchronization block included in the synchronization group, determine the synchronization signature of the synchronization group according to the synchronization block, and record the synchronization signature as transaction data in the block.
According to the technical scheme provided by the embodiment of the invention, when a synchronization group is required to be used for block data synchronization, verification or query and the like, any node in a block chain can send a synchronization group creation transaction request to a block chain network in real time to request a current block generation node to execute the creation operation of the synchronization group, so that the creation of the synchronization group can be created in real time according to actual conditions, and the method has flexibility.
Exemplary synchronization group usage requirements include: block synchronization requirements, block data query requirements, or block data verification requirements.
Illustratively, the transaction request initiation module 1210 may be configured to:
and taking the synchronous group creation transaction request as an intelligent contract carried in the synchronous group creation proposal request for initiation.
EXAMPLE thirteen
Fig. 13 is a schematic structural diagram of an apparatus according to a thirteenth embodiment of the present invention. FIG. 13 illustrates a block diagram of an exemplary device 12 suitable for use in implementing embodiments of the present invention. The device 12 shown in fig. 13 is only an example and should not bring any limitation to the function and the scope of use of the embodiment of the present invention. Device 12 is typically a computing device that assumes the functionality of a blockchain network node.
As shown in FIG. 13, device 12 is embodied in the form of a general purpose computing device. The components of device 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 that couples various system components including the system memory 28 and the processing unit 16.
Bus 18 represents one or more of any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, and a processor or local bus using any of a variety of bus architectures. By way of example, such architectures include, but are not limited to, Industry Standard Architecture (ISA) bus, micro-channel architecture (MAC) bus, enhanced ISA bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
Device 12 typically includes a variety of computer system readable media. Such media may be any available media that is accessible by device 12 and includes both volatile and nonvolatile media, removable and non-removable media.
The system memory 28 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM)30 and/or cache memory. Device 12 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 34 may be used to read from and write to non-removable, nonvolatile magnetic media (not shown in FIG. 13, commonly referred to as a "hard drive"). Although not shown in FIG. 13, a magnetic disk drive for reading from and writing to a removable, nonvolatile magnetic disk (e.g., a "floppy disk") and an optical disk drive for reading from or writing to a removable, nonvolatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 18 by one or more data media interfaces. System memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to carry out the functions of embodiments of the invention.
A program/utility 40 having a set (at least one) of program modules 42 may be stored, for example, in system memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which examples or some combination thereof may comprise an implementation of a network environment. Program modules 42 generally carry out the functions and/or methodologies of the described embodiments of the invention.
Device 12 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), with one or more devices that enable a user to interact with device 12, and/or with any devices (e.g., network card, modem, etc.) that enable device 12 to communicate with one or more other computing devices. Such communication may be through an input/output (I/O) interface 22. Also, the device 12 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the Internet) via the network adapter 20. As shown, the network adapter 20 communicates with the other modules of the device 12 via the bus 18. It should be understood that although not shown in the figures, other hardware and/or software modules may be used in conjunction with device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
The processing unit 16 executes various functional applications and data processing, such as a data processing method of a block chain provided by an embodiment of the present invention, by executing a program stored in the system memory 28.
Example fourteen
The fourteenth embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, can implement the data processing method of the block chain described in the foregoing embodiment. The computer readable storage medium may be configured on a blockchain node.
Computer storage media for embodiments of the invention may employ any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (17)

1. A method for processing data of a blockchain, the method being applied to a blockchain node, the method comprising:
receiving a synchronization group creation transaction request initiated by any node;
determining at least one block as a synchronous block of the synchronous group according to the synchronous group establishing transaction request;
determining a synchronization signature of the synchronization group according to the synchronization block;
taking the synchronous signature as transaction data, recording the transaction data in a block, verifying the synchronous signature when any node in a block chain synchronizes the block chain data, and synchronizing the data by taking the synchronous group as a unit after the verification is passed; wherein the transaction data is obtained by executing a synchronization group creation transaction request.
2. The method of claim 1, wherein after receiving a synchronization group creation transaction request initiated by any node, further comprising:
carrying out authority verification on the initiating node;
and if the authority verification is passed, accepting the synchronization group creation transaction request, and otherwise rejecting the synchronization group creation transaction request.
3. The method of claim 2, wherein performing the authority verification on the originating node comprises:
and verifying the identity of the creator of the synchronization group creation transaction request by adopting the control authority public key.
4. The method of claim 1, wherein receiving a synchrony group creation transaction request initiated by any node comprises:
receiving a synchronous group creation proposal request initiated by any node;
initiating a proposal voting notification according to the proposal request, and requiring other nodes to vote for the creation of the synchronization group;
and receiving a synchronous group creation intelligent contract in the proposal request according to the voting result, and using the intelligent contract as the synchronous group creation transaction request.
5. The method of claim 4, wherein the proposal request includes at least one of: synchronization block and signature scheme.
6. The method of claim 1, wherein recording the synchronization signature as transaction data in a block further comprises:
and storing the index data of the synchronization group in a local synchronization group index table.
7. The method of claim 1, wherein determining at least one chunk from the synchronization group creation transaction request, the operation as a synchronization chunk of the synchronization group comprising at least one of:
determining a current block as a synchronous block of the synchronous group according to the transaction request established by the synchronous group;
determining a current block and at least one continuous block in the preamble according to the synchronization group creation transaction request, and using the current block and the at least one continuous block as a synchronization block of the synchronization group;
determining a continuous block starting from a first block to a current block as a synchronous block of the synchronous group according to the synchronous group establishing transaction request;
and determining a target block according to a target block determination condition in the synchronization group creation transaction request, and taking the target block as a synchronization block of the synchronization group.
8. The method of claim 7, wherein the target block determination condition comprises at least one of:
setting a block of a serial number;
including setting blocks of transaction data;
and setting the block generated by the block generation node.
9. The method of claim 1, wherein determining the synchronization signature for the synchronization group based on the synchronization block comprises at least one of:
sequentially stringing the block identifications of all the synchronous blocks together, and performing signature calculation to form a synchronous signature of the currently created synchronous group;
establishing a Meckel tree for the block identifier of each synchronous block, and taking the root of the Meckel tree as a synchronous signature;
signing the block header data of each synchronous block to form sub-signatures, establishing a Merkel tree by adopting each sub-signature, and taking the root of the Merkel tree as a synchronous signature;
and performing signature calculation according to the synchronization block of the currently created synchronization group and the synchronization signature of at least one existing synchronization group to form the synchronization signature of the currently created synchronization group.
10. The method of claim 1, wherein determining the synchronization signature for the synchronization group based on the synchronization block comprises:
and determining the synchronous signature of the synchronous group according to the synchronous block and the identification of the initiating node for initiating the establishment of the synchronous group.
11. A method for processing data of a blockchain, the method being applied to a blockchain node, the method comprising:
if the synchronous group use requirement is generated, initiating a synchronous group creation transaction request;
transmitting the synchronization group creation transaction request to a blockchain network to request a current block generation node to process according to the synchronization group creation transaction request, determining a synchronization block included in a synchronization group and a synchronization signature of the synchronization group according to the synchronization block, and recording the synchronization signature as transaction data in a block, wherein the transaction data is obtained by executing the synchronization group creation transaction request;
and if the block chain data is to be synchronized, verifying the synchronization signature, and after the verification is passed, performing data synchronization by taking the synchronization group as a unit.
12. The method of claim 11, wherein synchronizing group usage requirements comprises: block synchronization requirements, block data query requirements, or block data verification requirements.
13. The method of claim 11, wherein initiating a synchrony group creation transaction request comprises:
and taking the synchronous group creation transaction request as an intelligent contract carried in the synchronous group creation proposal request for initiation.
14. A data processing apparatus of a block chain, configured in a block chain node, the apparatus comprising:
a transaction request receiving module, configured to receive a synchronization group creation transaction request initiated by any node;
a synchronization block determination module, configured to determine at least one block as a synchronization block of the synchronization group according to the synchronization group creation transaction request;
a synchronous signature determining module, configured to determine a synchronous signature of the synchronization group according to the synchronization block;
and the recording module is used for recording the synchronous signature as transaction data in a block so as to verify the synchronous signature when any node in a block chain synchronizes the block chain data and perform data synchronization by taking the synchronous group as a unit after the verification is passed, wherein the transaction data is obtained by executing a synchronous group creation transaction request.
15. A data processing apparatus of a block chain, configured in a block chain node, the apparatus comprising:
the transaction request initiating module is used for initiating a synchronization group to establish a transaction request if a synchronization group use requirement is generated;
a transaction request transmission module, configured to transmit the synchronization group creation transaction request to a blockchain network, so as to request a current block generation node to process according to the synchronization group creation transaction request, determine a synchronization block included in a synchronization group, determine a synchronization signature of the synchronization group according to the synchronization block, and record the synchronization signature as transaction data in a block, where the transaction data is obtained by executing the synchronization group creation transaction request;
and the data synchronization control module is used for verifying the synchronization signature if the block chain data is to be synchronized, and carrying out data synchronization by taking the synchronization group as a unit after the verification is passed.
16. A computing device, wherein the computing device comprises:
one or more processors;
storage means for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement a method of data processing for a blockchain as in any of claims 1-10 or a method of data processing for a blockchain as in any of claims 11-13.
17. A computer-readable medium, on which a computer program is stored which, when being executed by a processor, carries out the method for data processing of a blockchain according to any one of claims 1 to 10 or the method for data processing of a blockchain according to any one of claims 11 to 13.
CN201811089410.2A 2018-09-18 2018-09-18 Data processing method, device, equipment and medium for block chain Active CN109347803B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811089410.2A CN109347803B (en) 2018-09-18 2018-09-18 Data processing method, device, equipment and medium for block chain

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811089410.2A CN109347803B (en) 2018-09-18 2018-09-18 Data processing method, device, equipment and medium for block chain

Publications (2)

Publication Number Publication Date
CN109347803A CN109347803A (en) 2019-02-15
CN109347803B true CN109347803B (en) 2021-08-17

Family

ID=65306057

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811089410.2A Active CN109347803B (en) 2018-09-18 2018-09-18 Data processing method, device, equipment and medium for block chain

Country Status (1)

Country Link
CN (1) CN109347803B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109951488B (en) * 2019-03-27 2022-01-07 百度在线网络技术(北京)有限公司 Method, device, equipment and storage medium for realizing service of content distribution network
CN110377401B (en) * 2019-07-17 2022-10-04 江苏满运软件科技有限公司 Transaction request processing method, device, server and storage medium based on IDEA
CN111126958B (en) * 2019-12-23 2023-09-26 腾讯科技(深圳)有限公司 Schedule creation method, schedule creation device, schedule creation equipment and storage medium
CN111371557B (en) * 2020-02-26 2024-01-23 百度在线网络技术(北京)有限公司 Block chain data processing method and device, electronic equipment and medium

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108023896A (en) * 2017-12-28 2018-05-11 江苏通付盾科技有限公司 Block synchronous method and system

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10348484B2 (en) * 2016-10-24 2019-07-09 Mastercard International Incorporated Method and system for fast tracking navigation of blockchains via data manipulation
KR101930825B1 (en) * 2017-01-23 2018-12-19 주식회사 데일리인텔리전스 System and method for authenticating users and synchronizing blocks using a block-chain network
CN108234134B (en) * 2017-12-28 2020-09-29 江苏通付盾科技有限公司 Block synchronization method and system

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108023896A (en) * 2017-12-28 2018-05-11 江苏通付盾科技有限公司 Block synchronous method and system

Also Published As

Publication number Publication date
CN109347803A (en) 2019-02-15

Similar Documents

Publication Publication Date Title
CN109361734B (en) Data processing method, device, equipment and medium for block chain
CN109241192B (en) Data modification and block verification method, device, equipment and medium for block chain
CN109213901B (en) Data synchronization method, device, equipment and medium of block chain
CN109347803B (en) Data processing method, device, equipment and medium for block chain
CN108664223B (en) Distributed storage method and device, computer equipment and storage medium
CN108961052B (en) Verification method, storage method, device, equipment and medium of block chain data
CN109587238B (en) Data processing and synchronizing method, device, equipment and storage medium of block chain
CN109361740B (en) Block generation method, device, equipment and medium of block chain
CN107888562B (en) Data verification and transceiving method, node and system for parallel link access to interconnection chain
CN109542888B (en) Data modification and synchronization method, device, equipment and storage medium of block chain
CN108596588B (en) Block data processing method and device, computing equipment and storage medium
CN108769171B (en) Copy keeping verification method, device, equipment and storage medium for distributed storage
CN109981297B (en) Block chain processing method, device, equipment and storage medium
CN110099064B (en) File processing method, device, equipment and storage medium based on Internet of things
WO2018112940A1 (en) Service execution method and device for blockchain node, and node device
CN109344631B (en) Data modification and block verification method, device, equipment and medium for block chain
CN111786812B (en) Node management method, device, computer equipment and storage medium
CN109194669B (en) Data transmission method, device, equipment and medium of lightweight node
CN109345243B (en) Data processing and verifying method, device, equipment and medium for block chain
CN110740038B (en) Blockchain and communication method, gateway, communication system and storage medium thereof
CN109254999B (en) Data processing method, device, equipment and medium for block chain
US20190258610A1 (en) Byzantine fault-tolerant algorithm with four steps
CN113225351B (en) Request processing method and device, storage medium and electronic equipment
CN110620776B (en) Data transfer information transmission method and device
CN111327680B (en) Authentication data synchronization method, device, system, computer equipment and storage medium

Legal Events

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