CN113347219B - Method and device for block chain node consensus - Google Patents

Method and device for block chain node consensus Download PDF

Info

Publication number
CN113347219B
CN113347219B CN202010136108.9A CN202010136108A CN113347219B CN 113347219 B CN113347219 B CN 113347219B CN 202010136108 A CN202010136108 A CN 202010136108A CN 113347219 B CN113347219 B CN 113347219B
Authority
CN
China
Prior art keywords
block
lucky value
node
current
lucky
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
CN202010136108.9A
Other languages
Chinese (zh)
Other versions
CN113347219A (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.)
Xuketianxia Beijing Technology Co ltd
Original Assignee
Xuketianxia Beijing Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Xuketianxia Beijing Technology Co ltd filed Critical Xuketianxia Beijing Technology Co ltd
Priority to CN202010136108.9A priority Critical patent/CN113347219B/en
Publication of CN113347219A publication Critical patent/CN113347219A/en
Application granted granted Critical
Publication of CN113347219B publication Critical patent/CN113347219B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/12Applying verification of the received information

Landscapes

  • Engineering & Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Accounting & Taxation (AREA)
  • Finance (AREA)
  • Signal Processing (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Computer Security & Cryptography (AREA)
  • General Business, Economics & Management (AREA)
  • Technology Law (AREA)
  • Physics & Mathematics (AREA)
  • Strategic Management (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Marketing (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Economics (AREA)
  • Development Economics (AREA)
  • Storage Device Security (AREA)

Abstract

The application discloses a block chain link point consensus method and device, and relates to the technical field of block chains. The method comprises the following steps: presetting a lucky value range of a block chain; calculating a lucky value which accords with a lucky value range by the seed node according to a lucky value algorithm, creating a created block and broadcasting the created block; when any current node in the block chain receives the block broadcasted by the last out-block node, calculating a lucky value according to the information of the block and verifying the lucky value, and if the lucky value is the same as the lucky value of the last out-block node and accords with a lucky value range, inserting the block; and judging whether the current block height is updated, if so, starting a first timer for timing, if so, and if the time is out and the blocks broadcasted by other nodes are not received, calculating the current lucky value, and if the lucky value is in accordance with the lucky value range, generating a new block as the current out-blocking node and broadcasting the new block. The device includes: the device comprises an initialization module, an insertion module and a generation module. The method and the device realize the quick consensus of the nodes in the block chain and improve the consensus efficiency.

Description

Method and device for block chain node consensus
Technical Field
The present application relates to the field of block chain technologies, and in particular, to a method and an apparatus for block chain link point consensus.
Background
The block chain is a new creative technology invention in the field of information technology, and a new network infrastructure is constructed by combining technologies such as distributed consensus protocol, cryptography and P2P (Peer-to-Peer, Point-to-Point) to realize decentralized and trusted transactions.
At present, there are many kinds of commonly used blockchain consensus algorithms, including workload certification, rights certification, byzantine algorithm, verifiable random equations, and some hybrid consensus algorithms combining the above consensus algorithms, or a multilayer consensus algorithm.
However, these consensus algorithms all suffer from the problem of consensus efficiency, such as the workload proving algorithm needs to consume a lot of computing power, and the byzantine algorithm requires many rounds of information exchange among multiple nodes, so that as the number of network nodes increases (more than 21 nodes), the network bandwidth rapidly becomes a system bottleneck.
Disclosure of Invention
It is an object of the present application to overcome the above problems or to at least partially solve or mitigate the above problems.
According to one aspect of the present application, there is provided a method of block link point consensus, comprising:
presetting a lucky value range of a block chain;
calculating a lucky value which accords with the lucky value range by the seed node according to a lucky value algorithm, creating a created block, and broadcasting the block in a block chain;
When any current node in the block chain receives a block broadcasted by a last out-block node, calculating a lucky value according to the information of the block and verifying the lucky value, and if the calculated lucky value is the same as the lucky value of the last out-block node and accords with the lucky value range, inserting the current node into the received block;
after completing block insertion, the current node judges whether the current block height is updated, if yes, a first timer is started for timing, when the first timer is overtime and blocks broadcasted by other nodes are not received, the current lucky value is calculated according to the lucky value algorithm, if the current lucky value accords with the lucky value range, the current node is used as a current block-out node to generate a new block, and the new block is broadcasted in the block chain;
wherein each calculation or verification of the lucky value in the blockchain is performed in a TEE (Trusted Execution Environment).
Optionally, the method further comprises:
if the current lucky value calculated by the current node does not accord with the lucky value range, determining that the current node is not the current out-of-block node, judging whether the current node is the last out-of-block node or not, if so, starting a second timer for timing, executing a block inserting process if a block broadcasted by other nodes is received before the second timer is overtime, and executing a block generating process if the second timer is overtime and the block is not received.
Optionally, the method further comprises:
if the current node receives a first block broadcasted by a first node and finishes insertion, and then receives a second block broadcasted by a second node before the first timer is overtime, if the second block is verified to be in accordance with the insertion standard and has the same height as the first block, the second block is inserted, the lucky value of the first block and the lucky value of the second block are compared, the block with the small lucky value is used as a parent block, and the block with the large lucky value is used as a tertiary block.
Optionally, if the second timer is expired and no block is received, the block generation procedure is executed, including:
if the second timer is overtime and no block is received, determining that no block is generated in all nodes in the current block chain, updating the block creation time by the current node, calculating the lucky value again according to the lucky value algorithm, and executing the block generation process according to the recalculated lucky value.
Optionally, the method further comprises:
and after the current node completes block insertion, according to the latest block chain information, if the current node is determined to have no out-block node in the current block chain, the lucky value range is expanded, and if the current node is determined to have two or more nodes which are out-block nodes, the lucky value range is reduced.
According to another aspect of the present application, there is provided a block link point consensus apparatus, comprising:
an initialization module configured to preset a lucky value range of a block chain, when serving as a seed node, calculate a lucky value conforming to the lucky value range according to a lucky value algorithm, create a created block, and then broadcast the block in the block chain;
an insertion module configured to serve as any current node in the block chain, when a block broadcasted by a last out-block node is received, calculate a lucky value according to information of the block and verify the lucky value, and if the calculated lucky value is the same as a lucky value of the last out-block node and conforms to the lucky value range, the current node inserts the received block;
a generating module configured to determine whether a current block height is updated after the current node completes block insertion, if yes, start a first timer to time, calculate a current lucky value according to the lucky value algorithm when the first timer is overtime and does not receive a block broadcasted by other nodes, if the current lucky value conforms to the lucky value range, generate a new block as a current out-blocking node, and broadcast the new block in the block chain;
Wherein each calculation or verification of a lucky value in the blockchain is performed in the trusted execution environment TEE.
Optionally, the generating module is further configured to:
if the current lucky value calculated by the current node does not accord with the lucky value range, determining that the current node is not the current out-blocking node, judging whether the current node is the last out-blocking node or not, if so, starting a second timer for timing, executing a block inserting process if blocks broadcasted by other nodes are received before the second timer is overtime, and executing a block generating process if the second timer is overtime and does not receive the blocks.
Optionally, the insertion module is further configured to:
if the current node receives a first block broadcasted by a first node and finishes insertion, and receives a second block broadcasted by a second node before the first timer times out, if the second block is verified to be in accordance with an insertion standard and has the same height as the first block, the second block is inserted, the lucky value of the first block and the lucky value of the second block are compared, the block with the small lucky value is used as a parent block, and the block with the large lucky value is used as a tertiary block.
Optionally, the generating module is specifically configured to:
if the second timer is overtime and no block is received, determining that no block is generated in all nodes in the current block chain, updating the block creation time by the current node, calculating the lucky value again according to the lucky value algorithm, and executing the block generation process according to the recalculated lucky value.
Optionally, the apparatus further comprises:
an adjusting module configured to expand the lucky value range if it is determined that there is no out-of-block node in the current blockchain according to the latest blockchain information after the current node completes block insertion, and reduce the lucky value range if it is determined that there are two or more nodes in the current blockchain that are all out-of-block nodes.
According to yet another aspect of the application, there is provided a computing device comprising a memory, a processor and a computer program stored in the memory and executable by the processor, wherein the processor implements the method as described above when executing the computer program.
According to yet another aspect of the application, a computer-readable storage medium, preferably a non-volatile readable storage medium, is provided, having stored therein a computer program which, when executed by a processor, implements a method as described above.
According to yet another aspect of the application, there is provided a computer program product comprising computer readable code which, when executed by a computer device, causes the computer device to perform the method described above.
The technical scheme provided by the application, through presetting the lucky value range of the block chain, each node in the block chain calculates the lucky value according to the same lucky value algorithm in the TEE, generate the block according to the calculated lucky value and broadcast the block in the block chain, each node receiving the block verifies with the lucky value range according to the calculated lucky value, and inserts the received block when the verification succeeds, thereby realizing the joint identification of the nodes in the block chain, the calculation times are few, the speed is very fast, the verification is simple, the calculated amount is greatly reduced, the joint identification efficiency is improved, and under the normal network bandwidth requirement, the nodes in the block chain can quickly achieve the joint identification. And the lucky value algorithm running in the TEE is protected by the TEE, so that the security guarantee of a hardware layer is provided, the security and the reliability are high, the tampering cannot be realized, and the network security is improved. In addition, the lucky value range is properly adjusted in time according to the block chain information so as to ensure that a block is generated by one out-of-block node every time, thereby avoiding resource waste and enabling the node consensus to be more efficient and optimized.
The above and other objects, advantages and features of the present application will become more apparent to those skilled in the art from the following detailed description of specific embodiments thereof, taken in conjunction with the accompanying drawings.
Drawings
Some specific embodiments of the present application will be described in detail hereinafter by way of illustration and not limitation with reference to the accompanying drawings. The same reference numbers in the drawings identify the same or similar elements or components. Those skilled in the art will appreciate that the drawings are not necessarily drawn to scale. In the drawings:
FIG. 1 is a flow diagram of a method for block link point consensus according to one embodiment of the present application;
FIG. 2 is a flow diagram of a method for block link point consensus according to another embodiment of the present application;
FIG. 3 is a block link point consensus apparatus structure according to another embodiment of the present application;
FIG. 4 is a schematic diagram of a networking according to another embodiment of the present application;
FIG. 5 is a block diagram of a computing device according to another embodiment of the present application;
fig. 6 is a diagram of a computer-readable storage medium structure according to another embodiment of the present application.
Detailed Description
The block link point consensus method and the block link point consensus device provided by the embodiment of the invention are operated in a TEE. The TEE can provide a higher secure execution environment and a more friendly use experience for the user. The TEE can be realized by software, such as t-base of Trustonic company, secure TEE of Solacia company and the like; hardware implementations are also possible, such as ARM Trust Zone technology, Intel x86-64 instruction set: SGX Software Guard Extensions, etc., which are not particularly limited in this embodiment of the present invention, preferably SGX or Trust Zone may be used. In addition, the lucky value algorithm used for carrying out the lucky value calculation can be set according to the needs, for example, the sha256 algorithm is adopted, or sha256 calculation can be carried out twice or for multiple times, or the combination of multiple algorithms and the like, so that the randomness requirement is met.
Fig. 1 is a flow chart of a method for block link point consensus according to one embodiment of the present application. Referring to fig. 1, the method includes:
101: presetting a lucky value range of a block chain;
102: calculating a lucky value which accords with a lucky value range by the seed node according to a lucky value algorithm, creating a created block, and broadcasting the block in a block chain;
103: when any current node in the block chain receives a block broadcasted by the last out-block node, calculating a lucky value according to the information of the block and verifying the lucky value, and if the calculated lucky value is the same as the lucky value of the last out-block node and accords with the lucky value range, inserting the current node into the received block;
104: after the current node finishes block insertion, judging whether the height of the current block is updated or not, if so, starting a first timer for timing, calculating a current lucky value according to a lucky value algorithm when the first timer is overtime and does not receive blocks broadcast by other nodes, and if the current lucky value conforms to a lucky value range, generating a new block as a current out-blocking node and broadcasting the new block in a block chain;
wherein each calculation or verification of a lucky value in the blockchain is performed in the trusted execution environment TEE.
In this embodiment, optionally, the method further includes:
if the current lucky value calculated by the current node does not accord with the lucky value range, determining that the current node is not the current out-block node, judging whether the current node is the last out-block node or not, if so, starting a second timer to time, if blocks broadcasted by other nodes are received before the second timer is overtime, executing a block inserting process, and if the second timer is overtime and does not receive the blocks, executing a block generating process.
In this embodiment, optionally, the method further includes:
if the current node receives the first block broadcasted by the first node and finishes inserting, and receives the second block broadcasted by the second node before the first timer times out, if the second block is verified to be in accordance with the inserting standard and has the same height as the first block, the second block is inserted, the lucky value of the first block and the lucky value of the second block are compared, the block with small lucky value is used as a parent block, and the block with large lucky value is used as a tertiary block.
In this embodiment, optionally, if the second timer is overtime and no block is received, the block generation procedure is executed, including:
If the second timer is overtime and no block is received, determining that no block is generated by all nodes in the current block chain, updating the block creation time by the current node, calculating the lucky value again according to the lucky value algorithm, and executing the block generation process according to the recalculated lucky value.
In this embodiment, optionally, the method further includes:
after the current node completes block insertion, according to the latest block chain information, if it is determined that no block node exists in the current block chain, the lucky value range is expanded, and if it is determined that two or more nodes in the current block chain are all block nodes, the lucky value range is reduced.
In the method provided by this embodiment, a lucky value range of a block chain is preset, each node in the block chain calculates a lucky value in a TEE according to the same lucky value algorithm, a block is generated according to the calculated lucky value and is broadcasted in the block chain, each node receiving the block verifies the lucky value range according to the calculated lucky value, and the received block is inserted when verification succeeds, so that consensus of the nodes in the block chain is achieved, the calculation times are few, the speed is very high, verification is simple, the calculation amount is greatly reduced, the consensus efficiency is improved, and the nodes in the block chain can quickly achieve consensus under normal network bandwidth requirements. And the lucky value algorithm running in the TEE is protected by the TEE, so that the security guarantee of a hardware layer is provided, the security and the reliability are high, the tampering cannot be performed, and the network security is improved. In addition, the lucky value range is properly adjusted in time according to the block chain information, so that a block is generated by one block outlet node every time, resource waste is avoided, and node consensus is more efficient and optimized.
Fig. 2 is a flow chart of a method of block link point consensus according to another embodiment of the present application. Referring to fig. 2, the method includes:
201: presetting a lucky value range of a block chain;
202: the seed node calculates a lucky value in accordance with the lucky value range according to a lucky value algorithm, creates a creature block and broadcasts the block in a block chain;
when the seed node creates the founding block, if the lucky value calculated for the first time is not in the lucky value range, the seed node can adjust the creation time, re-calculate the lucky value, and even can calculate for many times until the lucky value conforming to the lucky value range is obtained. In addition, for other nodes, when a new block is generated, the calculation of the lucky value can be performed only once, and multiple times of request calculation can return failure.
203: when any current node in the block chain receives a first block broadcasted by a last block outlet node, calculating a lucky value according to the information of the first block and verifying the lucky value, and if the calculated lucky value is the same as the lucky value of the last block outlet node and accords with a lucky value range, inserting the current node into the received first block;
specifically, the current node extracts information such as block node information, block output time, a block header hash value, a block output node lucky value and the like from the received first block, calculates a lucky value according to the extracted information and a lucky value algorithm, and compares and verifies the lucky value with the lucky value of the last block output node. If the verification fails, the current node discards the received first block.
204: after the current node finishes the insertion of the first block, judging whether the current block height is updated or not, if so, starting a first timer for timing, and judging whether the block broadcasted by other nodes is received or not before the first timer is overtime; if the first timer receives the second block broadcasted by the second node before the timeout, executing 205; if the first timer is out of time and blocks broadcast by other nodes are not received, then execute 206;
205: if the second block is verified to be in accordance with the insertion standard and has the same height as the first block, inserting the second block, comparing the lucky value of the first block with the lucky value of the second block, taking the block with the small lucky value as a parent block, taking the block with the large lucky value as a tertiary block, and finishing the current insertion process;
for example, after the current Node1 inserts the block BlockX produced by the other Node2, and the first timer is overtime, the Node1 receives the block BlockY with the same height produced by the other Node3, and determines whether the block BlockY meets the requirement of the lucky value range, and if not, discards the block; if the block is matched with the block, completing other validity checks of the block, and if the check is passed, performing a chain switching process as follows: 1) node1 rolls back the Block X transaction; 2) node1 inserts new block Block Y, and executes transaction; 3) after the Node1 completes the block insertion, the lucky value range is adjusted according to the block information, the lucky value range is updated, the block production flow is started, the T1 timer is started, and the new block production is ready to be started.
206: the current node calculates the current lucky value according to a lucky value algorithm, judges whether the current lucky value accords with the lucky value range or not, if so, executes 207, otherwise, executes 208;
specifically, the current node first constructs a new block header, and then inputs a lucky value algorithm to calculate the lucky value.
207: the current node is used as a current block outlet node to generate a new block, the new block is broadcasted in the block chain, and the current generation process is finished;
specifically, the current node firstly packages transaction information, completes block chain header information construction, fills in a lucky value, block time, node information and the like to complete new block construction, then sends the created new block to all connected neighbor nodes in the block chain, and the neighbor nodes continue to broadcast the new block after receiving the new block, so that each node in the block chain is ensured to receive the new block.
208: and determining that the current node is not the current block output node, judging whether the current node is the last block output node or not, if so, starting a second timer for timing, if blocks broadcast by other nodes are received before the second timer is overtime, executing a block insertion process, and if the second timer is overtime and blocks are not received, executing a block generation process, and ending the current process.
The timing period T1 of the first timer and the timing period T2 of the second timer may be set as needed, and specific values are not limited. Generally, T2> T1 is set, such as T2 ═ 2T 1.
In this step, if the second timer is over time and no block is received, the block generation process is executed, which may specifically include:
if the second timer is overtime and no block is received, determining that no block is generated in all nodes in the current block chain, updating the block creation time of the current node, recalculating the lucky value according to the lucky value algorithm, and executing the block generation process according to the recalculated lucky value.
In this embodiment, each calculation or verification of the lucky value in the blockchain is performed in the trusted execution environment TEE.
In addition, in this embodiment, after the current node completes the block insertion each time, the following steps may be further performed:
according to the latest block chain information, if it is determined that no out-block node exists in the current block chain, the lucky value range is expanded, and if it is determined that two or more than two nodes in the current block chain are all out-block nodes, the lucky value range is reduced.
The latest blockchain information includes, but is not limited to, the following information: the newest block, parent block(s), tertiary blocks, and so on. In addition, the frequency and amplitude of the lucky value range adjustment can be configured, and are not limited in particular. The next time a satisfactory out-blocking node is generated can be made by expanding the lucky value range, and the next time only a part (one or more, related to the system configuration) of satisfactory out-blocking nodes is generated can be made by narrowing the lucky value range.
In the method provided by this embodiment, by presetting a lucky value range of a block chain, each node in the block chain calculates a lucky value in a TEE according to the same lucky value algorithm, generates a block according to the calculated lucky value and broadcasts the block in the block chain, and each node receiving the block verifies the lucky value range according to the calculated lucky value and inserts the received block when verification succeeds, thereby implementing consensus among nodes in the block chain, the number of calculations is small, the speed is very fast, verification is simple, the amount of calculation is greatly reduced, the consensus efficiency is improved, and the nodes in the block chain can quickly achieve consensus under normal network bandwidth requirements. And the lucky value algorithm running in the TEE is protected by the TEE, so that the security guarantee of a hardware layer is provided, the security and the reliability are high, the tampering cannot be performed, and the network security is improved. In addition, the lucky value range is properly adjusted in time according to the block chain information, so that a block is generated by one block outlet node every time, resource waste is avoided, and node consensus is more efficient and optimized.
Fig. 3 is a block link point consensus apparatus configuration diagram according to another embodiment of the present application. Referring to fig. 3, the apparatus includes:
An initialization module 301 configured to preset a lucky value range of a block chain, when serving as a seed node, calculate a lucky value conforming to the lucky value range according to a lucky value algorithm, create a created block, and then broadcast the block in the block chain;
an inserting module 302 configured to be any current node in the block chain, when receiving a block broadcasted by the last out-block node, calculating a lucky value according to the information of the block and verifying, and if the calculated lucky value is the same as the lucky value of the last out-block node and conforms to the lucky value range, inserting the current node into the received block;
a generating module 303, configured to determine whether a current block height is updated after the current node completes block insertion, if yes, start a first timer to time, when the first timer is overtime and does not receive a block broadcast by another node, calculate a current lucky value according to a lucky value algorithm, and if the current lucky value conforms to a lucky value range, generate a new block as a current out-blocking node, and broadcast the new block in a block chain;
wherein each calculation or verification of a lucky value in the blockchain is performed in the trusted execution environment TEE.
In this embodiment, optionally, the generating module is further configured to:
if the current lucky value calculated by the current node does not accord with the lucky value range, determining that the current node is not the current out-block node, judging whether the current node is the last out-block node or not, if so, starting a second timer to time, if blocks broadcasted by other nodes are received before the second timer is overtime, executing a block inserting process, and if the second timer is overtime and does not receive the blocks, executing a block generating process.
In this embodiment, optionally, the insertion module is further configured to:
if the current node receives the first block broadcasted by the first node and finishes inserting, and receives the second block broadcasted by the second node before the first timer times out, if the second block is verified to be in accordance with the inserting standard and has the same height as the first block, the second block is inserted, the lucky value of the first block and the lucky value of the second block are compared, the block with small lucky value is used as a parent block, and the block with large lucky value is used as a tertiary block.
In this embodiment, optionally, the generating module is specifically configured to:
if the second timer is overtime and no block is received, determining that no block is generated by all nodes in the current block chain, updating the block creation time by the current node, calculating the lucky value again according to the lucky value algorithm, and executing the block generation process according to the recalculated lucky value.
In this embodiment, optionally, the apparatus further includes:
and the adjusting module is configured to expand the lucky value range if no block node exists in the current block chain according to the latest block chain information after the current node completes block insertion, and reduce the lucky value range if two or more nodes in the current block chain are determined to be block nodes.
The apparatus provided in this embodiment may perform the method provided in any of the method embodiments described above, and details of the process are described in the method embodiments, and are not described herein again.
The apparatus provided in this embodiment may be applied to a block chain network as shown in fig. 4, where the node N1 is used as a seed node when creating a founding block, and the rest of the time is the same as the other nodes for performing block insertion and production processes, which is not described herein again.
The apparatus provided in this embodiment presets a lucky value range of a block chain, where each node in the block chain calculates a lucky value in a TEE according to a same lucky value algorithm, generates a block according to the calculated lucky value and broadcasts the block in the block chain, and each node that receives the block verifies the lucky value range according to the calculated lucky value, and inserts the received block when verification succeeds, so as to implement joint identification of nodes in the block chain. And the lucky value algorithm running in the TEE is protected by the TEE, so that the security guarantee of a hardware layer is provided, the security and the reliability are high, the tampering cannot be performed, and the network security is improved. In addition, the lucky value range is properly adjusted in time according to the block chain information so as to ensure that a block is generated by one out-of-block node every time, thereby avoiding resource waste and enabling the node consensus to be more efficient and optimized.
The above and other objects, advantages and features of the present application will become more apparent to those skilled in the art from the following detailed description of specific embodiments thereof, as illustrated in the accompanying drawings.
An embodiment of the present application further provides a computing device, referring to fig. 5, comprising a memory 1120, a processor 1110, and a computer program stored in said memory 1120 and executable by said processor 1110, the computer program being stored in a space 1130 for program code in the memory 1120, the computer program, when executed by the processor 1110, implementing the method steps 1131 for performing any of the methods according to the present invention.
The embodiment of the application also provides a computer readable storage medium. Referring to fig. 6, the computer readable storage medium comprises a storage unit for program code, which is provided with a program 1131' for performing the steps of the method according to the invention, which program is executed by a processor.
Embodiments of the present application further provide a computer program product containing instructions. Which, when run on a computer, causes the computer to carry out the steps of the method according to the invention.
In the above embodiments, all or part of the implementation may be realized by software, hardware, firmware, or any combination thereof. When implemented in software, it may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed by a computer, cause the computer to perform, in whole or in part, the procedures or functions described in accordance with the embodiments of the application. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
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 application.
It will be understood by those skilled in the art that all or part of the steps in the method for implementing the above embodiments may be implemented by a program, and the program may be stored in a computer-readable storage medium, where the storage medium is a non-transitory medium, such as a random access memory, a read only memory, a flash memory, a hard disk, a solid state disk, a magnetic tape (magnetic tape), a floppy disk (floppy disk), an optical disk (optical disk), and any combination thereof.
The above description is only for the preferred embodiment of the present application, but the scope of the present application is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present application should be covered within the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (10)

