CN110245950B - Block discharging method and device related to block chain - Google Patents
Block discharging method and device related to block chain Download PDFInfo
- Publication number
- CN110245950B CN110245950B CN201910519267.4A CN201910519267A CN110245950B CN 110245950 B CN110245950 B CN 110245950B CN 201910519267 A CN201910519267 A CN 201910519267A CN 110245950 B CN110245950 B CN 110245950B
- Authority
- CN
- China
- Prior art keywords
- block
- hash
- node
- output node
- hash value
- 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
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q20/00—Payment architectures, schemes or protocols
- G06Q20/38—Payment protocols; Details thereof
- G06Q20/382—Payment protocols; Details thereof insuring higher security of transaction
- G06Q20/3825—Use of electronic signatures
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q20/00—Payment architectures, schemes or protocols
- G06Q20/38—Payment protocols; Details thereof
- G06Q20/382—Payment protocols; Details thereof insuring higher security of transaction
- G06Q20/3829—Payment protocols; Details thereof insuring higher security of transaction involving key management
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/06—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols the encryption apparatus using shift registers or memories for block-wise or stream coding, e.g. DES systems or RC4; Hash functions; Pseudorandom sequence generators
- H04L9/0643—Hash functions, e.g. MD5, SHA, HMAC or f9 MAC
Landscapes
- Engineering & Computer Science (AREA)
- Business, Economics & Management (AREA)
- Accounting & Taxation (AREA)
- Computer Security & Cryptography (AREA)
- Physics & Mathematics (AREA)
- Strategic Management (AREA)
- Finance (AREA)
- General Business, Economics & Management (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Power Engineering (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Storage Device Security (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The embodiment of the invention relates to a block output method and device relating to a block chain. The method comprises the following steps: if the generated first block is larger than a first threshold value, dividing the first block into a first sub-block and at least one second sub-block; performing a first hash operation according to the first block to obtain a first hash value; determining a second hash value of the plurality of out-of-block nodes; selecting a specified number of second hash values according to the size of the second hash values of the plurality of block outlet nodes; performing a fourth hash operation on the second hash values with the specified number to obtain a fourth hash value; and selecting at least one second block outlet node from the plurality of block outlet nodes to be used as the block outlet node of the at least one second sub-block respectively according to the fourth hash value and a preset random rule. Therefore, the next block output node can be designated by the block output node, the designation process has certain randomness and verifiability, and the block output efficiency and the accounting efficiency of the block link node network are improved.
Description
Technical Field
The invention relates to the technical field of computers, in particular to a block output method and device relating to a block chain.
Background
Each node in the blockchain network is equivalent to each computer or server terminal storing all the block data. The production of all new blocks, as well as the verification and accounting of transactions and broadcasting them to the network-wide sync, is done by the nodes.
The node is the miner which we commonly call. The different power of each miner determines how much billing rights it can allocate and how much rewards it can earn.
The first generation of consensus mechanism for block chains is called POW, which is a workload proving consensus mechanism and is commonly called mining. Thousands of hash hits must be performed to create a new block. These operations consume much power and cause energy waste, so they are also affected by the scale. Even more feared is that once most of the computing power is monopolized, decentralization is threatened.
The second generation of consensus mechanism called POS is the rights and interests identification mechanism, which decides who has more accounting rights according to the amount of money held and the time. The recognition mechanism has the advantages of avoiding energy consumption, but has the disadvantages that the speaking right is controlled by the large user holding the money, the characteristic of central collection right is formed, and the characteristic runs counter to the original intention of decentralization of the block chain.
The third generation consensus mechanism is DPOS, and the biggest characteristic of the mechanism is that an election system is added on the basis of POS right certificate. The super nodes which finally obtain the billing right and are produced by voting of all the money-holding users can perform billing, so that the energy waste can be greatly reduced, but the calculation requirements on the super nodes are high due to the centralized calculation on the super nodes, and the efficiency of the super nodes directly influences the billing efficiency, so that the mode has weak capacity of dealing with large-scale data, and the development is restricted.
Disclosure of Invention
Based on the above problems, embodiments of the present invention provide a block output method and apparatus related to a block chain.
In a first aspect, an embodiment of the present invention provides a block output method related to a block chain. The block-link node network comprises a plurality of block output nodes, the method is applied to a first block output node, the first block output node is any one of the plurality of block output nodes, and the method comprises the following steps:
if the generated first block is larger than a first threshold value, dividing the first block into a first sub-block and at least one second sub-block, wherein the first block outlet node is used as a block outlet node of the first sub-block;
performing a first hash operation according to the first block to obtain a first hash value;
sending the first hash value to other nodes of the plurality of out-of-block nodes;
determining second hash values of the plurality of block output nodes, wherein the second hash value of each block output node is obtained by performing second hash operation on a third hash value and the first numerical value of the block output node; the third hash value is obtained by performing third hash operation on the second block; determining a first value of each block output node according to the signature of the block output node on the first hash value; the second block is a next block of the first block;
selecting a specified number of second hash values according to the size of the second hash values of the plurality of block outlet nodes;
performing a fourth hash operation on the second hash values with the specified number to obtain a fourth hash value;
and selecting at least one second block outlet node from the plurality of block outlet nodes to be used as the block outlet node of the at least one second sub-block respectively according to the fourth hash value and a preset random rule.
In some embodiments, the method further comprises:
signing the first hash value to obtain a first digital signature of the first block output node;
and performing fifth hash operation on the first digital signature of the first block output node to obtain a first numerical value of the first block output node.
In some embodiments, further comprising:
receiving a fifth hash value sent by a third block outlet node, wherein the fifth hash value is obtained by performing a first hash operation on a third block by the third block outlet node;
signing the fifth hash value to obtain a second digital signature of the first block output node;
performing a fifth hash operation on the second digital signature of the first block output node to obtain a second numerical value of the first block output node;
performing a third hash operation according to a fourth block to obtain a sixth hash value, wherein the fourth block is a block next to the third block;
performing a second hash operation according to the sixth hash value and the second value of the first block output node to obtain a seventh hash value of the first block output node;
and sending the seventh hash value of the first block output node to the second block output node.
In some embodiments, the performing a fourth hash operation on the specified number of second hash values to obtain a fourth hash value includes:
and performing fourth hash operation on the second hash values and the third numerical values of the specified number to obtain a fourth hash value, wherein the third numerical value is 1-n or the serial number of the first block-out node, and n is an arbitrary value.
In some embodiments, the preset random rule comprises:
converting the fourth hash value into a 10-system, and taking the remainder of the number of the verification nodes;
and determining the verification node corresponding to the remainder as the second block output node.
In some embodiments, further comprising:
transmitting the first digital signature to the plurality of egress block nodes.
In some embodiments, further comprising:
receiving a third digital signature sent by a fourth block outlet node, wherein the third digital signature is specific to a fifth block, and the fifth block is divided into a third sub-block and at least one fourth sub-block;
verifying the third digital signature of the fourth block output node by using the public key of the fourth block output node to obtain an eighth hash value of the first block output node;
performing a first hash operation on the fifth block to obtain a ninth hash value;
if the eighth hash value is the same as the ninth hash value, selecting a specified number of tenth hash values according to the size of the tenth hash values of the plurality of out-of-block nodes; the tenth hash value of each block output node is obtained by performing second hash operation on the eleventh hash value and the fourth numerical value of the block output node; the eleventh hash value is obtained by performing a third hash operation on a sixth block; determining a fourth numerical value of each block output node according to the signature of the block output node on the eighth hash value; the sixth block is a block next to the fifth block
Performing a fourth hash operation on the tenth hash values of the specified number to obtain twelfth hash values;
judging whether the first block output node is the block output node of the at least one fourth sub-block or not according to the twelfth hash value and a preset random rule;
and if so, packaging one of the at least one fourth sub-block.
In some embodiments, the determining, according to the twelfth hash value and a preset random rule, whether the first out-block node is an out-block node of the at least one fourth sub-block includes:
determining the serial number of the block outlet node of at least one fourth sub-block according to the twelfth hash value and a preset random rule;
and judging whether the sequence number of the block outlet node of the at least one fourth sub-block is the sequence number of the first block outlet node in the plurality of block outlet nodes.
In a second aspect, an out-of-block apparatus involving a blockchain is provided. The block-link node network comprises a plurality of block output nodes, the apparatus is adapted to a first block output node, which is any one of the plurality of block output nodes, and the apparatus comprises:
the block dividing unit is used for dividing the generated first block into a first sub-block and at least one second sub-block if the generated first block is larger than a first threshold value, wherein the first block outlet node is used as a block outlet node of the first sub-block;
the hash unit is used for carrying out first hash operation according to the first block to obtain a first hash value;
a sending unit, configured to send the first hash value to other nodes in the plurality of out-of-block nodes;
the determining unit is used for determining second hash values of the plurality of block output nodes, and the second hash value of each block output node is obtained by performing second hash operation on a third hash value and the first numerical value of the block output node; the third hash value is obtained by performing third hash operation on the second block; determining a first value of each block output node according to the signature of the block output node on the first hash value; the second block is a next block of the first block;
the selecting unit is used for selecting a specified number of second hash values according to the sizes of the second hash values of the plurality of block outlet nodes;
the hash unit is further used for performing fourth hash operation on the second hash values with the specified number to obtain fourth hash values;
the selecting unit is further configured to select at least one second block output node from the plurality of block output nodes as the block output node of the at least one second sub-block according to the fourth hash value and a preset random rule.
In some embodiments, further comprising:
the signature unit is used for signing the first hash value to obtain a first digital signature of the first block output node;
and the hash unit is used for carrying out fifth hash operation on the first digital signature of the first block output node to obtain a first numerical value of the first block output node.
In some embodiments, further comprising:
the receiving unit is configured to receive a fifth hash value sent by a third block output node, where the fifth hash value is obtained by performing a first hash operation on a third block by the third block output node;
the signature unit is used for signing the fifth hash value to obtain a second digital signature of the first block output node;
the hash unit is used for carrying out fifth hash operation on the second digital signature of the first block output node to obtain a second numerical value of the first block output node;
the hash unit is used for carrying out third hash operation according to a fourth block to obtain a sixth hash value, wherein the fourth block is a block next to the third block;
the hash unit is used for carrying out second hash operation according to the sixth hash value and the second value of the first block output node to obtain a seventh hash value of the first block output node;
and the sending unit is used for sending the seventh hash value of the first block output node to the second block output node.
In some embodiments, the hash unit is specifically configured to:
and performing fourth hash operation on the second hash values and the third numerical values of the specified number to obtain a fourth hash value, wherein the third numerical value is 1-n or the serial number of the first block-out node, and n is an arbitrary value.
In some embodiments, the preset random rule comprises:
converting the fourth hash value into a 10-system, and taking the remainder of the number of the verification nodes;
and determining the verification node corresponding to the remainder as the second block output node.
In some embodiments, further comprising:
a sending unit, configured to send the first digital signature to the plurality of egress nodes.
In some embodiments, further comprising:
the receiving unit is used for receiving a third digital signature sent by a fourth block outlet node, wherein the third digital signature is specific to a fifth block, and the fifth block is divided into a third sub-block and at least one fourth sub-block;
the verification unit is used for verifying the third digital signature of the fourth block output node by using the public key of the fourth block output node to obtain an eighth hash value of the first block output node;
the hash unit is used for carrying out first hash operation on the fifth block to obtain a ninth hash value;
a selecting unit, configured to select a specified number of tenth hash values according to sizes of tenth hash values of the multiple block output nodes if the eighth hash value is the same as the ninth hash value; the tenth hash value of each block output node is obtained by performing second hash operation on the eleventh hash value and the fourth numerical value of the block output node; the eleventh hash value is obtained by performing a third hash operation on a sixth block; determining a fourth numerical value of each block output node according to the signature of the block output node on the eighth hash value; the sixth block is a block next to the fifth block
The hash unit is used for carrying out fourth hash operation on the tenth hash values with the specified number to obtain twelfth hash values;
a determining unit, configured to determine whether the first outgoing block node is an outgoing block node of the at least one fourth sub-block according to the twelfth hash value and a preset random rule;
and if so, the packing unit is used for packing one of the at least one fourth sub-block.
In some embodiments, the determining unit is specifically configured to:
determining the serial number of the block outlet node of at least one fourth sub-block according to the twelfth hash value and a preset random rule;
and judging whether the sequence number of the block outlet node of the at least one fourth sub-block is the sequence number of the first block outlet node.
In a third aspect, the present specification provides a computer device, including a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor executes the program to implement the method steps of any one or more of the first or second aspects.
In a fourth aspect, there is provided a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the method of any one or more of the first or second aspects described above.
In a fifth aspect, there is provided a computer program product comprising instructions which, when run on a computer, cause the computer to perform the method of any one or more of the first or second aspects described above.
Through the embodiment of the invention, the next block output node can be designated by the block output node, the designation process has certain randomness and verifiability, the possibility of successful attack of the block chain can be reduced, the block output efficiency of the block chain node network is improved, the accounting efficiency is further improved, and the block chain node network can be applied to a service scene with larger data scale.
Drawings
FIG. 1 illustrates an exemplary architecture for applying embodiments provided herein;
fig. 2 is a flowchart of a block output method related to a block chain according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of an apparatus for publishing information based on a block chain according to an embodiment of the present invention;
fig. 4 shows a schematic structural diagram of a computer device provided in an embodiment of the present specification.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. 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 output method and device relating to a block chain. Fig. 1 shows an exemplary architecture to which embodiments provided herein apply.
As shown in fig. 1, the exemplary architecture may include a plurality of blockchain nodes, which may include a plurality of out-of-block nodes 101 and a plurality of verification nodes 102. In one example, the block node may be a plurality of super nodes selected by an election mechanism, the number of the super nodes may be determined according to actual needs, and the number of the super nodes may be an odd number, for example, 21. In another example, the plurality of verification nodes may be candidate nodes, wherein the super node may be selected from the candidate nodes, the number of the candidate nodes may also be determined according to actual needs, for example, may be 100, wherein the candidate nodes may be selected according to a preset random rule, for example, a specified number of nodes with the highest computational power may be used as the candidate nodes. In another example, the verification node may also be all or part of a node other than the out-of-block node. The block link point may be implemented in a software form or a hardware form. When implemented as hardware, it may be a notebook computer, a desktop computer, a mobile terminal, and the like.
The block-out node is mainly used for producing the data blocks in a specified time period in the system based on a consensus mechanism, namely mainly used for accounting. The verification node is mainly used for verifying the blocks generated by the block generation node based on a consensus mechanism, and the verified blocks are recorded in the block chain. The nodes may communicate with each other to synchronize data such as blockchains. For example, the nodes may communicate based on the D2D protocol.
For the purpose of facilitating understanding of the embodiments of the present invention, the following description will be further explained with reference to specific embodiments, which are not to be construed as limiting the embodiments of the present invention.
Fig. 2 is a flowchart of a block output method related to a block chain according to the present invention. The block-linked node network includes a plurality of out-block nodes, such as the block-linked node network in the exemplary architecture shown in fig. 1, and the method is applied to a first out-block node, which is any one of the plurality of out-block nodes. As shown in fig. 2, the method specifically includes:
s210, if the generated first block is larger than a first threshold value, dividing the first block into a first sub-block and at least one second sub-block, wherein the first block outlet node is used as a block outlet node of the first sub-block.
Wherein each node in the block-link node network operates based on a consensus mechanism. The consensus mechanism is predefined and may include a block consensus mechanism, a verification consensus mechanism, and the like.
The block output node in the block link node network may determine a first block output node according to a block output consensus mechanism, and the first block output node may generate a block from data in a specified time period in the system. The specified time period can be determined according to actual needs, and can be 1 second, 10 seconds, 3 minutes, 10 minutes or the like, for example. The system may be the entire blockchain system corresponding to the blockchain link point network. The block chain is composed of a plurality of blocks, and each block can carry a storage structure with the identification of the last block forming a chain.
After the first block is determined by the first block output node, if it is determined that the first block is greater than the first threshold, it is determined that the first block is too large and the block output efficiency is affected, the first block may be divided into a plurality of sub-blocks, and the sub-blocks are packed by different block output nodes, so as to improve the packing efficiency.
Wherein, the first threshold value can be determined according to actual needs.
For the partition rule of the sub-block, it may be determined according to actual needs, for example, it may be determined that a maximum time interval of the data of the block being smaller than the first threshold is reached, and then the sub-block is partitioned according to the maximum time interval. For example, the maximum time interval may be 1 minute and one block 3 minutes, and then, may be divided into three 1-minute sub-blocks.
S220, performing a first hash operation according to the first block to obtain a first hash value.
When a current blockchain node needs to determine a next node needing to generate a block in generating the block, the current blockchain node may be called a first out-of-block node, the next node needing to generate the block may be called a second out-of-block node, the block generated by the current blockchain node may be called a first block, and the block generated by the next node needing to generate the block may be called a second block.
In order to increase the efficiency of selecting the out-of-block nodes of the node and reduce the load of the system, when the next out-of-block node is selected, the first hash operation may be performed on the first block to obtain a first hash value. The verification consensus mechanism may include a predefined first hash operation, which may be determined according to actual needs, for example, the first hash operation may be SHA-256 or the like.
S230, sending the first hash value to other nodes in the plurality of out-block nodes;
the plurality of egress block nodes may be all egress block nodes.
S240, determining second hash values of the plurality of out-of-block nodes.
The second hash value of each block output node is obtained by performing second hash operation on the third hash value and the first numerical value of the block output node; the third hash value is obtained by performing third hash operation on the second block; and the first value of each block output node is determined according to the signature of the block output node on the first hash value, and the second block is the next block of the first block.
Each block output node signs the first hash value to obtain a first digital signature of the block output node; the first digital signature of the out-of-block node may be used as the first value of the out-of-block node. Or, each block output node performs a third hash operation on the first digital signature of the block output node to obtain a first value of the block output node.
In one example, a first out-of-block node may sign the first hash value, resulting in a first digital signature of the first out-of-block node; the first block output node may perform a fifth hash operation on the first digital signature of the first block output node to obtain a first value of the first block output node.
Each blockchain node may include at least one key pair, each key pair including a public key and a private key, the private key may be stored locally, and the public key may be sent to other blockchain nodes.
After the current block node determines the first hash value, the first hash value may be signed to obtain a first digital signature. The first signature of the block output node may be signed by using a private key of the block output node, and the first signature of the block output node may be verified by using a public key corresponding to the private key.
The method may further comprise: and determining a third hash value, wherein the third hash value is obtained by performing a third hash operation according to the second block.
Each out-of-block node may calculate the third hash value. Then, each block output node may obtain a second hash value of the block output node by performing a second hash operation on the third hash value and the first value of the block output node.
In one example, the first out-block node signs the first hash value, resulting in a first digital signature of the first out-block node; performing a fifth hash operation on the first digital signature of the first block output node to obtain a first numerical value of the first block output node; performing a third hash operation according to the second block to obtain a third hash value; and performing second hash operation according to the third hash value and the first numerical value of the first block output node to obtain a second hash value of the first block output node.
And S250, selecting a specified number of second hash values according to the sizes of the second hash values of the plurality of out-of-block nodes.
The second hash values of the plurality of out-of-block nodes may be sorted, and a specified number of second hash values with a larger or smaller value may be selected. The specified number may be determined according to actual needs, and for example, the specified number may be 2.
And S260, performing fourth hash operation on the second hash values with the specified number to obtain a fourth hash value.
When the block node is determined, a fourth hash operation may be performed on the specified number of second hash values to obtain a fourth hash value. The block-out consensus mechanism may include a predefined fourth hash operation, and the third hash operation may be determined according to actual needs, for example, the fourth hash operation may be SHA-256 or the like.
And S270, selecting at least one second block outlet node from the plurality of block outlet nodes as the block outlet node of the at least one second sub-block respectively according to the fourth hash value and a preset random rule.
In some embodiments, the precedence relationship may be determined according to a size relationship of the sequence number of the at least one second block output node, and the sequence relationships may be used as the block output nodes of the at least one second sub-block, respectively. For example, each of the block-out sub-nodes is divided according to time, and the second block-out node of each of the block-out sub-nodes can be determined by matching the time precedence relationship of the block-out sub-nodes and the precedence relationship of the second block-out node.
When the block node is determined, the selection may be performed according to the fourth hash value. The block-out consensus mechanism may include a preset random rule according to which the block is selected, where the preset random rule has certain randomness and verifiability.
In one example, the preset random rule may include:
converting the fourth hash value into a 10-system, and taking the remainder of the fourth numerical value;
and determining the block output node corresponding to the remainder as a second block output node.
Wherein the fourth value may be determined according to the number of the out-block nodes. For example, the number of out-of-block nodes may be 100, and the third value may be 100.
The randomness is guaranteed through the fourth hash value, and the verifiability of the second block outlet node is guaranteed through the determination of the fourth hash value and a preset random rule.
In the embodiment of the present invention, any two operations of the first hash operation, the second hash operation, the third hash operation, the fourth hash operation, and the fifth hash operation may be the same or different hash operations. In one example, the first hash operation, the second hash operation, the third hash operation, the fourth hash operation, and the fifth hash operation may be the same hash operation, and in another example, the first hash operation, the second hash operation, the third hash operation, the fourth hash operation, and the fifth hash operation may be different hash operations.
The first out-block node may send the first digital signature to the second out-block node for the second out-block node to continue out-blocking. For example, the first digital signature may be transmitted to the plurality of out-blocking nodes by way of broadcasting.
The public keys of the first block and the first out-block node may also be sent to a second out-block node. The form of sending the public key may include various forms. In one example, the address of the out-of-block node may be generated from the public key, the address may be a roll-out or roll-in address for the transaction, and the second out-of-block node may determine the public key of the out-of-block node from the address of the out-of-block node. In another example, the public key may be sent carried in the first block.
After receiving the first digital signature, the second block output node may first verify the identity of the first block output node, and the identity of the block output node may be implemented by verifying the first digital signature through a public key of the block output node. After the verification is passed, the second out-block node may verify its own verification identity, and the verification process may perform verification based on a preset random rule to verify whether the out-block node of the second block includes itself. And after the two verification processes are passed, the second block outlet node packs the second block and performs full network synchronization on the packed second block.
In some embodiments, further comprising:
1) receiving a fifth hash value sent by a third block outlet node, wherein the fifth hash value is obtained by performing a first hash operation on a third block by the third block outlet node;
2) signing the fifth hash value to obtain a second digital signature of the first block output node;
3) performing a fifth hash operation on the second digital signature of the first block output node to obtain a second numerical value of the first block output node;
4) performing a third hash operation according to a fourth block to obtain a sixth hash value, wherein the fourth block is a block next to the third block;
5) performing second hash operation according to a sixth hash value and the second value of the first block output node to obtain a seventh hash value of the first block output node;
6) and sending the seventh hash value of the first block output node to the second block output node.
In some embodiments, the step S240 may be specifically implemented by the following steps:
and performing fourth hash operation on the second hash values and the third numerical values in the specified number to obtain a fourth hash value.
Wherein the third value is a predefined fixed value such as 1-n, and n is an arbitrary value.
The third value may also be a sequence number of the first out-of-block node, or a value determined from the sequence number of the first out-of-block node. By this third value, the randomness of the selection of the block nodes can be further achieved.
In some embodiments, the following steps may also be included:
1) receiving a third digital signature sent by a fourth block outlet node, wherein the third digital signature is specific to a fifth block, and the fifth block is divided into a third sub-block and at least one fourth sub-block; verifying the third digital signature of the fourth block output node by using the public key of the fourth block output node to obtain an eighth hash value of the first block output node;
2) performing a first hash operation on the fifth block to obtain a ninth hash value;
3) if the eighth hash value is the same as the ninth hash value, selecting a specified number of tenth hash values according to the size of the tenth hash values of the plurality of out-of-block nodes; the tenth hash value of each block output node is obtained by performing second hash operation on the eleventh hash value and the fourth numerical value of the block output node; the eleventh hash value is obtained by performing a third hash operation on a sixth block; determining a fourth numerical value of each block output node according to the signature of the block output node on the eighth hash value; the sixth block is a block next to the fifth block
4) Performing a fourth hash operation on the tenth hash values of the specified number to obtain twelfth hash values;
5) judging whether the first block output node is the block output node of the at least one fourth sub-block or not according to the twelfth hash value and a preset random rule;
6) if yes, packing one of the at least one fourth sub-block;
7) if not, the process is ended. In step 1), a fifth block, a public key and a third digital signature sent by the fourth out-of-block node may be received.
The fifth block may be a block newly generated by the fourth out-block node. The third digital signature may be determined according to the fifth block. Specifically, reference may be made to the foregoing process for acquiring the first digital signature, which is not described herein again.
The first block output node may further determine a public key of a fourth block output node, where the public key may be determined according to an address of the fourth block output node, and may also obtain the public key carried in the fifth block.
In step 5), the sequence number of the out-block node of at least one fourth sub-block may be determined according to the twelfth hash value and a preset random rule; and judging whether the sequence number of the block outlet node of at least one fourth sub-block comprises the sequence number of the first block outlet node.
In step 3), it may be compared whether the eighth hash value and the ninth hash value are the same, and if they are the same, this indicates that the third digital signature is the digital signature of the out-block node, that is, the verification is passed. If not, the verification fails.
In that
In addition, the second block can also be a block before the first block. The method can be realized by the following steps: a: at least one verified block prior to the first block specified interval is determined. The designated interval may be determined according to the number of the plurality of out-of-block nodes;
b: and respectively carrying out third hash operation on each of the at least one verified block to obtain at least one third hash value.
In one example, a third hash value may be determined, the third hash value may be determined according to the nth chunk before the first chunk, n may be an integer greater than 0, and the n chunks may be the specified interval in the foregoing step a. For example, the value of n may be the number of the multiple out-of-block nodes, for example, the number of out-of-block nodes is 21, and n may be 21.
In another example, a plurality of third hash values may be determined, which may be determined from a plurality of blocks consecutive from an nth block before the first block. The value of n may be the number of the plurality of block-out nodes, and the number of the plurality of consecutive blocks may be a preset value, and the preset value may be determined according to actual needs, for example, 5.
In another example, a plurality of third hash values may be determined, where the plurality of third hash values may be determined according to a plurality of blocks of every n blocks before the first block, and a value of the interval n may be determined according to a number of a plurality of out-of-block nodes, for example, the number of out-of-block nodes is 21, and n may be 20.
The verification consensus mechanism may include a predefined third hash operation, which may be determined according to actual needs, for example, the third hash operation may be SHA-256 or the like.
Through the embodiment of the invention, the next block output node can be designated by the block output node, the designation process has certain randomness and verifiability, the possibility of successful attack of the block chain can be reduced, the block output efficiency of the block chain node network is improved, the accounting efficiency is further improved, and the block chain node network can be applied to a service scene with larger data scale. Fig. 3 is a schematic structural diagram of a block output device related to a block chain according to an embodiment of the present invention. The block-link point network includes a plurality of block output nodes, for example, the block-link point network in the exemplary architecture shown in fig. 1, and the apparatus is adapted to a current block output node, where the current block output node is any one of the plurality of block output nodes, and the apparatus includes:
a block dividing unit 301, configured to divide a generated first block into a first sub-block and at least one second sub-block if the generated first block is greater than a first threshold, where the first block output node is used as a block output node of the first sub-block;
a hash unit 302, configured to perform a first hash operation according to the first block to obtain a first hash value;
a sending unit 303, configured to send the first hash value to other nodes in the plurality of out-of-block nodes;
a determining unit 304, configured to determine second hash values of the multiple block output nodes, where the second hash value of each block output node is obtained by performing a second hash operation on a third hash value and the first value of the block output node; the third hash value is obtained by performing third hash operation on the second block; determining a first value of each block output node according to the signature of the block output node on the first hash value; the second block is a next block of the first block;
a selecting unit 305, configured to select a specified number of second hash values according to sizes of the second hash values of the multiple out-of-block nodes;
the hash unit 302 is further configured to perform a fourth hash operation on the specified number of second hash values to obtain a fourth hash value;
the selecting unit 305 is further configured to select at least one second out-block node from the multiple out-block nodes as the out-block nodes of the at least one second sub-block according to the fourth hash value and a preset random rule.
In some embodiments, further comprising:
the signature unit is used for signing the first hash value to obtain a first digital signature of the first block output node;
and the hash unit is used for carrying out fifth hash operation on the first digital signature of the first block output node to obtain a first numerical value of the first block output node.
In some embodiments, further comprising:
the receiving unit is configured to receive a fifth hash value sent by a third block output node, where the fifth hash value is obtained by performing a first hash operation on a third block by the third block output node;
the signature unit is used for signing the fifth hash value to obtain a second digital signature of the first block output node;
the hash unit is used for carrying out fifth hash operation on the second digital signature of the first block output node to obtain a second numerical value of the first block output node;
the hash unit is used for carrying out third hash operation according to a fourth block to obtain a sixth hash value, wherein the fourth block is a block next to the third block;
the hash unit is used for carrying out second hash operation according to the sixth hash value and the second value of the first block output node to obtain a seventh hash value of the first block output node;
and the sending unit is used for sending the seventh hash value of the first block output node to the second block output node.
In some embodiments, the hash unit is specifically configured to:
and performing fourth hash operation on the second hash values and the third numerical values of the specified number to obtain a fourth hash value, wherein the third numerical value is 1-n or the serial number of the first block-out node, and n is an arbitrary value.
In some embodiments, the preset random rule comprises:
converting the fourth hash value into a 10-system, and taking the remainder of the number of the verification nodes;
and determining the verification node corresponding to the remainder as the second block output node.
In some embodiments, further comprising:
a sending unit, configured to send the first digital signature to the plurality of egress nodes.
In some embodiments, further comprising:
the receiving unit is used for receiving a third digital signature sent by a fourth block outlet node, wherein the third digital signature is specific to a fifth block, and the fifth block is divided into a third sub-block and at least one fourth sub-block;
the verification unit is used for verifying the third digital signature of the fourth block output node by using the public key of the fourth block output node to obtain an eighth hash value of the first block output node;
the hash unit is used for carrying out first hash operation on the fifth block to obtain a ninth hash value;
a selecting unit, configured to select a specified number of tenth hash values according to sizes of tenth hash values of the multiple block output nodes if the eighth hash value is the same as the ninth hash value; the tenth hash value of each block output node is obtained by performing second hash operation on the eleventh hash value and the fourth numerical value of the block output node; the eleventh hash value is obtained by performing a third hash operation on a sixth block; determining a fourth numerical value of each block output node according to the signature of the block output node on the eighth hash value; the sixth block is a block next to the fifth block
The hash unit is used for carrying out fourth hash operation on the tenth hash values with the specified number to obtain twelfth hash values;
a determining unit, configured to determine whether the first outgoing block node is an outgoing block node of the at least one fourth sub-block according to the twelfth hash value and a preset random rule;
and if so, the packing unit is used for packing one of the at least one fourth sub-block.
In some embodiments, the determining unit is specifically configured to:
determining the serial number of the block outlet node of at least one fourth sub-block according to the twelfth hash value and a preset random rule;
and judging whether the sequence number of the block outlet node of the at least one fourth sub-block is the sequence number of the first block outlet node.
It can be understood that the block output apparatus related to the block chain in this embodiment corresponds to the method embodiment shown in fig. 2, and therefore, the above description about the method embodiment shown in fig. 2 is also applicable to the apparatus in this embodiment, and is not repeated herein.
Fig. 4 shows a schematic structural diagram of a computer device provided in an embodiment of the present specification, where the computer device may include: a processor 410, a memory 420, an input/output interface 430, a communication interface 440, and a bus 450. Wherein the processor 440, the memory 420, the input/output interface 430 and the communication interface 440 are communicatively coupled to each other within the device via a bus 450.
The processor 410 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an Application Specific Integrated Circuit (ASIC), or one or more Integrated circuits, and is configured to execute related programs to implement the technical solutions provided in the embodiments of the present specification.
The Memory 420 may be implemented in the form of a ROM (Read Only Memory), a RAM (Random access Memory), a static storage device, a dynamic storage device, or the like. The memory 420 may store an operating system and other application programs, and when the technical solution provided by the embodiments of the present specification is implemented by software or firmware, the relevant program codes are stored in the memory 420 and called to be executed by the processor 410.
The input/output interface 430 is used for connecting an input/output module to realize information input and output. The i/o module may be configured as a component in a device (not shown) or may be external to the device to provide a corresponding function. The input devices may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output devices may include a display, a speaker, a vibrator, an indicator light, etc.
The communication interface 440 is used for connecting a communication module (not shown in the figure) to realize communication interaction between the device and other devices. The communication module can realize communication in a wired mode (such as USB, network cable and the like) and also can realize communication in a wireless mode (such as mobile network, WIFI, Bluetooth and the like).
It should be noted that although the above-mentioned device only shows the processor 410, the memory 420, the input/output interface 430, the communication interface 440 and the bus 450, in a specific implementation, the device may also include other components necessary for normal operation. In addition, those skilled in the art will appreciate that the above-described apparatus may also include only those components necessary to implement the embodiments of the present description, and not necessarily all of the components shown in the figures.
Those of skill would further appreciate that the various illustrative components and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied in hardware, a software module executed by a processor, or a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The above-mentioned embodiments are intended to illustrate the objects, technical solutions and advantages of the present invention in further detail, and it should be understood that the above-mentioned embodiments are only illustrative of the present invention and are not intended to limit the scope of the present invention, and any modifications, equivalent substitutions, improvements and the like made within the scope of the present invention should be included in the scope of the present invention.
Claims (10)
1. A block dropping method involving a block chain, wherein a block-link node network includes a plurality of block dropping nodes, and wherein the method is applied to a first block dropping node, which is any one of the plurality of block dropping nodes, and the method includes:
if the generated first block is larger than a first threshold value, dividing the first block into a first sub-block and at least one second sub-block, wherein the first block outlet node is used as a block outlet node of the first sub-block;
performing a first hash operation according to the first block to obtain a first hash value;
sending the first hash value to other nodes of the plurality of out-of-block nodes;
determining second hash values of the plurality of block output nodes, wherein the second hash value of each block output node is obtained by performing second hash operation on a third hash value and the first numerical value of the block output node; the third hash value is obtained by performing third hash operation on the second block; determining a first value of each block output node according to the signature of the block output node on the first hash value; the second block is a next block of the first block;
selecting a specified number of second hash values according to the size of the second hash values of the plurality of block outlet nodes;
performing a fourth hash operation on the second hash values with the specified number to obtain a fourth hash value;
and selecting at least one second block outlet node from the plurality of block outlet nodes to be used as the block outlet node of the at least one second sub-block respectively according to the fourth hash value and a preset random rule.
2. The method of claim 1, further comprising:
signing the first hash value to obtain a first digital signature of the first block output node;
and performing fifth hash operation on the first digital signature of the first block output node to obtain a first numerical value of the first block output node.
3. The method of claim 2, further comprising:
receiving a fifth hash value sent by a third block outlet node, wherein the fifth hash value is obtained by performing a first hash operation on a third block by the third block outlet node;
signing the fifth hash value to obtain a second digital signature of the first block output node;
performing a fifth hash operation on the second digital signature of the first block output node to obtain a second numerical value of the first block output node;
performing a third hash operation according to a fourth block to obtain a sixth hash value, wherein the fourth block is a block next to the third block;
performing a second hash operation according to the sixth hash value and the second value of the first block output node to obtain a seventh hash value of the first block output node;
and sending the seventh hash value of the first block output node to the second block output node.
4. The method of claim 1, wherein performing a fourth hash operation on the specified number of second hash values to obtain a fourth hash value comprises:
and performing fourth hash operation on the second hash values and the third numerical values of the specified number to obtain a fourth hash value, wherein the third numerical value is 1-n or the serial number of the first block-out node, and n is an arbitrary value.
5. The method of claim 1, wherein the preset random rule comprises:
converting the fourth hash value into a 10-system, and taking the remainder of the number of the plurality of verification nodes;
and determining the verification node corresponding to the remainder as the second block output node.
6. The method of claim 1, further comprising:
sending a first digital signature to the plurality of out-of-block nodes.
7. The method of claim 6, further comprising:
receiving a third digital signature sent by a fourth block outlet node, wherein the third digital signature is specific to a fifth block, and the fifth block is divided into a third sub-block and at least one fourth sub-block; verifying the third digital signature of the fourth block output node by using the public key of the fourth block output node to obtain an eighth hash value of the first block output node;
performing a first hash operation on the fifth block to obtain a ninth hash value;
if the eighth hash value is the same as the ninth hash value, selecting a specified number of tenth hash values according to the size of the tenth hash values of the plurality of out-of-block nodes; the tenth hash value of each block output node is obtained by performing second hash operation on the eleventh hash value and the fourth numerical value of the block output node; the eleventh hash value is obtained by performing a third hash operation on a sixth block; determining a fourth numerical value of each block output node according to the signature of the block output node on the eighth hash value; the sixth block is a block next to the fifth block
Performing a fourth hash operation on the tenth hash values of the specified number to obtain twelfth hash values;
judging whether the first block output node is the block output node of the at least one fourth sub-block or not according to the twelfth hash value and a preset random rule;
and if so, packaging one of the at least one fourth sub-block.
8. The method according to claim 7, wherein the determining whether the first chunking node is the chunking node of the fifth chunk according to the twelfth hash value and a preset random rule comprises:
determining the serial number of the block outlet node of at least one fourth sub-block according to the twelfth hash value and a preset random rule;
and judging whether the sequence number of the block outlet node of the at least one fourth sub-block is the sequence number of the first block outlet node.
9. A block dropping apparatus relating to a block chain, wherein a block chain node network comprises a plurality of block dropping nodes, the apparatus is adapted to a first block dropping node, which is any one of the plurality of block dropping nodes, and the apparatus comprises:
the block dividing unit is used for dividing the generated first block into a first sub-block and at least one second sub-block if the generated first block is larger than a first threshold value, wherein the first block outlet node is used as a block outlet node of the first sub-block;
the hash unit is used for carrying out first hash operation according to the first block to obtain a first hash value;
a sending unit, configured to send the first hash value to other nodes in the plurality of out-of-block nodes;
the determining unit is used for determining second hash values of the plurality of block output nodes, and the second hash value of each block output node is obtained by performing second hash operation on a third hash value and the first numerical value of the block output node; the third hash value is obtained by performing third hash operation on the second block; determining a first value of each block output node according to the signature of the block output node on the first hash value; the second block is a next block of the first block;
the selecting unit is used for selecting a specified number of second hash values according to the sizes of the second hash values of the plurality of block outlet nodes;
the hash unit is further used for performing fourth hash operation on the second hash values with the specified number to obtain fourth hash values;
the selecting unit is further configured to select at least one second block output node from the plurality of block output nodes as the block output node of the at least one second sub-block according to the fourth hash value and a preset random rule.
10. A machine-readable storage medium having stored thereon machine-executable instructions which, when invoked and executed by a processor, cause the processor to implement the method of any of claims 1 to 8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910519267.4A CN110245950B (en) | 2019-06-17 | 2019-06-17 | Block discharging method and device related to block chain |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910519267.4A CN110245950B (en) | 2019-06-17 | 2019-06-17 | Block discharging method and device related to block chain |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110245950A CN110245950A (en) | 2019-09-17 |
CN110245950B true CN110245950B (en) | 2020-08-04 |
Family
ID=67887428
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910519267.4A Active CN110245950B (en) | 2019-06-17 | 2019-06-17 | Block discharging method and device related to block chain |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110245950B (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107078903A (en) * | 2016-12-23 | 2017-08-18 | 深圳前海达闼云端智能科技有限公司 | Digging ore deposit method, device and the node device of block chain |
CN107918666A (en) * | 2017-11-24 | 2018-04-17 | 中钞***产业发展有限公司杭州区块链技术研究院 | Method of data synchronization and system on a kind of block chain |
CN108667836A (en) * | 2018-05-08 | 2018-10-16 | 众安信息技术服务有限公司 | Block chain common recognition method |
CN109743173A (en) * | 2018-12-20 | 2019-05-10 | 弗洛格(武汉)信息科技有限公司 | Go out block node in block chain and determines method, block verification method and block catenary system |
CN109785130A (en) * | 2018-12-17 | 2019-05-21 | 金蝶软件(中国)有限公司 | Block chain is known together method, apparatus, computer equipment and storage medium at random |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107659429A (en) * | 2017-08-11 | 2018-02-02 | 四川大学 | Data sharing method based on block chain |
US20190141026A1 (en) * | 2017-11-07 | 2019-05-09 | General Electric Company | Blockchain based device authentication |
US20190172059A1 (en) * | 2017-12-05 | 2019-06-06 | Bank Of America Corporation | Real-time net settlement by distributed ledger system |
KR20190070163A (en) * | 2017-12-12 | 2019-06-20 | 엔에이치엔 주식회사 | Resources operating method of each of nodes communicating one another and computer device operating as one of nodes |
-
2019
- 2019-06-17 CN CN201910519267.4A patent/CN110245950B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107078903A (en) * | 2016-12-23 | 2017-08-18 | 深圳前海达闼云端智能科技有限公司 | Digging ore deposit method, device and the node device of block chain |
CN107918666A (en) * | 2017-11-24 | 2018-04-17 | 中钞***产业发展有限公司杭州区块链技术研究院 | Method of data synchronization and system on a kind of block chain |
CN108667836A (en) * | 2018-05-08 | 2018-10-16 | 众安信息技术服务有限公司 | Block chain common recognition method |
CN109785130A (en) * | 2018-12-17 | 2019-05-21 | 金蝶软件(中国)有限公司 | Block chain is known together method, apparatus, computer equipment and storage medium at random |
CN109743173A (en) * | 2018-12-20 | 2019-05-10 | 弗洛格(武汉)信息科技有限公司 | Go out block node in block chain and determines method, block verification method and block catenary system |
Non-Patent Citations (1)
Title |
---|
《一种优化的权益证明共识策略》;夏昌琳 等;《一种优化的权益证明共识策略》;20190531(第5期);25-34 * |
Also Published As
Publication number | Publication date |
---|---|
CN110245950A (en) | 2019-09-17 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110247753B (en) | Block output method and device based on block chain node point network | |
CN110222537B (en) | Verification method and device applied to block chain nodes | |
CN110223070B (en) | Verification method and device based on block chain node point network | |
CN110225044B (en) | Verification method and device on block chain | |
CN110210865A (en) | Packaging method and device based on block chain | |
CN110233722B (en) | Block output method and device on block chain | |
CN110222538B (en) | Verification method and device related to block chain | |
CN110224813B (en) | Block discharging method and device based on block chain | |
CN110224839B (en) | Verification method and device applied to block chain | |
CN110245950B (en) | Block discharging method and device related to block chain | |
CN110224840B (en) | Block chain based packaging method and device | |
CN110247773B (en) | Packing method and device on block chain | |
CN110245949B (en) | Packing method and device related to block chain | |
CN110225043B (en) | Packing method and device applied to block chain | |
CN111831669A (en) | Method and device for storing internet voting data according to block chain | |
CN110223069A (en) | Packaging method and device based on block chain meshed network | |
CN113268322A (en) | Method, system, device and storage medium for calculating resource capacity | |
CN111831670A (en) | Storage method and device related to internet comment data on block chain | |
CN111046048A (en) | Method and device for storing Internet business license data on block chain | |
CN111078795A (en) | Method and device for storing social data of internet on block chain | |
CN110990418A (en) | Asynchronous processing method and device based on block chain user data | |
CN111831671A (en) | Method and device for storing internet advertisement data on block chain | |
CN111835815A (en) | Synchronous storage method and device for internet self-media data on block chain | |
CN111831651A (en) | Storage method and device for sharing economic data on block chain through Internet | |
CN111831652A (en) | Method and device for storing internet community data on block chain |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
CB02 | Change of applicant information |
Address after: 100085 No. 108, 1st Floor, No. 9, Shangdi Jiujie, Haidian District, Beijing Applicant after: Beijing ruice Technology Co., Ltd Address before: 100085 No. 108, 1st Floor, No. 9, Shangdi Jiujie, Haidian District, Beijing Applicant before: BEIJING AIMO RUICE TECHNOLOGY Co.,Ltd. |
|
CB02 | Change of applicant information | ||
GR01 | Patent grant | ||
GR01 | Patent grant |