CN107807951B - Block chain generation method, data verification method, node and system - Google Patents

Block chain generation method, data verification method, node and system Download PDF

Info

Publication number
CN107807951B
CN107807951B CN201710841223.4A CN201710841223A CN107807951B CN 107807951 B CN107807951 B CN 107807951B CN 201710841223 A CN201710841223 A CN 201710841223A CN 107807951 B CN107807951 B CN 107807951B
Authority
CN
China
Prior art keywords
block
data
fingerprint information
node
written
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
CN201710841223.4A
Other languages
Chinese (zh)
Other versions
CN107807951A (en
Inventor
刘胜
殷舒
徐加明
陈正
余兴华
张骁
祝晓潭
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Union Mobile Pay Co Ltd
Original Assignee
Union Mobile Pay Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Union Mobile Pay Co Ltd filed Critical Union Mobile Pay Co Ltd
Priority to CN201710841223.4A priority Critical patent/CN107807951B/en
Publication of CN107807951A publication Critical patent/CN107807951A/en
Application granted granted Critical
Publication of CN107807951B publication Critical patent/CN107807951B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/901Indexing; Data structures therefor; Storage structures
    • G06F16/9024Graphs; Linked lists
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/30Authentication, i.e. establishing the identity or authorisation of security principals
    • G06F21/31User authentication
    • G06F21/32User authentication using biometric data, e.g. fingerprints, iris scans or voiceprints
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3236Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions

Abstract

The invention discloses a block chain generation method, a data verification method, a node and a system, which are used for improving the utilization rate of a storage space, are applied to a block chain system comprising M nodes, and aiming at each node in the M nodes, the block chain generation method comprises the following steps: acquiring N pieces of fingerprint information corresponding to N pieces of data to be written; n is greater than or equal to 1; constructing a new block, wherein the new block comprises a data set and a block header; the data set comprises N pieces of fingerprint information; the block head comprises a block head Hash value of a previous block in a local block chain of the node; the previous block is the block which is added newly in the longest chain of the local block chain; and determining a consensus block from the new blocks generated by the M nodes to be added into the local block chain through a consensus algorithm. The storage space occupied by other information which is not to be written in the transaction information is saved, so that the utilization rate of the storage space is improved.

Description

Block chain generation method, data verification method, node and system
Technical Field
The invention relates to the technical field of data authentication, in particular to a block chain generation method, a data verification method, a node and a system.
Background
In modern life, the existence of certain data (things) is often required to be proved, namely the existence of the data, such as written articles, historical operating instructions, signed contracts and the like, and at the moment, the data needs to be authenticated by a third-party authentication mechanism, and the authentication mode has extremely high requirement on the credit degree of the authentication mechanism, and has the disadvantages of complex operation, high cost and poor timeliness.
In order to solve the above-mentioned various problems in data storage by the third-party certification authority, many proposals for data storage by a block chain have been made, and the above-mentioned problems are preferably solved by using a non-centralized structure and a non-modifiable characteristic of the block chain. A common method for using a block chain to store data certificates is to construct a special transaction, and use fingerprint information of data to be stored certificates as an additional information parameter of the special transaction, such as an OP _ Return parameter in a bitcoin transaction. Thereafter, the special transaction is sent to the blockchain system. However, even in the simplest transaction, at least 200 bytes of memory space are required, which wastes the memory space of the blockchain system, and for data storage, only a small portion of the memory space is used for storing the fingerprint information of the data to be stored, so that the utilization rate of the memory space is very low, which is not favorable for storing more data to be stored.
Disclosure of Invention
The invention provides a block chain generation method, a data verification method, a node and a system, which are used for improving the utilization rate of a storage space of a block chain system.
The embodiment of the present invention provides a method for generating a block chain, which is applied to a block chain system including M nodes, where M is greater than or equal to 3, and includes, for each node of the M nodes:
acquiring N pieces of fingerprint information corresponding to N pieces of data to be written; n is greater than or equal to 1;
constructing a new block, the new block comprising a data set and a block header; the data set comprises the N pieces of fingerprint information; the block head comprises a block head hash value of a previous block in the local block chain of the node; the previous block is a block which is added newly in the longest chain of the local block chain;
and determining, by a consensus algorithm, from the new blocks generated by the M nodes, a consensus block meeting the consensus algorithm rule to be added to the local block chain.
Optionally, the new block further includes a signature set including N digital signatures;
and the N digital signatures correspond to the N fingerprint information one by one.
Optionally, after determining, by a consensus algorithm, a consensus block that satisfies the consensus algorithm rule from among the new blocks of the M nodes to add to the local block chain, the method further includes:
aiming at each fingerprint information in the common identification block, storing the index information corresponding to the fingerprint information in a local index library; the index information comprises the block height of the fingerprint information in the local block chain and the position number of the fingerprint information in the block.
Optionally, the block header of the new block further includes root hash values of the N pieces of fingerprint information.
Optionally, the root hash values of the N pieces of fingerprint information are obtained by a mercker merkle tree algorithm;
the method further comprises the following steps:
grouping the N pieces of fingerprint information;
calculating an intermediate hash value of the packet according to a first hash rule;
calculating a hash value of the intermediate hash value as a hash value of the packet according to a second hash rule;
and continuously grouping the grouped hash values, and returning to the step of calculating the intermediate hash value of the group according to the first hash rule until the root hash value is obtained.
Optionally, before acquiring, for each node of the M nodes, N pieces of fingerprint information corresponding to the N pieces of data to be written, the method further includes:
for any data to be written, a receiving node receives fingerprint information of the data to be written, wherein the receiving node is any node in the M nodes;
the receiving node stores the fingerprint information of the data to be written into a data set to be written into the receiving node and sends data writing requests to other M-1 nodes; the data writing request comprises fingerprint information of the data to be written; the data writing request is used for indicating any one of the other M-1 nodes to store the fingerprint information of the data to be written into the respective data set to be written;
and for any node in the M nodes, when the number of the fingerprint information of the data to be written in the data set to be written in the node reaches a preset number or a preset time is reached from the time interval of last new block construction, acquiring N pieces of fingerprint information corresponding to N pieces of data to be written in the data set to be written in the node.
Optionally, after determining, by a consensus algorithm, a consensus block that satisfies the consensus algorithm rule from among the new blocks generated by the M nodes to be added to the local block chain, the method further includes:
for any node of the M nodes, removing the N pieces of fingerprint information included in the common identification block from a data set to be written of the node.
Optionally, at least one endorsement node is further present in the blockchain system;
the method further comprises the following steps:
the endorsement node determines an endorsement block from the block chain according to a set rule;
constructing endorsement transaction information, wherein additional information parameters of the endorsement transaction information comprise block head hash values of endorsement blocks;
and sending the endorsement transaction information to an endorsement blockchain system.
The embodiment of the invention provides a data verification method, which is applied to a block chain system comprising M nodes, wherein M is more than or equal to 3, and the method comprises the following steps:
a verification node acquires fingerprint information of data to be verified, wherein the verification node is any one of the M nodes;
the verification node determines whether each block contains fingerprint information of the data to be verified or not from a block chain; each tile in the chain of tiles comprises a data set and a tile header; the data set comprises fingerprint information corresponding to each written data; the block head comprises a block head hash value of a block before the block;
and if the fingerprint information of the data to be verified exists in the block chain, confirming that the data to be verified passes the verification.
Optionally, the block further includes a signature set including N digital signatures; the N digital signatures correspond to the N fingerprint information one by one;
the method further comprises the following steps:
when the fingerprint information of the data to be verified exists in the block chain, acquiring a digital signature corresponding to the fingerprint information of the data to be verified from the block chain;
acquiring public key information of the data to be verified;
verifying the digital signature according to the public key information;
and when the digital signature passes the verification, confirming that the data to be verified passes the right.
Optionally, a local index library is stored in the verification node; the local index library comprises index information of fingerprint information of written data in each block of the block chain; the index information comprises the block height of the fingerprint information in the block chain and the position number of the fingerprint information in the block;
the determining, by the verification node, whether each block contains fingerprint information of the data to be verified from the block chain includes:
searching the local index library according to the fingerprint information of the data to be verified, and acquiring index information corresponding to the fingerprint information of the data to be verified;
determining fingerprint information corresponding to the index information from the block chain;
and when the fingerprint information of the data to be verified is consistent with the fingerprint information corresponding to the index information, determining that the fingerprint information of the data to be verified exists in the block chain.
Optionally, the block header of the new block further includes a root hash value of fingerprint information corresponding to each written data;
when the fingerprint information of the data to be verified exists in the block chain, the method further comprises the following steps:
calculating a root hash value of a data set where the fingerprint information of the data to be verified is located;
and when the root hash value of the data set is consistent with the root hash value in the block head, confirming that the data to be verified passes the verification.
The embodiment of the invention provides a block chain link point, which is applied to a block chain system comprising M nodes, wherein M is more than or equal to 3, and the block chain link point comprises the following steps:
the receiving and sending unit is used for acquiring N pieces of fingerprint information corresponding to the N pieces of data to be written; n is greater than or equal to 1;
a processing unit for constructing a new block, the new block comprising a data set and a block header; the data set comprises the N pieces of fingerprint information; the block head comprises a block head hash value of a previous block in the local block chain; the previous block is a block which is added newly in the longest chain of the local block chain;
the processing unit is further configured to determine, through a consensus algorithm, a consensus block satisfying the consensus algorithm rule from among the new blocks generated by the M nodes to join the local block chain.
Optionally, the new block further includes a signature set including N digital signatures;
and the N digital signatures correspond to the N fingerprint information one by one.
Optionally, the processing unit is further configured to:
aiming at each fingerprint information in the common identification block, storing the index information corresponding to the fingerprint information in a local index library; the index information comprises the block height of the fingerprint information in the local block chain and the position number of the fingerprint information in the block.
Optionally, the block header of the new block further includes root hash values of the N pieces of fingerprint information.
Optionally, the root hash values of the N pieces of fingerprint information are obtained by a mercker merkle tree algorithm;
the processing unit is further to:
grouping the N pieces of fingerprint information;
calculating an intermediate hash value of the packet according to a first hash rule;
calculating a hash value of the intermediate hash value as a hash value of the packet according to a second hash rule;
and continuously grouping the grouped hash values, and returning to the step of calculating the intermediate hash value of the group according to the first hash rule until the root hash value is obtained.
Optionally, the transceiver unit is further configured to:
receiving fingerprint information of the data to be written;
the processing unit is further to: storing the fingerprint information of the data to be written into a data set to be written, and sending data writing requests to other M-1 nodes; the data writing request comprises fingerprint information of the data to be written; the data writing request is used for indicating any one of the other M-1 nodes to store the fingerprint information of the data to be written into the respective data set to be written;
the processing unit is further to: and when the number of the fingerprint information of the data to be written in the data set to be written reaches a preset number or the time interval from the last new block construction reaches preset time, acquiring N pieces of fingerprint information corresponding to N pieces of data to be written in from the data set to be written.
Optionally, the processing unit is further configured to:
removing the N pieces of fingerprint information included in the common identification block from a data set to be written.
An embodiment of the present invention provides a block link point, which is applied to any node in a block link system including M nodes, where M is greater than or equal to 3, and includes:
the receiving and sending unit is used for acquiring fingerprint information of data to be verified;
the processing unit is used for determining whether each block contains fingerprint information of the data to be verified or not from the block chain; each tile in the chain of tiles comprises a data set and a tile header; the data set comprises fingerprint information corresponding to each written data; the block head comprises a block head hash value of a block before the block;
and if the fingerprint information of the data to be verified exists in the block chain, confirming that the data to be verified passes the verification.
Optionally, the block further includes a signature set including N digital signatures; the N digital signatures correspond to the N fingerprint information one by one;
the processing unit is further to:
when the fingerprint information of the data to be verified exists in the block chain, acquiring a digital signature corresponding to the fingerprint information of the data to be verified from the block chain;
acquiring public key information of the data to be verified;
verifying the digital signature according to the public key information;
and when the digital signature passes the verification, confirming that the data to be verified passes the right.
Optionally, the node further includes a storage unit, where a local index library is stored in the storage unit; the local index library comprises index information of fingerprint information of written data in each block of the block chain; the index information comprises the block height of the fingerprint information in the block chain and the position number of the fingerprint information in the block;
the processing unit is specifically configured to:
searching the local index library according to the fingerprint information of the data to be verified, and acquiring index information corresponding to the fingerprint information of the data to be verified;
determining fingerprint information corresponding to the index information from the block chain;
and when the fingerprint information of the data to be verified is consistent with the fingerprint information corresponding to the index information, determining that the fingerprint information of the data to be verified exists in the block chain.
Optionally, the block header of the new block further includes a root hash value of fingerprint information corresponding to each written data;
the processing unit is further to:
calculating a root hash value of a data set where the fingerprint information of the data to be verified is located;
and when the root hash value of the data set is consistent with the root hash value in the block head, confirming that the data to be verified passes the verification.
An embodiment of the present invention provides a computer-readable storage medium, where computer-executable instructions are stored, and the computer-executable instructions are configured to cause a computer to execute any one of the above block chain generation methods.
An embodiment of the present invention provides a computing device, including:
a memory for storing program instructions;
and the processor is used for calling the program instructions stored in the memory and executing any one of the block chain generation methods according to the obtained program.
An embodiment of the present invention provides a computer-readable storage medium, where computer-executable instructions are stored, and the computer-executable instructions are configured to enable a computer to execute any one of the data verification methods described above.
An embodiment of the present invention provides a computing device, including:
a memory for storing program instructions;
and the processor is used for calling the program instructions stored in the memory and executing the data verification method according to the obtained program.
An embodiment of the present invention provides a blockchain system, which includes M nodes, where M is greater than or equal to 3, and the blockchain system includes any one of the blockchain nodes described above.
Optionally, the system further comprises an endorsement node; the endorsement node is configured to:
determining endorsement blocks from the block chain according to a set rule;
constructing endorsement transaction information, wherein additional information parameters of the endorsement transaction information comprise block head hash values of endorsement blocks;
and sending the endorsement transaction information to an endorsement blockchain system.
In summary, an embodiment of the present invention provides a block chain generation method, a data verification method, a node and a system, which are applied to a block chain system including M nodes, where M is greater than or equal to 3, where the block chain generation method includes, for each node of the M nodes: acquiring N pieces of fingerprint information corresponding to N pieces of data to be written; n is greater than or equal to 1; constructing a new block, wherein the new block comprises a data set and a block header; the data set comprises N pieces of fingerprint information; the block head comprises a block head hash value of a previous block in the node local block chain; the previous block is the block which is added newly in the longest chain of the local block chain; and determining a consensus block meeting the consensus algorithm rule from the new blocks generated by the M nodes to be added into the local block chain through a consensus algorithm. In the block chain obtained by the block chain generating method provided by the embodiment of the invention, each block directly stores the fingerprint information of the data to be written, but not transaction information.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise.
Fig. 1 is a block chain system architecture according to an embodiment of the present invention;
fig. 2 is a schematic flow chart of a block chain generation method according to an embodiment of the present invention;
FIG. 3 is a block data structure diagram according to an embodiment of the present invention;
fig. 4 is a block chain structure diagram of two blocks corresponding to a previous block according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of a possible merkle tree structure provided by the embodiment of the present invention;
fig. 6 is a schematic flow chart of a data verification method according to an embodiment of the present invention;
FIG. 7 is a block data structure diagram according to an embodiment of the present invention;
FIG. 8 is a block link point structure according to an embodiment of the present invention;
FIG. 9 is a block link point structure according to an embodiment of the present invention;
FIG. 10 is a block diagram of a computing device according to an embodiment of the present invention;
fig. 11 is a schematic structural diagram of a computing device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the present invention will be described in further detail with reference to the accompanying drawings, and it is apparent that the described embodiments are only a part of the embodiments of the present invention, not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The embodiment of the invention provides a block chain system, which comprises M nodes, wherein M is more than or equal to 3. Wherein, M nodes are dynamically networked through a Peer-to-Peer network (Peer to Peer, P2P) to form a decentralized system. Fig. 1 is a schematic diagram of a feasible blockchain system architecture according to an embodiment of the present invention, as shown in fig. 1, the blockchain system includes a node 0, a node 1, a node 2, a node 3, and a node 4, and the five nodes are peer-to-peer nodes, and form a decentralized system through P2P dynamic networking. The straight lines in fig. 1 indicate the data transmission relationship between the nodes, and taking node 2 as an example, the broadcast message can be received by nodes 1 and 3.
When the block chain system provided by the embodiment of the invention is used for writing data, any node in M nodes of the system can be used as a receiving node, and the receiving node receives fingerprint information of the data to be written; the receiving node stores the fingerprint information of the data to be written into a data set to be written of the receiving node and sends data writing requests to other M-1 nodes; the data writing request comprises fingerprint information of data to be written; the data writing request is used for indicating any node in other M-1 nodes to store the fingerprint information of the data to be written into the respective data set to be written, namely for any node in other M-1 nodes, after receiving the data writing request, acquiring the fingerprint information of the data to be written and storing the fingerprint information of the data to be written into the respective data set to be written.
Taking the blockchain system shown in fig. 1 as an example, the node 2 serves as a receiving node to receive fingerprint information of data to be written; the node 2 stores the fingerprint information of the data to be written into a local data set to be written, and sends data writing requests to the node 0, the node 1 and the node 3; the data writing request comprises fingerprint information of data to be written; the node 0, the node 1 and the node 3 store the fingerprint information of the data to be written in the data writing request into respective data sets to be written, and the node 1 or the node 3 continuously forwards the data writing request to the node 4; the node 4 receives the data writing request which arrives at the node 1 and the node 3 firstly, and stores the fingerprint information of the data to be written in the data writing request into the data set to be written in the node 4.
It should be understood that, in the embodiment of the present invention, the M nodes in the blockchain system are peer nodes in the blockchain system, and in the implementation process, some non-peer nodes may exist in the blockchain system, for example, the endorsement node mentioned next in the embodiment of the present invention is a non-peer node, and the blockchain system including the non-peer node is also applicable to the technical solution provided by the embodiment of the present invention and also should be included in the embodiment of the present invention. For convenience of description, in the embodiments of the present invention, under a condition that no specific description is made, all the nodes described below are peer nodes, and are not described again.
Based on the above block chain system architecture, an embodiment of the invention provides a block chain generation method, as shown in fig. 2. Fig. 2 is a schematic flow chart of a method for generating a blockchain according to an embodiment of the present invention, which includes the following steps for any one of M nodes of a blockchain system:
s201: acquiring N pieces of fingerprint information corresponding to N pieces of data to be written; n is greater than or equal to 1.
S202: constructing a new block, wherein the new block comprises a data set and a block header; the data set comprises N pieces of fingerprint information; the block head comprises a root hash value and a block head hash value of a previous block in a local block chain of the node; the previous block is the most recently added block in the longest chain of the local block chain.
S203: and determining a consensus block meeting the consensus algorithm rule from the new blocks generated by the M nodes to be added into the local block chain through a consensus algorithm.
In S201, the data to be written may be data that needs to be certified, and the specific form thereof is not limited. Each piece of data to be written has its own fingerprint information, which is generally a hash value obtained by processing the data to be written by a hash function (hash) algorithm. For the case that each peer node has a respective data set to be written, optionally, when the number of the fingerprint information of the data to be written in the data set to be written in the node reaches a preset number or the time interval from the last time of constructing the new block reaches a preset time, S201 is executed.
In S202, each peer node in the blockchain system constructs a new block, and the data structure of the new block is as shown in fig. 3, and fig. 3 is a schematic diagram of a possible data structure of a block according to an embodiment of the present invention, which shows a logical structure of data in the block. As shown in fig. 3, the constructed new block includes a data set and a block header, where the data set includes N pieces of fingerprint information acquired in S201: fingerprint 1, fingerprint 2, … …, and fingerprint N, where the block head includes the block head hash value of the previous block, where the previous block is the latest added block in the longest chain of the local block chain of the node, and the new block includes the block head hash value of the previous block to ensure the chain structure of the block chain.
In the blockchain system, M nodes respectively have a local blockchain, and each block in the blockchain is strung together by a hash pointer (hash value of the head of the previous block) to form a chain structure. In theory, M nodes in the blockchain system should have the same local blockchain, but in the actual blockchain system, because the time for receiving the new block broadcast between the nodes is not consistent, and the calculation power of different nodes is different, a situation that a plurality of blocks correspond to the same previous block may exist in the local blockchain, as shown in fig. 4, which is a block chain structure diagram of two blocks corresponding to the same previous block provided by the embodiment of the present invention. The arrow in fig. 4 represents a hash pointer, the arrow pointing from block 1 to block 2, indicating that the block header of block 2 includes the block header hash value of block 1, and so on. In the block chain shown in fig. 4, the block headers of the blocks 4 and 8 both include the hash value of the block header of the block 3, and when a new block is constructed at a node, the newly added block in the longest chain is selected as the previous block of the new block according to the "longest chain rule", that is, the block 7 is selected as the previous block of the new block constructed at the node, and the hash value of the block header of the block 7 is included in the block header of the new block.
Optionally, the new block further includes a timestamp, where the timestamp is a current system time of a node that generates the new block, and a function of adding a time certificate to the data to be written may be added. Optionally, the block header of the new block further includes root hash values of the N pieces of fingerprint information. The root hash value may be used to verify whether the data set of the block has been tampered with at the time of data verification.
In S203, new blocks are constructed at M nodes in a block chain, and since each node may have different selections and sequences of N pieces of fingerprint information, the obtained root hash values may also be different, and in order to ensure consistency of block chains in the system, a new block is determined from new blocks generated by the M nodes through a consensus algorithm as a consensus block, and the consensus block is broadcasted to other M-1 nodes by the node generating the consensus block. The specific implementation manner of the consensus algorithm includes various aspects, such as Proof of Work (PoW), Practical Byzantine Fault-tolerant consensus algorithm (PBFT), and the like, which is not limited in the embodiment of the present invention. In the block data structure shown in fig. 3, the block header further includes a random number, the random number is used for determining the consensus block in the consensus algorithm, taking PoW as an example, after each node in the M nodes constructs the data set and other parts in the block header, a plurality of random numbers are tried, a change in the random number will directly result in a change in the hash value of the block header of the new block, and when the hash value of the block header of any block first satisfies the "difficulty value" (e.g., n bits before the hash value of the block header are 0), the node broadcasts the new block constructed by the node as the consensus block to other nodes in the blockchain system. And after receiving the common block broadcast, other nodes stop constructing the new block and add the common block into the local block chain. Optionally, the difficulty value may be a preset fixed value, or may be periodically dynamically adjusted according to the average time used for generating the new block. Optionally, after determining the common identification block from the new blocks generated by the M nodes, for any node in the M nodes, removing N pieces of fingerprint information included in the common identification block from the to-be-written data set of the node to prevent the data that has been written into the block chain from being repeatedly written into the block chain.
Optionally, for any node in the M nodes, after determining, by using a consensus algorithm, a consensus block that satisfies a rule of the consensus algorithm from new blocks generated by the M nodes to add to the local block chain, the method further includes: aiming at each fingerprint information in the common identification block, storing the index information corresponding to the fingerprint information in a local index library; the index information comprises the block height of the fingerprint information in the block chain and the position number of the fingerprint information in the block. Taking the block structure described in fig. 3 as an example, if the block height is height, the index information of the second fingerprint in the data set, fingerprint 1, is height and 2. Each node in the block chain system stores the index information of the data in the block into a local index library, so that when a user verifies the data, only fingerprint information of the data to be verified needs to be provided, and the use of the user is facilitated. Of course, for any node in the M nodes, after the consensus block satisfying the consensus algorithm rule is added to the local block chain by the consensus algorithm, it can also be determined whether the node is a receiving node of any fingerprint information in the consensus block, and if so, the index information of the fingerprint information is output to the user. When the user verifies the data, the fingerprint information and the index information of the data to be verified can be provided at the same time, and the data verification efficiency can be improved.
In the block structure provided in the embodiment of the present invention, the block header further includes N root hash values of fingerprint information. The root hash values of the N pieces of fingerprint information are obtained by a merkel merkle tree algorithm, and specifically, after S201, the method further includes: grouping the N pieces of fingerprint information; calculating an intermediate hash value of the packet according to a first hash rule; calculating the hash value of the intermediate hash value as the hash value of the packet according to a second hash rule; and continuously grouping the hash values of the packets, and returning to the step of calculating the intermediate hash value of the packet according to the first hash rule until the root hash value is obtained.
Referring to fig. 5, a schematic diagram of a possible merkle tree structure provided by the embodiment of the present invention is shown, where the fingerprint information in the merkle number shown in fig. 5 includes six of a, b, c, d, e, and f, and is located at a layer 1 (not shown) of the merkle tree. And when the root hash value is calculated, grouping the six fingerprint information pairwise and calculating the hash value of each group to obtain the hash values h, i and g of the layer 2, continuously grouping the h, i and g and repeating the process until the hash value is obtained in the layer 4. In the merkle tree shown in fig. 3, layer 1 further includes two complementary hash values x, because the merkle tree algorithm using the pairwise grouping needs to ensure that the number of fingerprint information in layer 1 is 2 to the Q power to finally obtain a root hash value, Q is a positive integer, when the number of fingerprint information is less than 2 to the Q power, the complementary hash value x needs to be supplemented to the Q power of 2, and as shown in fig. 5, after two complementary hash values x are supplemented, layer 1 reaches 3 times (8) of 2 fingerprint information. In a specific implementation process, the complementary bit hash value x may be any known hash value, for example, x may be nth fingerprint information of the N fingerprint information, or first fingerprint information, or null information in which all bytes are 0, and the like.
Optionally, in order to improve the security of the hash algorithm, in the embodiment of the present invention, when the hash value of each packet in the merkle tree is calculated, the intermediate hash value of the packet is calculated according to the first hash rule; and calculating the hash value of the intermediate hash value as the hash value of the packet according to the second hash rule. Taking the merkle tree shown in fig. 5 as an example, the intermediate hash value h is obtained for the fingerprint information a and the fingerprint information b according to the first hash rule0Calculating an intermediate hash value h according to a second hash rule0The hash value of the fingerprint information a and the hash value h of the fingerprint information b are obtained.
Of course, the hash value calculation method may also be applied to other steps of calculating hash values in the embodiments of the present invention, such as calculating the hash values of fingerprint information and block headers, and the like, which should also be included in the embodiments of the present invention. Taking the calculation of the fingerprint information of the hello as an example, the first hash rule is sha-256, the intermediate hash value 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824 is output, the second hash rule is ripemd-160, and the hash operation is continuously performed on the intermediate hash value, so that the fingerprint information b6a9c8c230722b7c748331a8b450f05566dc7d0f of the hello is obtained.
By adopting the hash value calculation method provided by the embodiment of the invention, on one hand, the safety of the hash algorithm can be improved, the hash collision attack of a single algorithm can be prevented, and on the other hand, the hash value with shorter length can be output by selecting a proper second hash rule.
Moreover, in the block chain obtained by the block chain generating method provided by the embodiment of the invention, each block directly stores the fingerprint information of the data to be written, and compared with the existing bitcoin block, the block chain generating method provided by the embodiment of the invention does not need to hash the fingerprint information in the merkle number layer 1 again, so that the layer number of the merkle tree is reduced, and the hash calculation times are reduced.
In the block chain obtained by the block chain generating method provided by the embodiment of the invention, each block directly stores the fingerprint information of the data to be written, but not transaction information. Specifically, by using the block chain generation method provided by the embodiment of the present invention, in the case of using the SHA-256 hash algorithm, writing data to be written only needs to occupy 32 bytes of storage space, which is much smaller than at least about 200 bytes in the prior art. Accordingly, the 1M-sized block occupies a storage space capable of accommodating more data. In addition, compared with the existing data writing technology relying on the digital currency blockchain network, the embodiment of the invention can also realize larger service capacity of the blockchain system by adjusting some parameters of the blockchain system, namely the number of data to be written in a unit time, such as increasing the speed of generating a new block, increasing the size of the new block, adopting a hash algorithm of shorter bytes, and the like. In addition, the block chain generation method provided by the embodiment of the invention does not need to pay the transaction fee of the digital currency, and the cost for writing the data to be written each time can be almost ignored.
By the method provided by the embodiment, the data to be written can be written into the block chain, the storage certificate of the data to be written is realized, and the storage space of a block chain system is saved. Based on the same technical concept, the embodiment of the invention also provides a data verification method, which can perform data verification on the data written into the block chain in the embodiment. Fig. 6 is a schematic flow chart of a data verification method according to an embodiment of the present invention, as shown in fig. 6, including the following steps:
s601: the verification node acquires fingerprint information of the data to be verified, and the verification node is any one of the M nodes.
S602: the verification node determines whether each block contains fingerprint information of data to be verified from the block chain; each tile in the chain of tiles comprises a data set and a tile header; the data set comprises fingerprint information corresponding to each written data; the block header includes a block header hash value of a block previous to the block.
S603: and if the fingerprint information of the data to be verified exists in the block chain, confirming that the data to be verified passes the verification.
The written data is data to be written in the blockchain system according to the above embodiment, and the blockchain system may be the same as the blockchain system in the above embodiment.
In S601, any node of the M nodes of the blockchain system may serve as an authentication node to provide data authentication service for the user. The fingerprint information of the data to be verified, which is acquired by the verification node, can be directly provided by the user or can be calculated and acquired according to the data to be verified, which is provided by the user. A preferred implementation is that the user saves the fingerprint information of the data to be verified and provides it directly to the verification node, because the data to be verified is often complex and errors may occur in the saving by the user.
In S602, the verification node may traverse the fingerprint information corresponding to the written data included in each block in the block chain, which is very inefficient. A more efficient implementation is that the verification node queries whether the specific location of the block chain contains the fingerprint information of the data to be verified through the index information, which may be provided directly by the user or obtained by querying an index database. Optionally, the verification node stores a local index library; index information of fingerprint information of written data in each block of the block chain in a local index library; the index information comprises the block height of the fingerprint information in the block chain and the position number of the fingerprint information in the block. The index information in the index library may be stored in the index library after each new block is added, or may be stored in the index library after batch reading from one or more blocks periodically. In S602 and S603, the verification node may first determine whether there is index information provided by the user. When the user provides the index information, the block chain is directly inquired through the index information. When the user does not provide index information, searching a local index library according to the fingerprint information of the data to be verified, and acquiring index information corresponding to the fingerprint information of the data to be verified; determining fingerprint information corresponding to the index information from the block chain; and when the fingerprint information of the data to be verified is consistent with the fingerprint information corresponding to the index information, determining that the fingerprint information of the data to be verified exists in the block chain.
For example, fingerprint information H1 of the data to be verified is obtained, fingerprint information H2 corresponding to the index information (where the height of the chunk is height) is determined from the chunk chain, and when H1 and H2 are consistent, it is determined that the fingerprint information of the data to be verified exists in the chunk chain, and the data to be verified passes verification. Optionally, the block header of the new block further includes a root hash value of fingerprint information corresponding to each written data; in order to further improve the credibility of the verification, when the fingerprint information of the data to be verified exists in the block chain, the method further comprises the following steps: calculating a root hash value of a data set where fingerprint information of data to be verified is located; and when the root hash value of the data set is consistent with the root hash value in the block head, confirming that the data to be verified passes the verification. For example, the root hash values H3 of the N pieces of fingerprint information in the data set of the chunk with the chunk height in the index information are further calculated, and when H3 matches the root hash value included in the chunk header of the chunk, it is determined that the data in the chunk is not tampered, and H2 is actually the fingerprint information included in the data set of the chunk. Optionally, in order to further improve the reliability of verification, the hash value of the head of the block with the height of the block H4 may be continuously calculated, and the block with the height of the block H1 in the blockchain is queried, and when the hash value of the previous block in the head of the block with the height of the block H1 is consistent with H4, it is determined that the block with the height of the block H1 is indeed the block in the blockchain, and of course, the block with the height of the block H1 and the blocks after the block may be continuously verified on this basis, so as to improve the reliability of data verification.
By the method provided by the embodiment, the data can be stored and verified, and the storage space of a block chain system is saved. The embodiment of the invention also provides a block chain generation method and a data verification method, which can increase the function of determining the right of data to be verified while realizing data storage.
The block chain generating method with the right confirming function provided by the embodiment of the present invention is similar to the block chain generating method described above, and the difference is that for each node of the M nodes, the method includes:
in S201, in addition to acquiring N pieces of fingerprint information corresponding to N pieces of data to be written, N digital signatures corresponding to N pieces of data to be written are also acquired; the digital signature is generated by a data owner to be written by using a private key, is received by a receiving node along with the data to be written, and is broadcast to each node of the block chain system through the block chain system. Optionally, the receiving node may further receive a digital signature input by a user and public key information corresponding to a private key, and verify whether the digital signature is consistent with the fingerprint information of the data to be written by using the public key, and if so, broadcast the fingerprint information of the data to be written and the digital signature to each node of the block chain system by using the block chain system.
In S202, any node in the M nodes of the blockchain system constructs a new block by using the block data structure shown in fig. 7, where fig. 7 is a schematic diagram of a possible block data structure provided in the embodiment of the present invention, and as shown in fig. 7, the block further includes a signature set including N digital signatures, i.e., signature 1, signature 2, … …, and signature N; the N digital signatures are in one-to-one correspondence with the N fingerprint information in the data set, specifically, a pair of digital signature and fingerprint information corresponding to each other is the digital signature and fingerprint information of the same data to be written. The blocks shown in fig. 7 store the fingerprint information and the digital signature separately, which can support some lightweight verification nodes (e.g., mobile terminal Applications (APPs)) to selectively download related block contents without signature from the block chain, and determine whether to perform the authorization according to actual usage requirements.
Correspondingly, when verifying the data in the block chain generated by the block chain generation method, the method is similar to the data verification method, and the difference is that:
in S601, the verification node needs to obtain the public key information of the data to be verified in addition to the fingerprint information of the data to be verified. The public key information may be included in the authentication request, which includes the fingerprint information and the public key information of the data to be authenticated. The public key information can also be stored by a third party, and the verification node acquires the public key information from the third party.
After S603, the method further includes: when fingerprint information of data to be verified exists in the block chain, acquiring a digital signature corresponding to the fingerprint information of the data to be verified from the block chain; acquiring public key information of data to be verified; verifying the digital signature according to the public key information; and when the digital signature passes the verification, confirming that the data to be verified passes the right. Taking the fingerprint information H1 of the data to be verified and the fingerprint information H2 of the written data corresponding to the index information as an example, when H1 is consistent with H2, the data to be verified is confirmed to pass verification. And then, continuously acquiring the digital signature A2 corresponding to H2 from the block chain, decrypting the digital signature A2 by using the public key information received together with the fingerprint information of the data to be verified, and confirming that the right of the data to be verified passes when the decryption result of the digital signature A2 is H1.
In the above-described authentication process, the authentication process is performed by the authentication node. Of course, the verification node may also directly output the signature information corresponding to the fingerprint information of the data to be verified, so that the data verification requester can verify the signature information by itself, and the like.
Based on the same technical concept, the embodiment of the present invention further provides a block chain link point, where the node can implement any one of the block chain generation methods described above. Fig. 8 is a schematic diagram of a block link point structure according to an embodiment of the present invention, and as shown in fig. 8, a node 800 includes: a transceiving unit 801 and a processing unit 802, wherein:
the receiving and sending unit 801 is configured to acquire N pieces of fingerprint information corresponding to the N pieces of data to be written, respectively; n is greater than or equal to 1;
a processing unit 802 for constructing a new block, the new block comprising a data set and a block header; the data set comprises the N pieces of fingerprint information; the block head comprises a block head hash value of a previous block in the local block chain; the previous block is a block which is added newly in the longest chain of the local block chain;
the processing unit 802 is further configured to determine, through a consensus algorithm, a consensus block that satisfies the consensus algorithm rule from among new blocks generated by the M nodes to join the local blockchain.
Optionally, the new block further includes a signature set including N digital signatures;
and the N digital signatures correspond to the N fingerprint information one by one.
Optionally, the processing unit 802 is further configured to:
aiming at each fingerprint information in the common identification block, storing the index information corresponding to the fingerprint information in a local index library; the index information comprises the block height of the fingerprint information in the block chain and the position number of the fingerprint information in the block.
Optionally, the block header of the new block further includes root hash values of the N pieces of fingerprint information.
Optionally, the root hash values of the N pieces of fingerprint information are obtained by a mercker merkle tree algorithm;
the processing unit 802 is further configured to:
grouping the N pieces of fingerprint information;
calculating an intermediate hash value of the packet according to a first hash rule;
calculating a hash value of the intermediate hash value as a hash value of the packet according to a second hash rule;
and continuously grouping the grouped hash values, and returning to the step of calculating the intermediate hash value of the group according to the first hash rule until the root hash value is obtained.
Optionally, the transceiver 801 is further configured to:
for any data to be written, receiving fingerprint information of the data to be written;
the processing unit 802 is further configured to: storing the fingerprint information of the data to be written into a data set to be written, and sending data writing requests to other M-1 nodes; the data writing request comprises fingerprint information of the data to be written; the data writing request is used for indicating any one of the other M-1 nodes to store the fingerprint information of the data to be written into the respective data set to be written;
the processing unit 802 is further configured to: and when the number of the fingerprint information of the data to be written in the data set to be written reaches a preset number or the time interval from the last new block construction reaches preset time, acquiring N pieces of fingerprint information corresponding to N pieces of data to be written in from the data set to be written.
Optionally, the processing unit 802 is further configured to:
removing the N pieces of fingerprint information included in the common identification block from a data set to be written.
Based on the same technical concept, the embodiment of the invention also provides a block link point, and the node can realize the data verification method. Fig. 9 is a schematic diagram of a block link point structure according to an embodiment of the present invention, and as shown in fig. 9, a node 900 includes: a transceiver 901 and a processing unit 902, wherein:
a transceiving unit 901, configured to acquire fingerprint information of data to be verified;
a processing unit 902, configured to determine whether each block includes fingerprint information of the data to be verified from the block chain; each tile in the chain of tiles comprises a data set and a tile header; the data set comprises fingerprint information corresponding to each written data; the block head comprises a root hash value of each written data and a block head hash value of a previous block of the block;
and if the fingerprint information of the data to be verified exists in the block chain, confirming that the data to be verified passes the verification.
Optionally, the block further includes a signature set including N digital signatures; the N digital signatures correspond to the N fingerprint information one by one;
the processing unit 902 is further configured to:
when the fingerprint information of the data to be verified exists in the block chain, acquiring a digital signature corresponding to the fingerprint information of the data to be verified from the block chain;
acquiring public key information of the data to be verified;
verifying the digital signature according to the public key information;
and when the digital signature passes the verification, confirming that the data to be verified passes the right.
Optionally, the node further includes a storage unit 903, and the storage unit 903 stores a local index library; the local index library comprises index information of fingerprint information of written data in each block of the block chain; the index information comprises the block height of the fingerprint information in the block chain and the position number of the fingerprint information in the block;
the processing unit 902 is specifically configured to:
searching the local index library according to the fingerprint information of the data to be verified, and acquiring index information corresponding to the fingerprint information of the data to be verified;
determining fingerprint information corresponding to the index information from the block chain;
and when the fingerprint information of the data to be verified is consistent with the fingerprint information corresponding to the index information, determining that the fingerprint information of the data to be verified exists in the block chain.
Optionally, the block header of the new block further includes a root hash value of fingerprint information corresponding to each written data;
the processing unit 902 is further configured to:
calculating a root hash value of a data set where the fingerprint information of the data to be verified is located;
and when the root hash value of the data set is consistent with the root hash value in the block head, confirming that the data to be verified passes the verification.
Based on the same technical concept, an embodiment of the present invention further provides a block chain system, which includes any one of the block chain link points described above, and can implement any one of the block chain generation methods described above and any one of the data verification methods described above.
Optionally, the blockchain system provided in the embodiment of the present invention further includes an endorsement node, where the endorsement node is different from a peer node in the blockchain system, and is used in the blockchain system to: determining an endorsement block from a local block chain of any node according to a set rule; constructing endorsement transaction information, wherein additional information parameters of the endorsement transaction information comprise block head hash values of endorsement blocks; and sending the endorsement transaction information to an endorsement block chain system.
In a specific implementation process, the set rule may select one block as an endorsement block at each time interval according to a timestamp in a block header of each block in the block chain, or may select one block as an endorsement block at intervals of a certain number according to the number of the blocks.
Optionally, the latest previous b blocks in the block chain may not be endorsed blocks, b may be determined according to the actual block chain system condition, and the block chain system with more nodes generally has larger value of b. This is because for a block chain system that is too complex, there is a certain delay problem in the transmission of information in the system, which results in the possibility that the first b blocks are not actually added to the block chain. Taking the blockchain system shown in fig. 1 as an example, in S203, the node 0 constructs a new block meeting the requirement of the difficulty value before receiving the new block broadcast by other nodes, at this time, the node 0 defaults to the new block constructed by itself as a consensus block of the blockchain and broadcasts to the node 4, and the node 4 receives the new block broadcast by the node 0 and stores the new block in the local blockchain as the consensus block. However, in practical situations, the node 2 may be a node where a new block meeting the requirement of the difficulty value is first constructed in the system, and the new block constructed by the node 2 is a common identification block of the block chain, but because the system is too complex, when the node 0 constructs a new block meeting the requirement of the difficulty value, the new block broadcast of the node 2 still does not reach the node 0, and when the node 4 receives the new block broadcast of the node 0, the new block broadcast of the node 2 also reaches the node 4, so that an error occurs in the block chain of the local areas of the node 0 and the node 4. The possibility of excluding the latest first b blocks in the block chain as endorsement blocks can ensure that the selected endorsement blocks are stable and reliable block chain blocks.
Optionally, the endorsement blockchain system may be a bitcoin network, or a large digital currency blockchain system such as an ethernet frame network, and because of the large number of nodes, it is almost impossible to modify the blockchain of the endorsement blockchain system. The block heads of partial blocks in the block chain are written into the endorsement block chain system, so that the credibility of data verification can be improved. Specifically, when the user has a question about the verification result of the endorsement block chain system provided by the embodiment of the present invention, whether the hash value of the block head of the endorsement block stored in the endorsement block chain system is consistent with the hash value of the block head of the endorsement block in the block chain may be queried, if not, it is determined that the block chain is in error, and if so, it is determined that the verification result is trusted. It should be understood that even if a block chain is in error, the data verification of the block chain system provided by the embodiment of the present invention does not completely lose credibility, and the verification result for confirming the existence of the data to be verified is still credible, while the verification result for confirming the absence of the data to be verified is less feasible.
By adding the endorsement node in the block chain system, the problem that the block chain is easy to attack due to insufficient height can be avoided, and the credibility of data verification is further improved.
Based on the same technical concept, the embodiment of the present invention further provides a computing device, which may be specifically a desktop computer, a portable computer, a smart phone, a tablet computer, a Personal Digital Assistant (PDA), and the like. As shown in fig. 10, a schematic structural diagram of a computing device according to an embodiment of the present invention is provided, where the computing device may include a Central Processing Unit (CPU) 1001, a memory 1002, an input device 1003, an output device 1004, and the like, the input device 1003 may include a keyboard, a mouse, a touch screen, and the like, and the output device 1004 may include a Display device such as a Liquid Crystal Display (LCD), a Cathode Ray Tube (CRT), and the like.
Memory 1002 may include Read Only Memory (ROM) and Random Access Memory (RAM), and provides the processor with program instructions and data stored in the memory. In this embodiment of the present invention, the memory may be configured to store a program of the blockchain generation method provided in this embodiment of the present invention, and the processor executes any one of the blockchain generation methods according to the obtained program instruction by calling the program instruction stored in the memory.
Based on the same technical concept, embodiments of the present invention further provide a computer-readable storage medium for storing computer program instructions for the above computing device, which includes a program for executing the blockchain generation method described in any one of the above.
The computer storage media may be any available media or data storage device that can be accessed by a computer, including, but not limited to, magnetic memory (e.g., floppy disks, hard disks, magnetic tape, magneto-optical disks (MOs), etc.), optical memory (e.g., CDs, DVDs, BDs, HVDs, etc.), and semiconductor memory (e.g., ROMs, EPROMs, EEPROMs, non-volatile memory (NAND FLASH), Solid State Disks (SSDs)), etc.
Based on the same technical concept, the embodiment of the present invention further provides a computing device, which may be specifically a desktop computer, a portable computer, a smart phone, a tablet computer, a Personal Digital Assistant (PDA), and the like. As shown in fig. 11, a schematic structural diagram of a computing device according to an embodiment of the present invention is provided, where the computing device may include a central Processing Unit 1101 (CPU), a memory 1102, an input device 1103, an output device 1104, and the like, the input device 1103 may include a keyboard, a mouse, a touch screen, and the like, and the output device 1104 may include a Display device such as a Liquid Crystal Display (LCD), a Cathode Ray Tube (CRT), and the like.
Memory 1102 may include Read Only Memory (ROM) and Random Access Memory (RAM), and provides the processor with program instructions and data stored in the memory. In this embodiment of the present invention, the memory may be configured to store a program of the data verification method provided in this embodiment of the present invention, and the processor executes any one of the data verification methods described above according to the obtained program instruction by calling the program instruction stored in the memory.
Based on the same technical concept, the embodiment of the present invention further provides a computer-readable storage medium for storing computer program instructions for the above-mentioned computing device, which includes a program for executing the data verification method described in any one of the above-mentioned items.
The computer storage media may be any available media or data storage device that can be accessed by a computer, including, but not limited to, magnetic memory (e.g., floppy disks, hard disks, magnetic tape, magneto-optical disks (MOs), etc.), optical memory (e.g., CDs, DVDs, BDs, HVDs, etc.), and semiconductor memory (e.g., ROMs, EPROMs, EEPROMs, non-volatile memory (NAND FLASH), Solid State Disks (SSDs)), etc.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.

Claims (29)

1. A method for generating a blockchain, applied to a blockchain system comprising M nodes, wherein M is greater than or equal to 3, the method comprising, for each of the M nodes:
acquiring N pieces of fingerprint information corresponding to N pieces of data to be written; n is greater than or equal to 1;
constructing a new block, the new block comprising a data set and a block header; the data set comprises the N pieces of fingerprint information; the block head comprises a block head hash value of a previous block in a local block chain of the node; the previous block is a block which is added newly in the longest chain of the local block chain;
and determining, by a consensus algorithm, from the new blocks generated by the M nodes, a consensus block meeting the consensus algorithm rule to be added to the local block chain.
2. The method of claim 1, wherein the new block further comprises a signature set comprising N digital signatures;
and the N digital signatures correspond to the N fingerprint information one by one.
3. The method of claim 1, wherein after determining, by a consensus algorithm, from among the new blocks of the M nodes, that a consensus block that satisfies the consensus algorithm rule is added to the local block chain, further comprising:
aiming at each fingerprint information in the common identification block, storing the index information corresponding to the fingerprint information in a local index library; the index information comprises the block height of the fingerprint information in the local block chain and the position number of the fingerprint information in the block.
4. The method of claim 1, wherein a chunk header of the new chunk further includes a root hash value of the N pieces of fingerprint information.
5. The method of claim 4, wherein the root hash values of the N pieces of fingerprint information are obtained by a merkel merkle tree algorithm;
the method further comprises the following steps:
grouping the N pieces of fingerprint information;
calculating an intermediate hash value of the packet according to a first hash rule;
calculating a hash value of the intermediate hash value as a hash value of the packet according to a second hash rule;
and continuously grouping the grouped hash values, and returning to the step of calculating the intermediate hash value of the group according to the first hash rule until the root hash value is obtained.
6. The method according to claim 1, wherein before acquiring, for each of the M nodes, N pieces of fingerprint information corresponding to N pieces of data to be written, respectively, the method further includes:
for any data to be written, a receiving node receives fingerprint information of the data to be written, wherein the receiving node is any node in the M nodes;
the receiving node stores the fingerprint information of the data to be written into a data set to be written into the receiving node and sends data writing requests to other M-1 nodes; the data writing request comprises fingerprint information of the data to be written; the data writing request is used for indicating any one of the other M-1 nodes to store the fingerprint information of the data to be written into the respective data set to be written;
and for any node in the M nodes, when the number of the fingerprint information of the data to be written in the data set to be written in the node reaches a preset number or a preset time is reached from the time interval of last new block construction, acquiring N pieces of fingerprint information corresponding to N pieces of data to be written in the data set to be written in the node.
7. The method of claim 6, wherein after determining, by a consensus algorithm, from among the new blocks generated by the M nodes, that a consensus block that satisfies the consensus algorithm rule is added to the local block chain, further comprising:
for any node of the M nodes, removing the N pieces of fingerprint information included in the common identification block from a data set to be written of the node.
8. The method of any one of claims 1 to 7, wherein there is also at least one endorsement node in the blockchain system;
the method further comprises the following steps:
the endorsement node determines an endorsement block from the block chain according to a set rule;
constructing endorsement transaction information, wherein additional information parameters of the endorsement transaction information comprise block head hash values of endorsement blocks;
and sending the endorsement transaction information to an endorsement blockchain system.
9. A data verification method is applied to a block chain system comprising M nodes, wherein M is greater than or equal to 3, and the method comprises the following steps:
a verification node acquires fingerprint information of data to be verified, wherein the verification node is any one of the M nodes;
the verification node determines whether each block contains fingerprint information of the data to be verified or not from a block chain; each tile in the chain of tiles comprises a data set and a tile header; the data set comprises fingerprint information corresponding to each written data; the block head comprises a block head hash value of a block before the block;
and if the fingerprint information of the data to be verified exists in the block chain, confirming that the data to be verified passes the verification.
10. The method of claim 9, wherein the block further comprises a signature set comprising N digital signatures; the N digital signatures correspond to the N fingerprint information one by one;
the method further comprises the following steps:
when the fingerprint information of the data to be verified exists in the block chain, acquiring a digital signature corresponding to the fingerprint information of the data to be verified from the block chain;
acquiring public key information of the data to be verified;
verifying the digital signature according to the public key information;
and when the digital signature passes the verification, confirming that the data to be verified passes the right.
11. The method of claim 9, wherein the validation node has a local index repository stored therein; the local index library comprises index information of fingerprint information of written data in each block of the block chain; the index information comprises the block height of the fingerprint information in the block chain and the position number of the fingerprint information in the block;
the determining, by the verification node, whether each block contains fingerprint information of the data to be verified from the block chain includes:
searching the local index library according to the fingerprint information of the data to be verified, and acquiring index information corresponding to the fingerprint information of the data to be verified;
determining fingerprint information corresponding to the index information from the block chain;
and when the fingerprint information of the data to be verified is consistent with the fingerprint information corresponding to the index information, determining that the fingerprint information of the data to be verified exists in the block chain.
12. The method according to claim 9, wherein the block header further includes a root hash value of fingerprint information corresponding to each written data;
when the fingerprint information of the data to be verified exists in the block chain, the method further comprises the following steps:
calculating a root hash value of a data set where the fingerprint information of the data to be verified is located;
and when the root hash value of the data set is consistent with the root hash value in the block head, confirming that the data to be verified passes the verification.
13. A blockchain node for use in a blockchain system including M nodes, M being greater than or equal to 3, comprising:
the receiving and sending unit is used for acquiring N pieces of fingerprint information corresponding to the N pieces of data to be written; n is greater than or equal to 1;
a processing unit for constructing a new block, the new block comprising a data set and a block header; the data set comprises the N pieces of fingerprint information; the block head comprises a block head hash value of a previous block in the local block chain; the previous block is a block which is added newly in the longest chain of the local block chain;
the processing unit is further configured to determine, through a consensus algorithm, a consensus block that satisfies the consensus algorithm rule from among the new blocks generated by the M nodes to add to the local block chain.
14. The node of claim 13, wherein the new block further comprises a signature set comprising N digital signatures;
and the N digital signatures correspond to the N fingerprint information one by one.
15. The node of claim 13, wherein the processing unit is further to:
aiming at each fingerprint information in the common identification block, storing the index information corresponding to the fingerprint information in a local index library; the index information comprises the block height of the fingerprint information in the local block chain and the position number of the fingerprint information in the block.
16. The node of claim 13, wherein a chunk header of the new chunk further includes a root hash value of the N fingerprint information.
17. The node of claim 16, wherein the root hash values of the N pieces of fingerprint information are obtained by a merkel merkle tree algorithm;
the processing unit is further to:
grouping the N pieces of fingerprint information;
calculating an intermediate hash value of the packet according to a first hash rule;
calculating a hash value of the intermediate hash value as a hash value of the packet according to a second hash rule;
and continuously grouping the grouped hash values, and returning to the step of calculating the intermediate hash value of the group according to the first hash rule until the root hash value is obtained.
18. The node of claim 13,
the transceiver unit is further configured to:
receiving fingerprint information of the data to be written;
the processing unit is further to:
storing the fingerprint information of the data to be written into a data set to be written, and sending data writing requests to other M-1 nodes; the data writing request comprises fingerprint information of the data to be written; the data writing request is used for indicating any one of the other M-1 nodes to store the fingerprint information of the data to be written into the respective data set to be written;
the processing unit is further to:
and when the number of the fingerprint information of the data to be written in the data set to be written reaches a preset number or the time interval from the last new block construction reaches a preset time, acquiring N pieces of fingerprint information corresponding to N pieces of data to be written in from the data set to be written.
19. The node of claim 18, wherein the processing unit is further to:
removing the N pieces of fingerprint information included in the common identification block from the data set to be written.
20. A blockchain node for use in any node in a blockchain system including M nodes, M being greater than or equal to 3, comprising:
the receiving and sending unit is used for acquiring fingerprint information of data to be verified;
the processing unit is used for determining whether each block contains fingerprint information of the data to be verified or not from the block chain; each tile in the chain of tiles comprises a data set and a tile header; the data set comprises fingerprint information corresponding to each written data; the block head comprises a block head hash value of a block before the block;
and if the fingerprint information of the data to be verified exists in the block chain, confirming that the data to be verified passes the verification.
21. The node of claim 20, wherein the block further comprises a signature set comprising N digital signatures; the N digital signatures correspond to the N fingerprint information one by one;
the processing unit is further to:
when the fingerprint information of the data to be verified exists in the block chain, acquiring a digital signature corresponding to the fingerprint information of the data to be verified from the block chain;
acquiring public key information of the data to be verified;
verifying the digital signature according to the public key information;
and when the digital signature passes the verification, confirming that the data to be verified passes the right.
22. The node of claim 20, wherein the node further comprises a storage unit, the storage unit having a local index store; the local index library comprises index information of fingerprint information of written data in each block of the block chain; the index information comprises the block height of the fingerprint information in the block chain and the position number of the fingerprint information in the block;
the processing unit is specifically configured to:
searching the local index library according to the fingerprint information of the data to be verified, and acquiring index information corresponding to the fingerprint information of the data to be verified;
determining fingerprint information corresponding to the index information from the block chain;
and when the fingerprint information of the data to be verified is consistent with the fingerprint information corresponding to the index information, determining that the fingerprint information of the data to be verified exists in the block chain.
23. The node according to claim 20, wherein the block header further includes a root hash value of fingerprint information corresponding to each written data;
the processing unit is further to:
calculating a root hash value of a data set where the fingerprint information of the data to be verified is located;
and when the root hash value of the data set is consistent with the root hash value in the block head, confirming that the data to be verified passes the verification.
24. A computer-readable storage medium having stored thereon computer-executable instructions for causing a computer to perform the method of block chain generation of any one of claims 1 to 8.
25. A computing device, comprising:
a memory for storing program instructions;
a processor for calling program instructions stored in said memory and executing the blockchain generation method of any one of claims 1 to 8 in accordance with the obtained program.
26. A computer-readable storage medium storing computer-executable instructions for causing a computer to perform the data validation method of any of claims 9 to 12.
27. A computing device, comprising:
a memory for storing program instructions;
a processor for calling program instructions stored in said memory to perform the data verification method of any of claims 9 to 12 in accordance with the obtained program.
28. A blockchain system comprising M nodes, M being equal to or greater than 3, comprising a blockchain point according to any one of claims 13 to 19 and a blockchain point according to any one of claims 20 to 23.
29. The system of claim 28, wherein the system further comprises an endorsement node; the endorsement node is configured to:
determining endorsement blocks from the block chain according to a set rule;
constructing endorsement transaction information, wherein additional information parameters of the endorsement transaction information comprise block head hash values of endorsement blocks;
and sending the endorsement transaction information to an endorsement blockchain system.
CN201710841223.4A 2017-09-18 2017-09-18 Block chain generation method, data verification method, node and system Active CN107807951B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710841223.4A CN107807951B (en) 2017-09-18 2017-09-18 Block chain generation method, data verification method, node and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710841223.4A CN107807951B (en) 2017-09-18 2017-09-18 Block chain generation method, data verification method, node and system

Publications (2)

Publication Number Publication Date
CN107807951A CN107807951A (en) 2018-03-16
CN107807951B true CN107807951B (en) 2020-10-13

Family

ID=61592439

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710841223.4A Active CN107807951B (en) 2017-09-18 2017-09-18 Block chain generation method, data verification method, node and system

Country Status (1)

Country Link
CN (1) CN107807951B (en)

Families Citing this family (65)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110119947B (en) * 2018-02-07 2021-08-10 上海策赢网络科技有限公司 Method and apparatus for shared workload proof computing power generation of symbiotic blockchains
CN108933667B (en) * 2018-05-03 2021-08-10 深圳市京兰健康医疗大数据有限公司 Management method and management system of public key certificate based on block chain
CN108629040A (en) * 2018-05-11 2018-10-09 北京奇虎科技有限公司 Data proof of possession method, apparatus and system
CN108830712A (en) * 2018-05-17 2018-11-16 易链科技(深圳)有限公司 Method, apparatus, equipment and the medium that block generates
CN110378694B (en) * 2018-05-21 2021-01-12 腾讯科技(深圳)有限公司 Block chain data processing method and device, computer equipment and storage medium
CN109033886A (en) * 2018-06-20 2018-12-18 北京欧链科技有限公司 A kind of corrigenda of block chain method and device, storage medium, electronic equipment
CN108920966A (en) * 2018-06-25 2018-11-30 北京奇虎科技有限公司 A kind of block chain deposits card, evidence collecting method and device
CN109033214A (en) * 2018-06-28 2018-12-18 威马智慧出行科技(上海)有限公司 The data management system and method for shared car data
CN109067849B (en) * 2018-07-11 2021-11-16 西康软件股份有限公司 Block-based data synchronization method
CN108876378B (en) * 2018-07-11 2022-04-19 北京国泰网信科技有限公司 Public link data encryption backup method
CN108595720B (en) * 2018-07-12 2020-05-19 中国科学院深圳先进技术研究院 Block chain space-time data query method, system and electronic equipment
CN109002732B (en) * 2018-07-17 2022-04-26 深圳前海微众银行股份有限公司 Data evidence storage method, equipment and system and data evidence obtaining method
CN110740112B (en) * 2018-07-20 2023-05-12 北京京东尚科信息技术有限公司 Authentication method, apparatus and computer readable storage medium
CN109359222B (en) * 2018-08-06 2021-07-06 杭州复杂美科技有限公司 Data storage method and system, equipment and storage medium
CN108881491A (en) * 2018-08-07 2018-11-23 长沙拓扑陆川新材料科技有限公司 It is a kind of for excavating the method and system of the block in block chain
CN109087101B (en) * 2018-08-07 2021-09-07 北京三快在线科技有限公司 Transaction verification method and device, storage medium and electronic equipment
CN109165221A (en) * 2018-08-16 2019-01-08 北京京东尚科信息技术有限公司 Date storage method, device, block chain node and the storage medium of block chain
CN109299335A (en) * 2018-08-31 2019-02-01 阿里巴巴集团控股有限公司 Control method, device, server and the readable storage medium storing program for executing of data storage
CN109145543B (en) * 2018-09-03 2020-12-04 湖北文理学院 Identity authentication method
CN109377217A (en) * 2018-09-03 2019-02-22 深圳壹账通智能科技有限公司 The bookkeeping methods and terminal device of entity seal
CN109191126B (en) * 2018-09-10 2021-02-02 南京荣链科技有限公司 Cash cross-bank transfer method based on block chain, terminal and medium
CN108876384B (en) * 2018-09-19 2021-11-05 联动优势科技有限公司 Transaction data processing method and device
CN109213767B (en) * 2018-09-19 2020-07-21 挖财网络技术有限公司 Account data management method suitable for block chain
CN109120714B (en) * 2018-09-21 2021-07-09 深圳市九洲电器有限公司 Security data recovery method and system, and node server
US10608829B1 (en) 2018-10-08 2020-03-31 International Business Machines Corporation Blockchain timestamp agreement
US11924360B2 (en) 2018-10-08 2024-03-05 Green Market Square Limited Blockchain timestamp agreement
CN111008402B (en) * 2018-10-08 2024-03-08 绿市广场有限公司 Blockchain timestamp protocol
CN109586949B (en) * 2018-10-17 2021-04-09 北京新唐思创教育科技有限公司 Block generation method and computer storage medium
CN110046517B (en) * 2018-11-07 2020-05-05 阿里巴巴集团控股有限公司 Method and device for hiding transaction written into block chain
CN109639430B (en) * 2018-11-09 2020-05-26 北京航空航天大学 Safe high-speed lightweight block chain system and method
CN109409889B (en) * 2018-11-13 2021-11-12 杭州秘猿科技有限公司 Block determining method and device in block chain and electronic equipment
CN110020945B (en) * 2018-11-27 2020-10-30 创新先进技术有限公司 Data reading method and system based on multiple block chain networks
CN110060152B (en) 2018-11-27 2020-10-30 创新先进技术有限公司 Data reading method and system based on multiple block chain networks
CN110060153B (en) * 2018-11-27 2020-11-17 创新先进技术有限公司 Data evidence storage method and system based on multiple block chain networks
CN110020854B (en) * 2018-11-27 2020-11-17 创新先进技术有限公司 Data evidence storage method and system based on multiple block chain networks
CN109903027A (en) * 2018-12-14 2019-06-18 阿里巴巴集团控股有限公司 Event-handling method and device, electronic equipment based on block chain
CN109903026A (en) 2018-12-14 2019-06-18 阿里巴巴集团控股有限公司 Event-handling method and device, electronic equipment based on block chain
CN109819016B (en) * 2018-12-17 2022-11-04 维沃移动通信有限公司 Information issuing method, information receiving method and mobile terminal based on block chain
CN109684333B (en) * 2018-12-24 2021-02-09 杭州复杂美科技有限公司 Data storage and cutting method, equipment and storage medium
CN109740317A (en) * 2018-12-29 2019-05-10 北京奇虎科技有限公司 A kind of digital finger-print based on block chain deposits card method and device
CN110868286B (en) * 2018-12-29 2023-05-12 北京版全家科技发展有限公司 Method for generating random number based on blockchain intelligent contract
CN109918874B (en) * 2019-03-14 2022-09-02 度小满科技(北京)有限公司 Physical information storage method and device and physical information searching method and device
CN109949035B (en) * 2019-03-15 2022-03-22 智链万源(北京)数字科技有限公司 Block chain data privacy control method, device and system
CN110209727B (en) * 2019-04-04 2020-08-11 特斯联(北京)科技有限公司 Data storage method, terminal equipment and medium
CN110113388B (en) * 2019-04-17 2020-01-14 四川大学 Improved clustering algorithm-based block chain system consensus method and device
US10990705B2 (en) 2019-04-18 2021-04-27 Advanced New Technologies Co., Ltd. Index creation for data records
CN110162526B (en) * 2019-04-18 2023-02-24 创新先进技术有限公司 Method, device and equipment for inquiring data records in block chain type account book
CN110162662B (en) * 2019-04-18 2023-02-28 创新先进技术有限公司 Verification method, device and equipment for data records in block chain type account book
WO2020211569A1 (en) * 2019-04-18 2020-10-22 创新先进技术有限公司 Method for constructing index of data record
CN112019586B (en) * 2019-05-29 2023-04-07 国际商业机器公司 Method and system for verification of blockchains
CN110225044B (en) * 2019-06-17 2020-11-27 北京瑞策科技有限公司 Verification method and device on block chain
CN110471928B (en) * 2019-07-08 2022-06-21 上海数据交易中心有限公司 Data circulation system
CN110544167B (en) * 2019-07-25 2022-03-01 晋商博创(北京)科技有限公司 Data processing method, server and storage medium of alliance chain based on CPK
CN110493148B (en) * 2019-08-12 2022-04-01 深圳前海微众银行股份有限公司 Block processing, block consensus and block synchronization method and device
CN110598477A (en) * 2019-09-19 2019-12-20 腾讯科技(深圳)有限公司 Block chain based information processing method and device, storage medium and equipment
CN110674140B (en) * 2019-09-29 2022-04-15 腾讯科技(深圳)有限公司 Block chain-based content processing method, device, equipment and storage medium
CN110750541B (en) * 2019-10-18 2023-05-02 天津理工大学 Block chain-based data storage indexing system and method
CN110989934B (en) * 2019-12-05 2023-08-25 达闼机器人股份有限公司 Block chain link point data storage method, block chain system and block chain node
CN112131304B (en) * 2020-02-10 2021-05-04 北京天德科技有限公司 Novel calculation and storage architecture based on block chain technology
CN111314374A (en) * 2020-03-11 2020-06-19 上海交通大学 Block chain structure for quick verification and generating system and verification method thereof
CN111831997B (en) * 2020-06-18 2021-07-27 华东师范大学 Method for establishing credible relationship between client and centralized database
CN111723159A (en) * 2020-08-21 2020-09-29 支付宝(杭州)信息技术有限公司 Data verification method and device based on block chain
CN111833062B (en) * 2020-09-21 2020-12-01 江苏傲为控股有限公司 Credibility verification system for digital asset data packet
CN113282966A (en) * 2021-06-07 2021-08-20 中国电子科技集团公司第三十研究所 Data right confirming method based on block chain
CN113411614B (en) * 2021-06-21 2022-02-18 环球数科集团有限公司 Video protection system based on block chain technology and computer storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105975868A (en) * 2016-04-29 2016-09-28 杭州云象网络技术有限公司 Block chain-based evidence preservation method and apparatus
CN106503589A (en) * 2016-10-26 2017-03-15 北京瑞卓喜投科技发展有限公司 The method of calibration of block chain Transaction Information correctness, apparatus and system
CN106548091A (en) * 2016-10-14 2017-03-29 北京爱接力科技发展有限公司 A kind of data deposit card, the method and device of checking

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105975868A (en) * 2016-04-29 2016-09-28 杭州云象网络技术有限公司 Block chain-based evidence preservation method and apparatus
CN106548091A (en) * 2016-10-14 2017-03-29 北京爱接力科技发展有限公司 A kind of data deposit card, the method and device of checking
CN106503589A (en) * 2016-10-26 2017-03-15 北京瑞卓喜投科技发展有限公司 The method of calibration of block chain Transaction Information correctness, apparatus and system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
"比特币背后的密码学原理";怒马2048;《简书-https://www.jianshu.com/p/225ff9439132》;20151222;博客第9-10页 *

Also Published As

Publication number Publication date
CN107807951A (en) 2018-03-16

Similar Documents

Publication Publication Date Title
CN107807951B (en) Block chain generation method, data verification method, node and system
CN107657438B (en) Block chain generation method, data verification method, node and system
US11270308B2 (en) Shared blockchain data storage
CN110869967B (en) System and method for parallel processing of blockchain transactions
EP3669280B1 (en) Shared blockchain data storage
US10581613B2 (en) Cryptographically verifiable data structure having multi-hop forward and backwards links and associated systems and methods
US11228439B2 (en) Scale out blockchain with asynchronized consensus zones
EP3669281B1 (en) Shared blockchain data storage
CN111047324B (en) Method and apparatus for updating a set of public keys at a blockchain node
CN111143378B (en) Method for processing data and device for implementing the method
US9444619B2 (en) Generation of randomized messages for cryptographic hash functions
EP3794770B1 (en) Shared blockchain data storage based on error correction code
CN111656386B (en) Managing transaction requests in ledger system
CN112163854B (en) Hierarchical public key searchable encryption method and system based on block chain
EP3759864A1 (en) Computer implemented voting process and system
WO2022183998A1 (en) Data processing method and apparatus, device, and storage medium
CN111630545B (en) Managing transaction requests in ledger system
CN111314066B (en) Block chain-based data transfer method, terminal and computer-readable storage medium
US20220217004A1 (en) Systems and methods for non-parallelised mining on a proof-of-work blockchain network
WO2023072965A1 (en) Methods and systems for distributed blockchain functionalities
CN110620776A (en) Data transfer information transmission method and device
CN111630549B (en) Managing transaction requests in ledger system
Zhou et al. Integrity preserving multi-keyword searchable encryption for cloud computing
Zhang et al. Multi-level caching and data verification based on ethereum blockchain
CN116668135A (en) Block chain consensus method, system and device participated in by mobile edge equipment

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