1. A method of block link point consensus, comprising:
presetting a lucky value range of a block chain;
calculating a lucky value which accords with the lucky value range by the seed node according to a lucky value algorithm, creating a created block, and broadcasting the block in a block chain;
when any current node in the block chain receives a block broadcasted by a last out-block node, calculating a lucky value according to the information of the block and verifying the lucky value, and if the calculated lucky value is the same as the lucky value of the last out-block node and accords with the lucky value range, inserting the current node into the received block;
after the current node finishes block insertion, judging whether the height of the current block is updated or not, if so, starting a first timer for timing, calculating a current lucky value according to the lucky value algorithm when the first timer is overtime and does not receive blocks broadcasted by other nodes, and if the current lucky value conforms to the lucky value range, generating a new block as a current out-block node and broadcasting the new block in the block chain;
Wherein each calculation or verification of a lucky value in the blockchain is performed in the trusted execution environment TEE.
2. The method of claim 1, further comprising:
if the current lucky value calculated by the current node does not accord with the lucky value range, determining that the current node is not the current out-of-block node, judging whether the current node is the last out-of-block node or not, if so, starting a second timer for timing, executing a block inserting process if a block broadcasted by other nodes is received before the second timer is overtime, and executing a block generating process if the second timer is overtime and the block is not received.
3. The method of claim 1, further comprising:
if the current node receives a first block broadcasted by a first node and finishes insertion, and then receives a second block broadcasted by a second node before the first timer is overtime, if the second block is verified to be in accordance with the insertion standard and has the same height as the first block, the second block is inserted, the lucky value of the first block and the lucky value of the second block are compared, the block with the small lucky value is used as a parent block, and the block with the large lucky value is used as a tertiary block.
4. The method of claim 2, wherein if the second timer expires and no block is received, performing a block generation procedure comprises:
if the second timer is overtime and no block is received, determining that no block is generated by all nodes in the current block chain, updating the block creation time by the current node, calculating the lucky value again according to the lucky value algorithm, and executing a block generation process according to the calculated lucky value.
5. The method according to any one of claims 1-4, further comprising:
after the current node completes block insertion, according to the latest block chain information, if the current node is determined to have no block node in the current block chain, the lucky value range is expanded, and if the current node is determined to have two or more nodes which are block nodes, the lucky value range is reduced.
6. A block link point consensus apparatus, comprising:
an initialization module configured to preset a lucky value range of a block chain, when serving as a seed node, calculate a lucky value conforming to the lucky value range according to a lucky value algorithm, create a created block, and then broadcast the block in the block chain;
An insertion module configured to serve as any current node in the block chain, when a block broadcasted by a last out-block node is received, calculate a lucky value according to information of the block and verify the lucky value, and if the calculated lucky value is the same as a lucky value of the last out-block node and conforms to the lucky value range, the current node inserts the received block;
a generating module configured to determine whether a current block height is updated after the current node completes block insertion, if yes, start a first timer to time, calculate a current lucky value according to the lucky value algorithm when the first timer is overtime and does not receive a block broadcasted by other nodes, if the current lucky value conforms to the lucky value range, generate a new block as a current out-blocking node, and broadcast the new block in the block chain;
wherein each calculation or verification of a lucky value in the blockchain is performed in the trusted execution environment TEE.
7. The apparatus of claim 6, wherein the generation module is further configured to:
if the current lucky value calculated by the current node does not accord with the lucky value range, determining that the current node is not the current out-blocking node, judging whether the current node is the last out-blocking node or not, if so, starting a second timer for timing, executing a block inserting process if blocks broadcasted by other nodes are received before the second timer is overtime, and executing a block generating process if the second timer is overtime and does not receive the blocks.
8. The apparatus of claim 6, wherein the insertion module is further configured to:
if the current node receives a first block broadcasted by a first node and finishes insertion, and receives a second block broadcasted by a second node before the first timer times out, if the second block is verified to be in accordance with an insertion standard and has the same height as the first block, the second block is inserted, the lucky value of the first block and the lucky value of the second block are compared, the block with the small lucky value is used as a parent block, and the block with the large lucky value is used as a tertiary block.
9. The apparatus of claim 7, wherein the generation module is specifically configured to:
if the second timer is overtime and no block is received, determining that no block is generated by all nodes in the current block chain, updating the block creation time by the current node, calculating the lucky value again according to the lucky value algorithm, and executing a block generation process according to the calculated lucky value.
10. The apparatus according to any one of claims 6-9, further comprising:
and an adjusting module configured to, after the current node completes block insertion, according to the latest block chain information, if it is determined that no out-block node exists in the current block chain, expand the lucky value range, and if it is determined that two or more nodes in the current block chain are out-block nodes, reduce the lucky value range.
CN202010136108.9A 2020-03-02 2020-03-02 Method and device for block chain node consensus Active CN113347219B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010136108.9A CN113347219B (en) 2020-03-02 2020-03-02 Method and device for block chain node consensus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010136108.9A CN113347219B (en) 2020-03-02 2020-03-02 Method and device for block chain node consensus

