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

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

Info

Publication number
CN109345243B
CN109345243B CN201811089898.9A CN201811089898A CN109345243B CN 109345243 B CN109345243 B CN 109345243B CN 201811089898 A CN201811089898 A CN 201811089898A CN 109345243 B CN109345243 B CN 109345243B
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
CN201811089898.9A
Other languages
Chinese (zh)
Other versions
CN109345243A (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.)
Baidu Online Network Technology Beijing Co Ltd
Original Assignee
Baidu Online Network Technology Beijing 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 Baidu Online Network Technology Beijing Co Ltd filed Critical Baidu Online Network Technology Beijing Co Ltd
Priority to CN201811089898.9A priority Critical patent/CN109345243B/en
Publication of CN109345243A publication Critical patent/CN109345243A/en
Application granted granted Critical
Publication of CN109345243B publication Critical patent/CN109345243B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3825Use of electronic signatures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange

Landscapes

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

Abstract

The embodiment of the invention discloses a method, a device, equipment and a medium for processing and verifying data of a block chain. The data processing method of the block chain is applied to the block chain nodes, and comprises the following steps: acquiring a synchronization group creation transaction request; 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. By the technical scheme of the embodiment of the invention, the synchronous signature is stored in the block as 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 and verifying 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 and verifying 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 and verifying method, device, equipment and medium of a block chain, which are used for optimizing a verifying 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:
acquiring a synchronization group creation transaction request;
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 verification method for a block chain, which is applied to a block chain node, and includes:
if the synchronous group use requirement is generated, inquiring and acquiring a matched synchronous group, and inquiring a synchronous signature of the synchronous group from a block;
acquiring a synchronization block of the synchronization group;
calculating a synchronous signature according to the synchronous block in the synchronous group, and comparing and verifying the synchronous signature with the obtained synchronous signature;
and if the verification is passed, determining that the synchronization block of the synchronization group passes the verification.
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:
the transaction request acquisition module is used for acquiring a synchronization group creation transaction request;
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 verification apparatus for a blockchain, where the data verification apparatus is configured in a blockchain node, and the apparatus includes:
the synchronous signature acquisition module is used for inquiring and acquiring a matched synchronous group and inquiring a synchronous signature of the synchronous group from a block if a synchronous group use requirement is generated;
a synchronization block acquisition module, configured to acquire a synchronization block of the synchronization group;
the signature verification module is used for calculating a synchronous signature according to the synchronous blocks in the synchronous group and comparing and verifying the synchronous signature with the acquired synchronous signature;
and the verification passing determination module is used for determining that the synchronization block of the synchronization group passes verification if the verification passes.
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 implement the data verification 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 verification method of the blockchain according to the second aspect.
According to the data processing method, the data verification device, the data processing equipment and the data verification medium of the block chain, provided by the embodiment of the invention, after the transaction request of the synchronization group is acquired, the synchronization group is established according to the transaction request of the synchronization group, 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 that the synchronization signature is tampered 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 processing method of a blockchain according to a tenth embodiment of the present invention;
fig. 11 is a flowchart of a data verification method for a blockchain according to an eleventh embodiment of the present invention;
fig. 12 is a flowchart of a data verification method for a blockchain according to a twelfth embodiment of the present invention;
fig. 13 is a flowchart of a data verification method for a blockchain according to a thirteenth embodiment of the present invention;
fig. 14 is a flowchart of a data verification method for a blockchain according to a fourteenth embodiment of the present invention;
fig. 15 is a schematic structural diagram of a data processing apparatus of a block chain according to a fifteenth embodiment of the present invention;
fig. 16 is a schematic structural diagram of a block chain data verification apparatus according to a sixteenth embodiment of the present invention;
fig. 17 is a schematic structural diagram of an apparatus provided in seventeenth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the 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 scheme of the embodiment of the invention is applied to the blockchain node, and the method can be executed by a data processing device of the blockchain, and the device can be realized in a software and/or hardware mode and can be integrated in a computing device for bearing the blockchain node. Referring to fig. 1, the method specifically includes:
s110, acquiring a synchronization group creating transaction request.
Wherein, the synchronization group is composed of one or more blocks; the synchronization group creation transaction request refers to a transaction request for creating a synchronization group, and 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. The local node can receive a synchronization group creation transaction request initiated by other nodes in the block chain network, and can also locally initiate the synchronization group creation transaction request.
It should be noted that the local node may be a current block generation node, or may be another block chain node; whether the local node is generated for the current block or not and the mode for acquiring the synchronous group created transaction request are different. Specifically, if the local node is the current block generation node, the synchronization group creation transaction request may be acquired in the following manner: 1) receiving a synchronization group creation transaction request initiated by any node in a block chain network in real time; 2) when detecting that the current state of the block chain meets a synchronization group creation rule stored in local deployment data or a historical block, the local node locally initiates a synchronization group creation transaction request; 3) when the local node needs the synchronization group to carry out block data synchronization, the local node locally initiates a synchronization group creation transaction request.
Correspondingly, if the local node is the other blockchain node, the synchronization group creation transaction request can be acquired in the following way: 1) receiving a synchronization group creation transaction request initiated by any node in a block chain network in real time; 2) receiving a synchronization group creation transaction request initiated by a current block generation node; 3) when the local node needs the synchronization group to carry out block data synchronization, the local node locally initiates a synchronization group creation transaction request.
In order to ensure the security and reliability of the block data, the acquiring of the synchronization group creation transaction request may further include: and verifying the identity of the creator of the synchronization group creation transaction request by adopting the control authority public key.
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. 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.
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 synchronization group, and may be information representing a synchronization block included in the synchronization group. 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 network, 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.
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 synchronization signature of the synchronization 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, the 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, determine 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 the transaction request for creating the synchronization group is obtained, the synchronization group is created according to the transaction request for creating the synchronization group, 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.
Example two
Fig. 2 is a flowchart of a data processing method of a blockchain according to a second embodiment of the present invention, where this embodiment provides a way to acquire a synchronization group creation transaction request based on the above embodiments, and this embodiment creates a synchronization group based on deployment data of blockchain nodes. Referring to fig. 2, the method specifically includes:
s210, if the current state is identified to meet the synchronization group creation rule in the local deployment data, a synchronization group creation transaction request is initiated.
The current state refers to a current state of the blockchain network, and may include at least one of a current time and a current block height. The current time refers to the current local time of the local node; the block height is the sequence number of the current block of the block chain; the current block height refers to the current block number of the block chain network and the like; the local deployment data refers to an operation rule of a locally deployed blockchain network when a local node participates in the blockchain network; the local deployment data may include synchronization group creation rules, distribution mechanisms, reward and penalty mechanisms, and the like. It should be noted that the local deployment data may be stored locally in the local node. It may also be stored in the founder block, i.e., the 0 th block of the block chain. And the deployment data can be submitted to a blockchain network in the form of an intelligent contract and stored in a certain block, and the synchronous group creation rule in the deployment data can be executed periodically.
The synchronization group creation rule refers to a condition that needs to be satisfied for creating the same group. Optionally, the synchronization group creation rule may include at least one of:
1) the current time meets a preset time value; 2) the current block height satisfies a predetermined block height interval, etc. The preset time value refers to a preset fixed time point or a preset time period for creating a synchronization group, for example, a synchronization group is created every 10 minutes, or a synchronization group is created every whole time point, and the like; the predetermined block height interval refers to a predetermined block height period for creating a sync group, for example, a sync group is created every 100 blocks.
Specifically, if the current time is identified by the local node to meet the preset time value for creating the synchronization group in the local deployment data, a synchronization group creation transaction request is initiated. For example, the preset time value is every 10 minutes, and when the local node recognizes that the difference value of the current time minus the last synchronization group creation time is equal to 10 minutes, a synchronization group creation transaction request is initiated. Or if the local node identifies that the current block height meets a preset block height interval for creating the synchronization group in the local deployment data, initiating a synchronization group creation transaction request. For example, the predetermined block height interval is 100 blocks, and when the local node recognizes that the current block height satisfies the predetermined block height interval, the local node initiates a synchronization group creation transaction request. Or if the current time and the current block height respectively satisfy the preset time and the preset block height interval of the synchronous creation in the local deployment data, initiating a synchronous group creation transaction request.
It should be noted that the local node in this embodiment generates a node for the current block or a node dedicated to supervising the creation of the synchronization group.
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.
According to the technical scheme provided by the embodiment of the invention, when the block chain nodes are added into the block chain network, the synchronization group creation rule is added into the local deployment data, so that the creation orderliness of the synchronization group and the running rationality of the block chain network are ensured; and when the current state of the block chain is identified to meet the synchronization group creation rule, the synchronization group creation request can be automatically initiated, and a new thought is provided for acquiring the synchronization group creation transaction request.
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, where this embodiment provides a manner of obtaining a synchronization group creation transaction request based on the above embodiment, and the technical solution of this embodiment is applicable to determining a synchronization group creation rule in an intelligent contract manner. Referring to fig. 3, the method specifically includes:
s310, if the current state is identified to meet the synchronization group creation rule stored in the history block, a synchronization group creation transaction request is initiated.
In this embodiment, the synchronization group creation rules may be written to the blocks as transaction data in the form of an intelligent contract, or other form that is approved by the blockchain network. Optionally, the synchronization group creation rule may include at least one of that the current time satisfies a preset time value and that the current block height satisfies a preset block height interval.
Specifically, the local node may traverse the history block to obtain the synchronization group creation rule, or may set a trigger notification mechanism when the history block stores the synchronization group creation rule, and notify the current block generation node to query and obtain the synchronization group creation rule. And when the local node identifies that the current state of the block chain meets the synchronization group creation rule stored in the history block, initiating a synchronization group creation transaction request.
S320, according to the transaction request created by the synchronization group, at least one block is determined as the synchronization block of the synchronization group.
S330, determining the synchronous signature of the synchronous group according to the synchronous block.
S340, recording the synchronization signature as transaction data in the block.
According to the technical scheme provided by the embodiment of the invention, the synchronization group creation rule is stored in the block, so that the non-tamper property and the transparency of the synchronization group creation rule are ensured, and when the current state of the block chain is identified to meet the synchronization group creation rule by the block chain node, the synchronization group creation request can be automatically initiated, so that a new thought is provided for acquiring the synchronization group creation transaction request.
Illustratively, the get synchronization group create transaction request may also be made in several ways:
1) if a synchronization group usage requirement is generated, a synchronization group creation transaction request is initiated.
The synchronization group use requirement refers to a requirement generated when the synchronization group needs to be used; the synchronization group usage requirement may include blocks 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; the method can also comprise the following steps: if the data in the blockchain needs to be modified locally, a synchronization group usage requirement is generated, etc.
Specifically, when the local node is a node newly added to the blockchain, or the local node loses part or all of the blocks of the blockchain of the local node due to communication quality or other factors such as malicious attack, the local node needs to synchronize the blockchain, and a synchronization group use requirement is locally generated; the local node can initiate a synchronization group creation transaction request according to the synchronization group use requirement; the local node can also send a synchronization group use requirement request to the current block generation node, or the current block generation node detects that the local node generates the synchronization group use requirement, and the current block generation node initiates a synchronization group creation transaction request.
2) Receiving a synchronous group creating transaction request initiated by any node in real time. Any node can be any node with synchronization requirement in the block chain, and can also be any node with super authority; but also the current tile generating node, etc. Specifically, the local node may obtain the synchronization group creation transaction request by receiving the synchronization group creation transaction request initiated by any node in the block chain in real time.
3) And any node in the block chain initiates a synchronization group creation transaction request if the synchronization group needs to be used locally and a synchronization group matched with the synchronization group is not inquired after traversing the block chain.
The synchronization group creation transaction request initiated by the node may carry a synchronization group creation rule, where the creation rule may specify a rule for creating a synchronization group at the current time, or may specify a rule for continuously creating a synchronization group subsequently, that is, the synchronization group creation rule is stored in a block and used as a synchronization group creation rule in a subsequent history block.
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, which is further optimized based on the foregoing embodiments in this embodiment, and this embodiment provides an index manner of a synchronization group. Referring to fig. 4, the method specifically includes:
s410, acquiring a synchronous group creating transaction request.
S420, according to the transaction request created by the synchronization group, at least one block is determined 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.
S450, 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 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 optimizes a manner in which a local node obtains a synchronization group creation transaction request by receiving the synchronization group creation transaction request initiated by any node in real time based on the foregoing embodiment. Referring to fig. 5, the method specifically includes:
s510, 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.
S520, initiating a proposal voting notification according to the proposal request, and requiring other nodes to vote for the creation of the synchronization group.
And S530, determining the performability of the synchronization group creation transaction request in the proposal request according to the voting result.
The current block generation 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.
And S540, receiving a synchronization group creation transaction request initiated by any node in real time.
In particular, upon determining that a synchrony group creation transaction request in a proposal request is approved, an associated synchrony group creation transaction request may be accepted, which may typically be carried in a synchrony group creation proposal request.
S550, 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 S560, determining the synchronous signature of the synchronous group according to the synchronous block.
S570, recording the synchronization signature as transaction data in the block.
According to the technical scheme provided by the embodiment of the invention, before the synchronous group creation transaction request is acquired, the synchronous group creation proposal request is voted based on a consensus mechanism of a block chain network, and after the synchronous group creation transaction request in the proposal request is approved, the subsequent synchronous group creation process is executed.
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 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. 6, the method specifically includes:
s610, acquiring a synchronization group creating transaction request.
S620, according to the transaction request created by the synchronization group, a block is determined as the synchronization block of the synchronization group.
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 linkage 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.
Specifically, after acquiring the synchronization group creation transaction request, the local node may perform query in the block chain according to a block identifier or an identifier of specific transaction data included in the synchronization group creation transaction request, and if the block identifier or the identifier is correct, determine the 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 network.
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, and the last block and the first block determined according to the two synchronization points are the same block, and the block is used as the synchronization block of the synchronization group.
It should be noted that the local node may also default to the current chunk as the sync chunk of the sync 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 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 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 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. 7, the method specifically includes:
s710, acquiring a synchronization group creating transaction request.
S720, according to the transaction request created by the synchronization group, at least two non-continuous blocks are determined as the synchronization blocks of the synchronization group.
The non-consecutive blocks refer to two blocks with non-consecutive numbers, for example, the 1 st block and the 3 rd block in the block chain are two non-consecutive blocks; the 1 st, 3 rd and 4 th blocks are also discontinuous. It should be noted that if there are two blocks that are non-consecutive, then at least two blocks are also non-consecutive.
Optionally, if the synchronization group that the local node or another node needs to create is composed of at least two non-continuous blocks, the block identifier that needs to be synchronized may be obtained according to the requirement, and the synchronization group creation transaction request including the block identifier that needs to be synchronized is initiated. Specifically, after acquiring the synchronization group creation transaction request, the local node may search in a block chain according to a block identifier required by the synchronization group included in the synchronization group creation transaction request; if the two blocks exist and are correct, the block corresponding to each block identifier is used as a synchronous block of the synchronous group; if at least one block identifier does not exist or is incorrect in the block identifiers required by the synchronization group, the synchronization group creation transaction request can be regarded as invalid, and the local node sends invalid information comprising the synchronization group creation transaction request to the blockchain network; if at least one block identifier does not exist or is incorrect in the block identifiers required by the synchronization group, only invalid block identifiers in the synchronization group creation transaction request can be sent to the blockchain network.
If the synchronization group which the local node or other nodes need to create is composed of at least two discontinuous blocks, and at least two discontinuous blocks store a certain type of transaction data, a synchronization group creation transaction request including a transaction data identifier can be initiated. Specifically, after the local node acquires the synchronization group creation transaction request, it may search in the block chain according to the transaction data identifier included in the synchronization group creation transaction request, and determine at least two non-continuous blocks as the synchronization blocks of the synchronization group.
In addition, if the synchronization group that the local node or other nodes need to create is composed of at least two non-continuous blocks, multiple pairs of synchronization points may be set, for example, if a pair of synchronization points is set at each block position where it is needed, for example, if the needed blocks are the 1 st block, the 3 rd block, and the 8 th block, a pair of synchronization points may be set at each block position; if the required blocks are the 1 st to 3 rd blocks and the 5 th to 8 th blocks, a synchronization point can be respectively arranged at the 1 st and 3 rd blocks as a pair of synchronization points; one synchronization point is set at each of the 5 th and 8 th blocks as another pair of synchronization points. The native node or other node initiates a synchrony group creation transaction request that includes the synchrony point. Specifically, after acquiring the synchronization group creation transaction request, the local node may determine at least two non-consecutive blocks as synchronization blocks of the synchronization group according to the synchronization point.
S730, determining a synchronization signature of the synchronization group according to the synchronization block.
S740, recording the synchronization signature as transaction data in the block.
According to the technical scheme provided by the embodiment of the invention, at least two discontinuous blocks are used as a synchronization group, the method is suitable for any node to inquire the data of the blocks, and when other subsequent nodes need the synchronization group, only one time of verifying the synchronization signature of the synchronization group is needed, and each block in the synchronization group is not needed to be verified, so that the verification process is simplified. In addition, the blocks of the synchronization group can be flexibly selected according to actual requirements without discontinuous operation, so that the use flexibility of the synchronization group is further improved; meanwhile, the synchronous group constructed by at least two non-continuous blocks also provides convenience for the inquiry of subsequent specific transaction data and the like.
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 blocks as synchronous blocks of the synchronous group according to the synchronous group creating transaction request.
Wherein the consecutive blocks correspond to non-consecutive blocks. If there is no discontinuity between any two blocks of the at least two blocks, the at least two blocks are contiguous.
Specifically, the local node may also determine at least two consecutive blocks as the synchronization blocks of the synchronization group according to a block identifier or a synchronization point required by the synchronization group included in the synchronization group creation transaction request. For example, the end block and the first 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 first block and the end block may be determined as the synchronization block of the synchronization group; or determining an end block of the synchronization group according to the synchronization point included in the synchronization group creation transaction request, and determining a block including blocks from zero to the end block as the synchronization block of the synchronization group.
It should be noted that, the positions of the synchronization points are different, and the established synchronization groups are different; the number of the synchronization points is different, and the established synchronization groups may be different or the same; there may be an overlap of blocks between different sync groups. For example, the 1 st to 10 th blocks in the block chain are used as the first sync group, the 5 th to 15 th blocks are used as the second sync group, and so on.
In this embodiment, a plurality of blocks form a synchronization group, and other subsequent nodes need to perform a synchronization block chain on the synchronization group, only one time of verifying a synchronization signature of the synchronization group is needed, and each block in the synchronization group does not need to be verified, thereby simplifying the verification process.
2) And determining at least two continuous m-n blocks as synchronous blocks of the synchronous group according to the synchronous group creating transaction request.
3) According to the synchronization group creation transaction request, a continuous block starting from 0 to the current block is determined as a synchronization block of the synchronization group.
Specifically, if the last block of the synchronization group determined according to the synchronization point included in the synchronization group creation transaction request is the current block, the consecutive blocks from 0 to the current block in the block chain may be used as the synchronization block of the synchronization group.
In this embodiment, the synchronization group established from 0 is more suitable for a node newly added in the blockchain network to synchronize the blockchain, 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 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 is based on the foregoing embodiment and further 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. Referring to fig. 8, the method specifically includes:
s810, acquiring a synchronization group creating transaction request.
S820, according to the target block determination 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.
S830, determining a synchronization signature of the synchronization group according to the synchronization block.
S840, recording 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 nine
Fig. 9 is a flowchart of a data processing method of a block chain according to a ninth 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 foregoing embodiments. Referring to fig. 9, the method specifically includes:
s910, acquiring a synchronization group creating transaction request.
S920, according to the synchronization group creation transaction request, at least one block is determined as a synchronization block of the synchronization group.
S930, the block identifications of the synchronous blocks are sequentially concatenated together for 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.
S940, the synchronization signature is recorded in the block as transaction data.
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 ten
Fig. 10 is a flowchart of a data processing method of a block chain according to a tenth embodiment of the present invention, and this embodiment further provides a way to determine a synchronization signature of a synchronization group according to a synchronization block based on the foregoing embodiment. Referring to fig. 10, the method specifically includes:
s1010, acquiring a synchronization group creating transaction request.
S1020, determining at least one block as a synchronization block of the synchronization group according to the synchronization group creation transaction request.
And S1030, 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.
S1040, the synchronization signature is recorded in the block as transaction data.
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 eleven
Fig. 11 is a flowchart of a data verification method for a block chain according to an eleventh embodiment of the present invention, where this embodiment provides a data verification method for a block chain having a synchronization group, where the synchronization group may be created by using 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. 11, the method specifically includes:
s1110, if the synchronous group use requirement is generated, inquiring and acquiring the matched synchronous group, and inquiring the synchronous signature of the synchronous group from the block.
The synchronous group use requirement refers to a requirement generated when the synchronous group needs to be used; the synchronization group usage requirement may indicate blocks or transaction data, etc. included in the required synchronization group.
Specifically, if the local node has a synchronization group use requirement, the index data of the synchronization group may be queried in a locally stored synchronization group index table, or a synchronization group query transaction request is initiated to request the current block generation node to traverse the block chain from back to front to query the synchronization group; if the matched synchronization group is inquired, the block data of the synchronization group, the synchronization signature or the block identifier where the synchronization signature is located and the like can be acquired; if a matching synchrony group is not queried, a synchrony group creation transaction request including the desired synchrony group may be initiated to obtain the synchrony group.
Inquiring the synchronous signature of the synchronous group from the block chain, specifically, inquiring the index data of the synchronous group from a local synchronous group index table, acquiring the block identification where the synchronous signature is located according to the index data, and acquiring the synchronous signature of the synchronous group from the block chain; if the block data of the synchronization group contains the synchronization signature of the synchronization group, the synchronization signature of the synchronization group can be directly obtained from the block data; if the index data of the synchronization group is not searched in the local synchronization group index table and the block data of the synchronization group does not have the synchronization signature of the synchronization group, a synchronization group query transaction request can be initiated to request the current block generation node to traverse the block chain from back to front to query the synchronization group, so that the synchronization signature of the synchronization group is obtained.
S1120, obtain a sync block of the sync group.
The synchronization blocks of the synchronization group may be acquired from other nodes.
S1130, the synchronous signature is calculated according to the synchronous blocks in the synchronous group, and the synchronous signature is compared with the acquired synchronous signature for verification.
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 also has different manners of calculating the synchronization signature according to the synchronization block, and the subsequent embodiments will describe the calculation of the synchronization signature according to the synchronization block in detail.
Specifically, the synchronous signature may be calculated in the same signature manner as the matched synchronization group according to the block identifier or the block header data of each synchronization block in the synchronization group, and the calculated synchronous signature may be compared with the acquired synchronous signature; if the two are the same, determining that the synchronous signature passes verification; and if not, determining that the synchronous signature of the synchronous group is not verified.
S1140, if the verification is passed, it is determined that the sync block of the sync 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. The verification of the synchronization signature may directly replace the block id verification function of the synchronization block, or may set the verification priority of the synchronization signature higher than the verification priority of the synchronization block.
According to the technical scheme provided by the embodiment of the invention, the synchronous signature of the synchronous group is stored in the block, when the synchronous group is required to be used, only one synchronous signature of the synchronous group is required to be verified, and the block identification of each synchronous block is not required to be verified one by one, so that the verification process is simplified.
Example twelve
Fig. 12 is a flowchart of a data verification method for a blockchain according to a twelfth embodiment of the present invention, where this embodiment provides a solution applicable to a scenario where any node performs data synchronization from other nodes in a blockchain network based on the foregoing embodiment. Specifically, the synchronization group usage requirement in this embodiment is a block data synchronization requirement, and acquiring the synchronization block of the synchronization group includes: and initiating a synchronization group synchronization request to other nodes, and receiving block data of the synchronization group fed back by other nodes. Referring to fig. 12, the method specifically includes:
s1210, when a block data synchronization requirement is generated, determining a synchronization group in which a block to be synchronized is located, and acquiring a synchronization signature of the synchronization group from the block.
In this embodiment, the block data synchronization requirement refers to a requirement generated when a node in a block chain needs to perform block data synchronization, and the block data synchronization requirement may include a block identifier that needs to be synchronized.
Optionally, generating the block data synchronization requirement may include: if the local node is a node newly added into the block chain, or if the local node lacks part or all blocks of the block chain of the local node due to communication quality or other factors such as malicious attack, the block chain needs to be downloaded locally and synchronously, and a block data synchronization requirement is generated.
Specifically, when the local node generates a block data synchronization requirement, a synchronization group can be searched in a locally maintained index table or a block chain according to a block identifier required to be synchronized included in the block data synchronization requirement, and if a matched synchronization group is searched, the matched synchronization group is determined as a synchronization group in which the block required 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.
Optionally, the method may further include: if it is determined that the block to be synchronized does not have a matching synchronization group, a synchronization 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.
S1220, initiating a synchronization group synchronization request to another node, and receiving block data of a synchronization group fed back by the other node.
The synchronization group synchronization request refers to a request initiated by a node in a block chain when the synchronization group synchronization block chain needs to be used. The block chain node can also directly initiate a block synchronization request, and a node processing the synchronization request performs synchronization group query or creation.
And S1230, calculating a synchronous signature according to the synchronous block, and comparing and verifying the synchronous signature with the acquired synchronous signature.
And S1240, 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.
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 thirteen
Fig. 13 is a flowchart of a data verification method for a block chain according to a thirteenth embodiment of the present invention, and this embodiment further explains, on the basis of the foregoing embodiment, that a matching synchronization group is obtained by querying, and a synchronization signature of the synchronization group is queried from a block. Referring to fig. 13, the method specifically includes:
s1310, if the synchronous group use requirement is generated, searching the index data of the synchronous group in the local synchronous group index table, and acquiring a synchronous signature from the block chain according to the index data.
The index data is used for assisting the local node to quickly find the synchronous 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, when a local node needs synchronization of a synchronization group, if a synchronization group index table is locally stored, the local node can query the local synchronization group index table according to a block identifier to be synchronized, if a synchronization group matched with the block to be synchronized exists, index data of the synchronization group can be acquired, and if the index data includes a synchronization signature of the synchronization group, the synchronization signature of the synchronization group can be directly acquired; if not, the block identifier where the synchronization signature is located can be obtained according to the index data, and the synchronization signature of the synchronization group is obtained from the block chain.
S1320, obtain the sync block of the sync group.
S1330, calculating a synchronization signature according to the synchronization block, and comparing the synchronization signature with the obtained synchronization signature for verification.
S1340, if the verification is passed, determining that the sync block of the sync group is verified.
According to the technical scheme provided by the embodiment of the invention, the nodes in the block chain can quickly acquire related index data such as synchronous signatures of the synchronous groups through the synchronous group index table by locally maintaining the synchronous group index table when the synchronous groups are required to be used for synchronization; and then comparing and verifying the synchronous signature obtained by calculation according to the synchronous block with the synchronous signature obtained from the block, without verifying the block identifier of each synchronous block one by one.
If the local node does not locally store the synchronization group index table or the local node cannot query the local synchronization group index table at present, other nodes in the block chain can be requested to query and feed back. For example, determining a synchronization group in which the block to be synchronized is located, and acquiring a synchronization signature of the synchronization group from the block may further include: 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 and a synchronization signature; a synchronization signature of the feedback is received. 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.
Specifically, the local node sends 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 to query the synchronization group and the synchronization signature; after the synchronous group and the synchronous signature of the synchronous group are inquired by the current block generation node, the synchronous signature of the synchronous group is fed back to the local node. 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. Traversing the query synchronization group from back to front is a synchronization group that can ensure that the queried associated synchronization group is the last to take effect.
According to the technical scheme provided by the embodiment of the invention, the local node can perform communication interaction with the current block generation node, so that the synchronous signature of the synchronous group is obtained. The present implementation provides a scheme for a node in a blockchain to obtain a synchronization signature for a synchronization group.
If the block data acquired by the local node contains the signature of the synchronization group, the synchronization signature of the synchronization group can be directly acquired from the block data. For example, obtaining the synchronization signature of the synchronization group from the chunk may further include: a synchronization signature is obtained from the received tile data.
Example fourteen
Fig. 14 is a flowchart of a data verification method for a block chain according to a fourteenth embodiment of the present invention, and the present embodiment further explains the calculation of a synchronization signature according to a synchronization block based on the foregoing embodiments. Referring to fig. 14, the method specifically includes:
and S1410, if the synchronous group use requirement is generated, inquiring to acquire a matched synchronous group, and inquiring a synchronous signature of the synchronous group from the block.
S1420, obtain the sync block of the sync group.
And S1430, sequentially stringing the block identifications of the synchronous blocks together, performing signature calculation to obtain a synchronous signature, and comparing and verifying the synchronous signature with the obtained synchronous signature.
Specifically, the local node may obtain the block identifier of the synchronization block from the block header of each synchronization block according to the block data of the synchronization group fed back by other nodes, connect the block identifiers of the synchronization blocks together according to the arrangement order of the synchronization blocks in the synchronization group as an integral identifier, and perform signature calculation on the integral identifier by using the same signature algorithm as the synchronization group, such as a signature method specified when the synchronization group is created, such as SHA256, to obtain a synchronization signature; comparing the calculated synchronous signature with the synchronous signature obtained from the block, and if the calculated synchronous signature is the same as the synchronous signature obtained from the block, determining that the synchronous signature passes verification; and if not, determining that the synchronous signature of the synchronous group is not verified.
Since the obtained synchronization groups have different synchronization signature manners, and the local node also has different manners of calculating the synchronization signature according to the synchronization block, for example, calculating the synchronization signature according to the synchronization block may further include at least one of:
1) 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, the local node may obtain a block identifier of each synchronization block from a block header of the synchronization block according to block data of the synchronization group fed back by other nodes, generate a mekerr tree by using a mekerr tree algorithm according to the block identifier of each synchronization block, and use a root of the mekerr tree as a synchronization signature of the synchronization group.
2) And 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, the local node may obtain the block header data of the synchronization block from the block header of each synchronization block according to the block data of the synchronization group fed back by other nodes, perform sub-signature on the block header data of each synchronization block in a signature manner such as hash signature, generate a mekerr tree by using a mekerr tree algorithm according to each sub-signature, and use the root of the mekerr tree as the synchronization signature of the synchronization group.
3) And performing signature calculation according to the synchronization block of the current synchronization group and the synchronization signature of at least one existing synchronization group to form the synchronization signature of the current synchronization group.
If the creator of the synchronization group is to further improve the security of the synchronization signature and increase the reliability of the synchronization signature, creator information and creation time information are added when determining the synchronization signature of the synchronization group according to the synchronization block. For example, when the native node needs to use the synchronization group, determining a 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.
For example, the local node signs the block header data of each synchronization block to form a sub-signature, generates a meikerr tree by using a meikerr tree algorithm according to each sub-signature, and then uses the root of the meikerr tree, creator information, and creation time information together as the synchronization signature of the synchronization group. Comparing the calculated synchronous signature with the synchronous signature obtained from the block, and if the calculated synchronous signature is the same as the synchronous signature obtained from the block, determining that the synchronous signature passes verification; and if not, determining that the synchronous signature of the synchronous group is not verified.
S1440, if the verification is passed, it is determined that the sync block of the sync group is verified.
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, only the synchronous signature of the synchronous group needs to be verified once, and the block identification of each synchronous block does not need to be verified one by one, so that the verification process is simplified, and the data synchronization is accelerated.
Example fifteen
Fig. 15 is a schematic structural diagram of a data processing apparatus of a block chain according to a fifteenth 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. 15, the apparatus includes:
a transaction request obtaining module 1510, configured to obtain a synchronization group creation transaction request;
a synchronization block determination module 1520, configured to determine at least one block as a synchronization block of the synchronization group according to the synchronization group creation transaction request;
a synchronization signature determining module 1530, configured to determine a synchronization signature of a synchronization group according to the synchronization block;
a recording module 1540, configured to record the synchronization signature as transaction data in the block.
According to the technical scheme provided by the embodiment of the invention, after the transaction request for creating the synchronization group is obtained, the synchronization group is created according to the transaction request for creating the synchronization group, 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.
Illustratively, the transaction request obtaining module 1510 may be specifically configured to perform at least one of the following operations:
if the current state is identified to meet the synchronization group creation rule in the local deployment data, initiating a synchronization group creation transaction request;
if the current state is identified to meet the synchronization group creation rule stored in the history block, initiating a synchronization group creation transaction request;
receiving a synchronization group creation transaction request initiated by any node in real time;
if a synchronization group usage requirement is generated, a synchronization group creation transaction request is initiated.
It should be noted that the above synchronization group creation rule may include at least one of the following: the current time meets a preset time value; the current block height satisfies the preset block height interval.
Illustratively, the apparatus may further include:
a synchronization group requirement generation module for generating a synchronization group usage requirement if the synchronization blockchain is locally required.
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 apparatus may further include: an enforceability determination module, the enforceability determination module specifically configured to:
receiving a synchronous group creation proposal request initiated by any node before receiving a synchronous group creation transaction request initiated by any node in real time; initiating a proposal voting notification according to the proposal request, and requiring other nodes to vote for the creation of the synchronization group; determining the performability of the synchronous group establishing transaction request in the proposal request according to the voting result; wherein, the proposal request comprises at least one item of the following items: synchronization block and signature scheme.
Illustratively, the apparatus may further include:
and the identity authentication module is used for authenticating the identity of a creator of the synchronization group creation transaction request by adopting the control authority public key after the synchronization group creation transaction request is obtained.
For example, the synchronization block determination module 1520 may be specifically configured to perform at least one of the following operations:
determining a block as a synchronous block of the synchronous group according to the transaction request created by the synchronous group;
establishing a transaction request according to the synchronization group, and determining at least two discontinuous blocks as the synchronization blocks of the synchronization group;
establishing a transaction request according to the synchronization group, and determining at least two continuous blocks as synchronization blocks of the synchronization group;
according to the synchronization group creation transaction request, a continuous block starting from 0 to the current block is determined as a synchronization block of the synchronization group.
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; the block generated by the block generation node is set.
As an example, the sync signature determination module 1530 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 at least one synchronization signature of the existing synchronization group to form the synchronization signature of the currently created synchronization group.
For example, the sync signature determination module 1530 may further be 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 1540 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 sixteen
Fig. 16 is a schematic structural diagram of a block chain data verification apparatus according to a sixteenth embodiment of the present invention, where the apparatus may be configured in a block chain node, and may execute a block chain data verification method 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. 16, the apparatus includes:
a sync signature obtaining module 1610, configured to query and obtain a matching sync group if a sync group usage requirement is generated, and query a sync signature of the sync group from a block;
a sync block acquiring module 1620, configured to acquire a sync block of a sync group;
a signature verification module 1630, configured to calculate a synchronization signature according to the synchronization block in the synchronization group, and compare the synchronization signature with the acquired synchronization signature for verification;
a verification pass determination module 1640 for determining that the sync block of the sync group verifies if the verification passes.
According to the technical scheme provided by the embodiment of the invention, the synchronous signature of the synchronous group is stored in the block, when the synchronous group is required to be used, only one synchronous signature of the synchronous group is required to be verified, and the block identification of each synchronous block is not required to be verified one by one, so that the verification process is simplified.
For example, if the synchronization group usage requirement is a block data synchronization requirement, the synchronization block acquiring module 1620 may be specifically configured to:
and initiating a synchronization group synchronization request to other nodes, and receiving block data of the synchronization group fed back by other nodes.
Illustratively, the apparatus may further include:
and the transaction request sending module is used for initiating a synchronization group to create a transaction request if no matched synchronization group is determined.
For example, the sync signature obtaining module 1610 is specifically configured to, when querying for a sync group for obtaining a match and querying for a sync signature of the sync group from a block:
and inquiring index data of the synchronization group in a local synchronization group index table, and acquiring a synchronization signature from the block chain according to the index data.
For example, the sync signature obtaining module 1610, when configured to query and obtain a matching sync group and query a sync signature of the sync group from a block, is further specifically configured to:
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 and a synchronization signature; a synchronization signature of the feedback is received.
For example, the synchronization signature obtaining module 1610, when being used to query the synchronization signature of the synchronization group from the chunk, may specifically be configured to: and acquiring the synchronous signature from the received block data.
For example, the signature verification module 1630, when configured to compute a synchronization signature from a synchronization block, 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 obtain synchronous signatures;
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 current synchronization group and the synchronization signature of at least one existing synchronization group to form the synchronization signature of the current synchronization group.
Illustratively, the signature verification module 1630, when configured to compute the synchronization signature from the synchronization block, may further be 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.
Example seventeen
Fig. 17 is a schematic structural diagram of an apparatus provided by a seventeenth embodiment of the present invention. FIG. 17 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. 17 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. 17, 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 32. 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. 17 and commonly referred to as a "hard drive"). Although not shown in FIG. 17, 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 programs stored in the system memory 28 to execute various functional applications and data processing, such as a data processing method and/or a data verification method of the block chain provided by the embodiment of the present invention.
EXAMPLE eighteen
Eighteen, an 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 and/or the data verification method of the blockchain described in the foregoing embodiments. 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. Those skilled in the art will appreciate that the present invention is not limited to the particular embodiments described herein, and that various obvious changes, rearrangements and substitutions will now be 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 (20)

1. A method for processing data of a blockchain, the method being applied to a blockchain node, the method comprising:
acquiring a synchronization group creation transaction request;
determining at least one block as a synchronous block of the synchronous group according to the synchronous group establishing transaction request; wherein the synchronization group is composed of one or more blocks; the synchronous block is a block forming a synchronous group;
determining a synchronization signature of the synchronization group according to the synchronization block;
recording the synchronous signature as transaction data in a block;
wherein the operation of obtaining the synchronization group creation transaction request comprises at least one of:
if the current state is identified to meet the synchronization group creation rule stored in the history block, initiating a synchronization group creation transaction request;
if the local needs the synchronous block chain, generating a synchronous group use requirement to initiate a synchronous group creation transaction request; the synchronous group use requirement refers to a requirement generated when a synchronous group needs to be used; the synchronization group usage requirement is used to indicate blocks or transaction data included in the desired synchronization group.
2. The method of claim 1, wherein the synchronization group creation rule comprises at least one of:
the current time meets a preset time value;
the current block height satisfies the preset block height interval.
3. 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.
4. The method of claim 3, further comprising:
searching index data of a synchronization group in a local synchronization group index table; or
And 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.
5. The method of claim 1, wherein after obtaining the synchrony group creation transaction request, further comprising:
and verifying the identity of the creator of the synchronization group creation transaction request by adopting the control authority public key.
6. 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 block as a synchronous block of the synchronous group according to the transaction request created by the synchronous group;
determining at least two discontinuous blocks as synchronous blocks of the synchronous group according to the transaction request created by the synchronous group;
determining at least two continuous blocks as synchronous blocks 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.
7. The method of claim 6, 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.
8. 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.
9. The method of claim 8, wherein determining the synchronization signature for the synchronization group from the synchronization block comprises:
determining a synchronization signature of the synchronization group according to the synchronization block and associated information, wherein the associated information includes at least one of: creator information and creation time information.
10. The method of claim 1, wherein recording the synchronization signature as transaction data in a chunk comprises:
taking the synchronous signature as transaction data through a current block generation node, and recording the transaction data in a current block;
and sending the current block to other nodes for verification.
11. A data verification method of a block chain is applied to a block chain node and comprises the following steps:
if the synchronous group use requirement is generated, inquiring and acquiring a matched synchronous group, and inquiring a synchronous signature of the synchronous group from a block; the synchronous group use requirement refers to a requirement generated when a synchronous group needs to be used; the synchronization group use requirement is used for indicating blocks or transaction data included by the required synchronization group;
acquiring a synchronization block of the synchronization group;
calculating a synchronous signature according to the synchronous blocks in the synchronous group, and comparing and verifying the synchronous signature with the acquired synchronous signature;
if the verification is passed, determining that the synchronization block of the synchronization group passes the verification;
if no matched synchronization group is determined, initiating a synchronization group creation transaction request; wherein the synchronization group creation transaction request is used to determine at least one block as a synchronization block of the synchronization group; wherein the synchronization group is composed of one or more blocks; the sync block is a block constituting a sync group.
12. The method of claim 11, wherein querying for a matching synchronization group and querying for a synchronization signature of the synchronization group from a chunk comprises:
and inquiring index data of the synchronization group in a local synchronization group index table, and acquiring the synchronization signature from the block chain according to the index data.
13. The method of claim 11, wherein querying for a matching synchronization group and querying for a synchronization signature of the synchronization group from a chunk comprises:
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 and a synchronization signature;
a synchronization signature of the feedback is received.
14. The method of claim 11, wherein obtaining the synchronization signature for the synchronization group from the chunk comprises:
and acquiring the synchronous signature from the received block data.
15. The method of claim 11, wherein computing the synchronization signature from the synchronization block comprises at least one of:
sequentially stringing the block identifications of all the synchronous blocks together, and performing signature calculation to obtain synchronous signatures;
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 current synchronization group and the synchronization signature of at least one existing synchronization group to form the synchronization signature of the current synchronization group.
16. The method of claim 13, wherein determining the synchronization signature for the synchronization group based on the synchronization block comprises:
determining a synchronization signature of the synchronization group according to the synchronization block and associated information, wherein the associated information includes at least one of: creator information, and creation time information.
17. A data processing apparatus of a block chain, configured in a block chain node, the apparatus comprising:
the transaction request acquisition module is used for acquiring a synchronization group creation transaction request;
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; wherein the synchronization group is composed of one or more blocks; the synchronous block is a block forming a synchronous group;
a synchronization signature determining module, configured to determine a synchronization signature of the synchronization group according to the synchronization block;
the recording module is used for recording the synchronous signature as transaction data in a block;
the transaction request module is specifically configured to perform at least one of the following operations:
if the current state is identified to meet the synchronization group creation rule stored in the history block, initiating a synchronization group creation transaction request;
if the local needs the synchronous block chain, generating a synchronous group use requirement to initiate a synchronous group creation transaction request; the synchronous group use requirement refers to a requirement generated when a synchronous group needs to be used; the synchronization group usage requirement is used to indicate blocks or transaction data included in the desired synchronization group.
18. An apparatus for data verification of a blockchain, the apparatus being configured in a blockchain node, the apparatus comprising:
the synchronous signature acquisition module is used for inquiring and acquiring a matched synchronous group and inquiring a synchronous signature of the synchronous group from a block if a synchronous group use requirement is generated; the synchronous group use requirement refers to a requirement generated when a synchronous group needs to be used; the synchronization group use requirement is used for indicating blocks or transaction data included by the required synchronization group;
a synchronization block acquisition module, configured to acquire a synchronization block of the synchronization group;
the signature verification module is used for calculating a synchronous signature according to the synchronous block in the synchronous group and comparing and verifying the synchronous signature with the acquired synchronous signature;
the verification passing determining module is used for determining that the synchronization block of the synchronization group passes verification if the verification passes; wherein the synchronization group creation transaction request is used to determine at least one block as a synchronization block of the synchronization group; wherein the synchronization group is composed of one or more blocks; the sync block is a block constituting a sync group.
19. A computing device, the device comprising:
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 validation for a blockchain as in any of claims 11-16.
20. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out a data processing method of a blockchain according to any one of claims 1 to 10 or carries out a data verification method of a blockchain according to any one of claims 11 to 16.
CN201811089898.9A 2018-09-18 2018-09-18 Data processing and verifying method, device, equipment and medium for block chain Active CN109345243B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811089898.9A CN109345243B (en) 2018-09-18 2018-09-18 Data processing and verifying method, device, equipment and medium for block chain

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811089898.9A CN109345243B (en) 2018-09-18 2018-09-18 Data processing and verifying method, device, equipment and medium for block chain