Publications (2)

Publication Number Publication Date
CN113347219A CN113347219A (en) 2021-09-03
CN113347219B true CN113347219B (en) 2022-06-28

Family

ID=77467217

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010136108.9A Active CN113347219B (en) 2020-03-02 2020-03-02 Method and device for block chain node consensus

Country Status (1)

Country Link
CN (1) CN113347219B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113821569B (en) * 2021-09-30 2024-02-06 广州智链未来科技有限公司 Block chain consensus method and block chain
CN116141342B (en) * 2023-04-23 2023-06-30 福勤智能科技(昆山)有限公司 Information synchronization and task cooperation method and device of distributed robot and robot

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019028758A1 (en) * 2017-08-10 2019-02-14 杭州全视软件有限公司 Blockchain management method applied to responsibilities
CN110399424A (en) * 2018-04-23 2019-11-01 百度在线网络技术(北京)有限公司 Block generation method, device, block chain node and storage medium
CN110445603A (en) * 2019-06-28 2019-11-12 成都鹰翔天际科技有限公司 A kind of decentralization random digit generation method
CN110602190A (en) * 2019-08-30 2019-12-20 上海唯链信息科技有限公司 Block chain consensus method, block chain node and storage device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019028758A1 (en) * 2017-08-10 2019-02-14 杭州全视软件有限公司 Blockchain management method applied to responsibilities
CN110399424A (en) * 2018-04-23 2019-11-01 百度在线网络技术(北京)有限公司 Block generation method, device, block chain node and storage medium
CN110445603A (en) * 2019-06-28 2019-11-12 成都鹰翔天际科技有限公司 A kind of decentralization random digit generation method
CN110602190A (en) * 2019-08-30 2019-12-20 上海唯链信息科技有限公司 Block chain consensus method, block chain node and storage device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
徐十珍.基于区块链的游戏资产交易平台研究.《计算技术与自动化》.2019, *

Also Published As

Publication number Publication date
CN113347219A (en) 2021-09-03

Similar Documents

Publication Publication Date Title
CN107888562B (en) Data verification and transceiving method, node and system for parallel link access to interconnection chain
CN107483509B (en) A kind of auth method, server and readable storage medium storing program for executing
EP3394756B1 (en) Method and system for byzantine fault - tolerance replicating of data
WO2018177093A1 (en) Block chain processing method, accounting node, verification node and storage medium
US11133923B2 (en) Cryptographic operations using internet of things device pool
US9288216B2 (en) Methods and apparatus for reducing the effectiveness of chosen location attacks in a peer-to-peer overlay network
CN113347219B (en) Method and device for block chain node consensus
US11496290B2 (en) Blockchain network and finalization method therefor
US20210167947A1 (en) System and method for processing secret sharing authentication
CN110874351A (en) Workload certification cooperative work method, block chain node and block chain system
CN115134086A (en) Method and device for dynamic committee secret sharing and updating of asynchronous network
CN112507019A (en) PBFT consensus system and method based on intelligent contracts
KR20060104838A (en) Method and sensor certification system being suitable to sensor network environment
CN113821789B (en) User key generation method, device, equipment and medium based on blockchain
CN111061813B (en) Method, apparatus and computing device for data synchronization in blockchain network
CN112994891A (en) Transaction request consensus method and system based on threshold signature
CN116204914A (en) Trusted privacy computing method, device, equipment and storage medium
CN112751675B (en) Information monitoring method, system, equipment and storage medium based on block chain
CN114422198A (en) Digital certificate processing method and device, electronic equipment and readable storage medium
CN113268278A (en) Configuration verification synchronization method and device, electronic device and storage medium
WO2023207567A1 (en) Network service method, master node, sub-node and computer-readable medium
CN117134998B (en) SDN-based power information authentication method of Gossip blockchain
CN111901293B (en) Resource malicious competition avoiding method for alliance chain
CN116192868B (en) Parallel Bayesian fault tolerance consensus method and terminal applied to alliance chain
US20230188356A1 (en) Apparatus and method for processing distributed consensus using multi-signature

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