Publications (2)

Publication Number Publication Date
CN109345243A CN109345243A (en) 2019-02-15
CN109345243B true CN109345243B (en) 2022-08-05

Family

ID=65305606

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811089898.9A Active CN109345243B (en) 2018-09-18 2018-09-18 Data processing and verifying method, device, equipment and medium for block chain

Country Status (1)

Country Link
CN (1) CN109345243B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110519260B (en) * 2019-08-23 2020-09-25 联想(北京)有限公司 Information processing method and information processing device
CN111126958B (en) * 2019-12-23 2023-09-26 腾讯科技(深圳)有限公司 Schedule creation method, schedule creation device, schedule creation equipment and storage medium
CN112104719B (en) * 2020-09-03 2021-07-27 腾讯科技(深圳)有限公司 Data processing method and device based on block chain network and storage medium

Citations (2)

* 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
CN108390891A (en) * 2018-03-28 2018-08-10 电子科技大学天府协同创新中心 Information protecting method based on privately owned block chain

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106452785B (en) * 2016-09-29 2019-05-17 财付通支付科技有限公司 Block chain network, branch node and block chain network application method
US10348484B2 (en) * 2016-10-24 2019-07-09 Mastercard International Incorporated Method and system for fast tracking navigation of blockchains via data manipulation
CN107463597B (en) * 2017-03-24 2020-08-21 北京瑞卓喜投科技发展有限公司 Passive verification method and system for block chain of modified block volume data
CN107769925B (en) * 2017-09-15 2020-06-19 山东大学 Public key infrastructure system based on block chain and certificate management method thereof
CN108197891B (en) * 2018-01-05 2021-12-10 法信公证云(厦门)科技有限公司 Electronic signing device and method based on block chain

Patent Citations (2)

* 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
CN108390891A (en) * 2018-03-28 2018-08-10 电子科技大学天府协同创新中心 Information protecting method based on privately owned block chain

Also Published As

Publication number Publication date
CN109345243A (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
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
CN109213901B (en) Data synchronization method, device, equipment and medium of block chain
CN109981297B (en) Block chain processing method, device, equipment and storage medium
CN109347803B (en) Data processing method, device, equipment and medium for block chain
US10069625B2 (en) System and method for automatic key generation for self-encrypting drives
CN109587238B (en) Data processing and synchronizing method, device, equipment and storage medium of block chain
CN109345243B (en) Data processing and verifying method, device, equipment and medium for block chain
US20160191242A1 (en) Storage and retrieval of dispersed storage network access information
CN107948152B (en) Information storage method, information acquisition method, information storage device, information acquisition device and information acquisition equipment
CN109344631B (en) Data modification and block verification method, device, equipment and medium for block chain
EP3631668B1 (en) High integrity logs for distributed software services
US10911538B2 (en) Management of and persistent storage for nodes in a secure cluster
CN110430051B (en) Key storage method, device and server
CN109194669B (en) Data transmission method, device, equipment and medium of lightweight node
JP2012164031A (en) Data processor, data storage device, data processing method, data storage method and program
CN109254999B (en) Data processing method, device, equipment and medium for block chain
US20200213084A1 (en) Method for data storage, device, and computer readable data storage medium
CN111062045A (en) Information encryption and decryption method and device, electronic equipment and storage medium
CN109858285B (en) Block chain data processing method, device, equipment and medium
WO2017020669A1 (en) Method and device for authenticating identity of node in distributed system
US9489501B2 (en) Authentication method, authentication device, and system
CN115589298B (en) Method, device, system, equipment and medium for verifying information of block chain

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