Consensus node determination method, device and blockchain system
By generating and broadcasting verifiable random numbers in the blockchain network, forming blocks containing multiple verifiable random numbers, and selecting consensus nodes based on their numerical relationships, the consensus interruption problems caused by excessive resource consumption of consensus process and node downtime in the blockchain network are solved, and more efficient and reliable consensus node selection is achieved.
Patent Information
- Application Number
- CN202411907203.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-23
- Publication Date
- 2025-04-29
- Estimated Expiration
- 2044-12-23
AI Technical Summary
In a blockchain network, when the number of nodes increases, the computing resources and time of the consensus process consume too much, which affects network performance and efficiency. When some consensus nodes go down, the consensus is interrupted, making it difficult to effectively select nodes that can be recognized normally.
By obtaining the latest block hash value of the blockchain system, a verified random number is generated based on the private key of the candidate consensus node, and broadcast it in the network, generating blocks including multiple verified random numbers are on the consensus blockchain, and the consensus node is selected based on the numerical relationship of the verified random number within the block.
It improves the performance and efficiency of the blockchain network, ensures the reliability and normal operation of consensus nodes, and avoids consensus interruption.
Smart Images

Figure CN119363317B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to blockchain technology, and in particular to a method and device for determining a consensus node and a blockchain system. Background Art
[0002] In blockchain technology, consensus is a key mechanism to ensure that all participants agree on the state of the network. When the number of nodes in a blockchain network grows to a certain scale, if all nodes participate in the consensus process, it will greatly consume computing resources and time, affecting the performance and efficiency of the entire network.
[0003] In the related art, when there are many blockchain nodes, some nodes are selected from the blockchain nodes as consensus nodes, and the selected consensus nodes are responsible for consensus and block generation to improve network performance and efficiency. However, when more than a preset proportion of the selected nodes are down, the consensus of the blockchain is interrupted.
[0004] When the consensus between blocks is interrupted, how to select consensus nodes and ensure that the selected consensus nodes can reach consensus normally is an urgent problem to be solved. Summary of the invention
[0005] The embodiments of the present disclosure provide a method, device and blockchain system for determining a consensus node to solve the above-mentioned problems.
[0006] According to a first aspect of an embodiment of the present disclosure, a method for determining a consensus node is provided, including:
[0007] Get the hash value of the latest block on the blockchain system;
[0008] Based on the private key of each candidate consensus node in the candidate consensus node network and the hash value of the latest on-chain block, a verifiable random number of each candidate consensus node is generated, and the verifiable random number of each candidate consensus node is broadcasted in the candidate consensus node network;
[0009] Based on the numerical relationship between the verifiable random numbers of the candidate consensus nodes, at least one block is generated, and the at least one block is chained on the consensus blockchain, wherein each block in the at least one block includes multiple verification random numbers, and the multiple verifiable random numbers are selected from the verifiable random numbers of the candidate consensus nodes, and the consensus blockchain is a blockchain for selecting consensus nodes;
[0010] Based on the numerical relationship between the verifiable random numbers of the at least one block, multiple consensus nodes are selected from the candidate consensus nodes.
[0011] In some embodiments of the present disclosure, the generating of the verifiable random number of each candidate consensus node based on the private key of each candidate consensus node in the candidate consensus node network and the hash value of the latest on-chain block includes:
[0012] Using a preset signature method, the hash value of the latest on-chain block is signed based on the private key of each candidate consensus node to obtain the signature result of each candidate consensus node;
[0013] The signature results of the candidate consensus nodes are numerically converted to obtain verifiable random numbers of the candidate consensus nodes.
[0014] In some embodiments of the present disclosure, generating at least one block based on the numerical relationship of the verifiable random numbers of the candidate consensus nodes includes:
[0015] For each candidate consensus node, based on the numerical relationship between its own verifiable random number and the verifiable random numbers received from other candidate consensus nodes through broadcasting, generate a block including multiple verifiable random numbers;
[0016] Based on the blocks generated by the candidate consensus nodes, the at least one block is obtained.
[0017] In some embodiments of the present disclosure, the selecting a plurality of consensus nodes from the candidate consensus nodes based on the numerical relationship between the verifiable random numbers of the at least one block includes:
[0018] In response to the at least one block constituting a forked chain, selecting a target blockchain from the forked chain based on a sum of verifiable random numbers in each fork point block in the forked chain;
[0019] Based on the numerical relationship between the verifiable random numbers in each block of the target blockchain, select multiple target verifiable random numbers from the verifiable random numbers in each block of the target blockchain;
[0020] A plurality of candidate consensus nodes corresponding one-to-one to the plurality of target verifiable random numbers are determined as the plurality of consensus nodes.
[0021] In some embodiments of the present disclosure, broadcasting the verifiable random number of each candidate consensus node in the consensus node network includes:
[0022] For each candidate consensus node, a broadcast message is generated based on its own verifiable random number, the block height of the latest on-chain block and its own public key, and the broadcast message is broadcasted on the consensus node network.
[0023] According to a second aspect of an embodiment of the present disclosure, a device for determining a consensus node is provided, including:
[0024] The acquisition module is used to obtain the hash value of the latest block on the blockchain system;
[0025] A verifiable random number processing module, for generating a verifiable random number of each candidate consensus node based on the private key of each candidate consensus node in the candidate consensus node network and the hash value of the latest on-chain block, and broadcasting the verifiable random number of each candidate consensus node in the candidate consensus node network;
[0026] A block processing module, configured to generate at least one block based on the numerical relationship between the verifiable random numbers of the candidate consensus nodes, and chain the at least one block on a consensus blockchain, wherein each of the at least one block includes a plurality of verification random numbers, the plurality of verifiable random numbers are selected from the verifiable random numbers of the candidate consensus nodes, and the consensus blockchain is a blockchain for selecting a consensus node;
[0027] A consensus node determination module is used to select a plurality of consensus nodes from the candidate consensus nodes based on the numerical relationship between the verifiable random numbers of the at least one block.
[0028] In some embodiments of the present disclosure, the verifiable random number processing module includes:
[0029] A signature unit, used to sign the hash value of the latest on-chain block based on the private key of each candidate consensus node using a preset signature method to obtain the signature result of each candidate consensus node;
[0030] The numerical conversion unit is used to perform numerical conversion on the signature results of each candidate consensus node to obtain a verifiable random number of each candidate consensus node.
[0031] In some embodiments of the present disclosure, the block processing module is used to generate a block including multiple verifiable random numbers for each candidate consensus node based on the numerical relationship between its own verifiable random number and the verifiable random numbers received from other candidate consensus nodes through broadcasting;
[0032] The block processing module is further used to obtain the at least one block based on the blocks generated by the candidate consensus nodes.
[0033] In some embodiments of the present disclosure, the consensus node determination module includes:
[0034] a target blockchain determining unit, configured to select a target blockchain from the forked chain based on a sum of verifiable random numbers in each fork point block in the forked chain in response to the at least one block constituting the forked chain;
[0035] A verifiable random number selection unit, configured to select a plurality of target verifiable random numbers from the verifiable random numbers in each block of the target blockchain based on a numerical relationship between the verifiable random numbers in each block of the target blockchain;
[0036] The consensus node determination unit is used to determine a plurality of candidate consensus nodes corresponding one-to-one to the plurality of target verifiable random numbers as the plurality of consensus nodes.
[0037] In some embodiments of the present disclosure, the verifiable random number processing module includes:
[0038] The broadcast unit is used to generate broadcast information for each candidate consensus node based on its own verifiable random number, the block height of the latest on-chain block and its own public key, and broadcast the broadcast information in the consensus node network.
[0039] A third aspect of the embodiments of the present disclosure provides a blockchain system, including:
[0040] Blockchain network;
[0041] The apparatus of the second aspect is used to execute the method of the first aspect.
[0042] The consensus node determination method, device and blockchain system of the disclosed embodiments, since some nodes crash after the blockchain consensus is interrupted, verifiable random numbers are generated by each candidate consensus node in the candidate consensus node network, and blocks including multiple verifiable random numbers are chained to the consensus blockchain, and then multiple consensus nodes are selected from the candidate consensus nodes according to the numerical relationship between the verifiable random numbers in the blocks of the consensus blockchain, so that the consensus nodes can be selected by consensus in the candidate consensus node network, and it can be ensured that the selected consensus nodes have no crashes.
[0043] The technical solution of the present disclosure is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] The accompanying drawings, which constitute a part of the specification, illustrate embodiments of the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0045] The present disclosure may be more clearly understood from the following detailed description with reference to the accompanying drawings, in which:
[0046] Figure 1 This is a flow chart of a method for determining a consensus node in one embodiment of the present disclosure;
[0047] Figure 2 is a partial flow chart of step S2 in some embodiments of the present disclosure;
[0048] Figure 3 is a partial flow chart of step S3 in some embodiments of the present disclosure;
[0049] Figure 4 is a schematic diagram of selecting a consensus node in an example of the present disclosure;
[0050] Figure 5 is a timing diagram of selecting a consensus node in an example of the present disclosure;
[0051] Figure 6 is a flowchart of step S4 in some embodiments of the present disclosure;
[0052] Figure 7 It is a schematic diagram of a forked chain in a consensus blockchain in an example of the present disclosure;
[0053] Figure 8 This is a structural block diagram of a device for determining a consensus node in an embodiment of the present disclosure;
[0054] Fig. 9 This is a structural block diagram of a verifiable random number processing module 200 in one embodiment of the present disclosure;
[0055] Fig.10 This is a structural block diagram of a consensus node determination module 400 in one embodiment of the present disclosure;
[0056] Fig.11 The structure block diagram of an electronic device in one embodiment of the present disclosure. DETAILED DESCRIPTION
[0057] Various exemplary embodiments of the present disclosure will now be described in detail with reference to the accompanying drawings. It should be noted that the relative arrangement of components and steps, numerical expressions and numerical values set forth in these embodiments do not limit the scope of the present disclosure unless otherwise specifically stated.
[0058] Those skilled in the art can understand that the terms "first" and "second" in the embodiments of the present disclosure are only used to distinguish different steps, devices or modules, etc., and neither represent any specific technical meaning nor indicate the necessary logical order between them.
[0059] It should also be understood that in the embodiments of the present disclosure, “plurality” may refer to two or more than two, and “at least one” may refer to one, two, or more than two.
[0060] It should also be understood that any component, data or structure mentioned in the embodiments of the present disclosure can generally be understood as one or more, unless explicitly limited or otherwise indicated in the context.
[0061] In addition, the term "and / or" in the present disclosure is only a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in the present disclosure generally indicates that the associated objects before and after are in an "or" relationship.
[0062] It should also be understood that the description of the various embodiments in the present disclosure focuses on the differences between the various embodiments, and the same or similar aspects thereof can be referenced to each other, and for the sake of brevity, they will not be described one by one.
[0063] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the present disclosure, its application, or uses.
[0064] Technologies, methods, and equipment known to ordinary technicians in the relevant art may not be discussed in detail, but where appropriate, the technologies, methods, and equipment should be considered part of the specification.
[0065] It should be noted that like reference numerals and letters refer to similar items in the following figures, and therefore, once an item is defined in one figure, it need not be further discussed in subsequent figures.
[0066] The embodiments of the present disclosure can be applied to electronic devices such as terminal devices, computer systems, servers, etc., which can operate with many other general or special computing system environments or configurations. Examples of well-known terminal devices, computing systems, environments and / or configurations suitable for use with electronic devices such as terminal devices, computer systems, servers, etc. include, but are not limited to: personal computer systems, server computer systems, thin clients, thick clients, handheld or laptop devices, microprocessor-based systems, set-top boxes, programmable consumer electronics, network personal computers, small computer systems, large computer systems, and distributed cloud computing technology environments including any of the above systems, etc.
[0067] Electronic devices such as terminal devices, computer systems, servers, etc. can be described in the general context of computer system executable instructions (such as program modules) executed by computer systems. Generally, program modules can include routines, programs, object programs, components, logic, data structures, etc., which perform specific tasks or implement specific abstract data types. Computer systems / servers can be implemented in distributed cloud computing environments, where tasks are performed by remote processing devices linked through a communication network. In a distributed cloud computing environment, program modules can be located on local or remote computing system storage media including storage devices.
[0068] Figure 1FIG. 1 is a flow chart of a method for determining a consensus node in an embodiment of the present disclosure. Figure 1 As shown, the method for determining the consensus node may include the following steps:
[0069] S1: Get the hash value of the latest block on the blockchain system.
[0070] When the consensus of the blockchain system is interrupted, the hash value of the latest block on the blockchain system can be obtained. Among them, the time interval between adjacent blocks on the blockchain system can be detected to determine whether the consensus of the blockchain system is interrupted.
[0071] The hash algorithm used by the blockchain system can be MD5, SHA-1 or SHA-2. Among them, the MD5 message digest algorithm is a cryptographic hash function used to generate a 128-bit (16-byte) hash value to ensure the integrity and consistency of information transmission. SHA-1 uses a cryptographic hash function to generate a 160-bit (20-byte) hash value called a message digest. SHA-2 is the successor of SHA-1, which can be further divided into six different algorithm standards, including: SHA-224, SHA-256, SHA-384, SHA-512, SHA-512 / 224, SHA-512 / 256.
[0072] S2: Based on the private key of each candidate consensus node in the candidate consensus node network and the hash value of the latest chained block, a verifiable random number of each candidate consensus node is generated, and the verifiable random number of each candidate consensus node is broadcast in the consensus node network.
[0073] The candidate consensus node network is a network composed of multiple candidate consensus nodes. Each candidate consensus node can be a super node of the blockchain network. Super nodes are nodes in the blockchain network that are used to collect, package, and verify transaction information into blocks. They have more credibility in the blockchain than ordinary nodes.
[0074] For each candidate consensus node in the candidate consensus node network, a verifiable random number generation function can be used to generate a verifiable random number for each candidate consensus node based on the private key of each candidate consensus node and the hash value of the latest on-chain block. The verifiable random number generation function is vrfFunc(privKey, hash). Among them, privKey represents the private key of the node, hash represents the hash value of the latest on-chain block, and the generation function vrfFunc(privKey, hash) generates a certain verifiable random number when privKey and hash are given.
[0075] After each candidate consensus node in the candidate consensus node network generates its own verifiable random number, it broadcasts it within the candidate consensus node network so that each candidate consensus node in the candidate consensus node network can receive the verifiable random number of other candidate consensus nodes and can use the public keys of other candidate consensus nodes to verify the verifiable random numbers of other candidate consensus nodes.
[0076] In an embodiment of the present disclosure, after each candidate consensus node in the candidate consensus node network generates its own verifiable random number, the verifiable random number generated by the candidate consensus node itself can also be broadcasted throughout the blockchain system, at least ensuring that it is broadcast within the candidate consensus node network.
[0077] S3: Based on the numerical relationship of the verifiable random numbers of each candidate consensus node, generate at least one block and chain at least one block on the consensus blockchain.
[0078] Among them, the consensus blockchain uses the latest block on the chain as an anchor point and is a blockchain used to select consensus nodes. The consensus blockchain is different from the business blockchain that stores transaction blocks.
[0079] For each candidate consensus node in the candidate consensus node network, multiple verifiable random numbers can be selected based on the preset selection conditions, based on its own verifiable random number and the verifiable random numbers received from other candidate consensus nodes, and the selected verifiable random numbers can be packaged into blocks, and the blocks can be chained on the consensus blockchain. Among them, since each candidate consensus node may not receive the verifiable random numbers sent by other candidate nodes at the same time, each candidate consensus node can generate multiple blocks based on its own verifiable random number and the verifiable random numbers sent by other candidate nodes received at different times, and chain them on the consensus blockchain, and the number of verifiable random numbers included in each block is the same, but the values of the verifiable random numbers may be different.
[0080] S4: Select multiple consensus nodes from the candidate consensus nodes based on the numerical relationship between the verifiable random numbers of at least one block.
[0081] Extract the verifiable random numbers in each block from at least one block and remove duplicates, and sort all the verifiable random numbers after removing duplicates. Select multiple verifiable random numbers from the sorting results of the verifiable random numbers, and then determine the candidate consensus node corresponding to each selected verifiable random number as a consensus node. Among them, a preset number of verifiable random numbers can be selected from the sorting results of the verifiable random numbers in order from large to small values or in order from small to large values.
[0082] In this embodiment, since some nodes are down after the blockchain consensus is interrupted, a verifiable random number is generated by each candidate consensus node in the candidate consensus node network, and a block including multiple verifiable random numbers is chained on the consensus blockchain. Then, based on the numerical relationship between the verifiable random numbers in the blocks of the consensus blockchain, multiple consensus nodes are selected from the candidate consensus nodes, so that the consensus nodes can be selected by consensus in the candidate consensus node network, and it can be ensured that the selected consensus nodes are not down.
[0083] Figure 2 FIG. 1 is a partial flow chart of step S2 in some embodiments of the present disclosure. Figure 2 As shown, step S2 may include the following steps:
[0084] S2-1: Using the preset signature method, the hash value of the latest block on the chain is signed based on the private key of each candidate consensus node in the blockchain system to obtain the signature result of each candidate consensus node.
[0085] S2-2: Perform numerical conversion on the signature results of each candidate consensus node to obtain a verifiable random number for each candidate consensus node.
[0086] The Edwards-curve Digital Signature Algorithm (EdDSA) can be used internally in the function vrfFunc(privKey, hash) that verifies random numbers. The vrfFunc function can be rewritten as toNumber(EdDSA(privKey, hash)). EdDSA(privKey, hash) means using the private key privKey to sign the data hash. The signature algorithm is EdDSA, and the signature result is a string. toNumber converts the string into a floating point number in the interval (0,1).
[0087] In an example of the present disclosure, the private key privKey is 9a1f8b…cbaf3f89, the hash value of the latest block on the chain is c0535e4…31f1b9d61, and the string generated by the EdDSA signature is rHXy7…Cw==. The string is forced to be converted into a decimal of 0.1764937649237, which can verify the random number.
[0088] In this embodiment, since the EdDSA signature method can improve the signing / verification speed while ensuring security, the EdDSA signature method is used to sign the hash value of the latest chain block according to the private key of each candidate consensus node to obtain a signature result in a string format. By converting the signature result into a numerical value, a verifiable random number for each candidate consensus node can be quickly generated while ensuring security.
[0089] Figure 3 FIG. 1 is a partial flow chart of step S3 in some embodiments of the present disclosure. Figure 3 As shown, step S3 may include the following steps:
[0090] S3-1: For each candidate consensus node, based on the numerical relationship between its own verifiable random number and the verifiable random numbers received from other candidate consensus nodes through broadcasting, a block including multiple verifiable random numbers is generated.
[0091] For each candidate consensus node, its own verifiable random number and the verifiable random numbers of other candidate consensus nodes can be sorted according to the numerical relationship between its own verifiable random number and the verifiable random numbers of other candidate consensus nodes received through broadcasting. According to the sorting result, the first r verifiable random numbers are selected and packaged into the block.
[0092] Since each candidate consensus node may not receive the verifiable random numbers sent by other candidate nodes at the same time, each candidate consensus node can generate multiple blocks based on its own verifiable random numbers and the verifiable random numbers sent by other candidate nodes received at different times, and each block includes r verifiable random numbers, where r is an integer greater than 1.
[0093] In the embodiment of the present disclosure, in order to ensure that each candidate consensus node can select r verifiable random numbers from as many candidate consensus nodes as possible and avoid taking too long to select each candidate consensus node to generate a block, each candidate consensus node can be set to generate a block at a preset interval, and a total of N blocks are generated. Where N is an integer greater than 1.
[0094] Each candidate will chain the block generated by itself on the consensus blockchain. In this way, the consensus blockchain includes the blocks generated by each candidate consensus node, and each block includes r verifiable random numbers.
[0095] S3-2: Based on the blocks generated by each candidate consensus node, at least one block is obtained.
[0096] Figure 4 This is a schematic diagram of selecting a consensus node in an example of the present disclosure. Figure 4As shown, the candidate consensus node network includes 7 candidate consensus nodes, including: node 1, node 2, node 3, node 4, node 5, node 6 and node 7.
[0097] For each of the 7 candidate consensus nodes, the EdDSA signature method is used to generate their own verifiable random numbers based on their private keys and the hash value of the latest on-chain block. Each candidate consensus node sorts its own verifiable random numbers and the verifiable random numbers received from other candidate nodes M times, and selects r verifiable random numbers based on the sorting results each time to pack and generate a block, resulting in M blocks. Among them, M is an integer greater than 1, and M <N。
[0098] The 7 consensus nodes generate N blocks in total, obtain the verifiable random numbers in the N blocks and deduplicate them, select r verifiable random numbers based on the deduplication results, determine the r candidate consensus nodes corresponding to the selected r verifiable random numbers as consensus nodes, and the consensus nodes are responsible for generating blocks. In this example, r is 4, and the final selected consensus nodes are node 2, node 3, node 4, and node 7.
[0099] Figure 5 is a timing diagram of selecting a consensus node in an example of the present disclosure. Figure 5 As shown, the candidate consensus node network includes multiple super nodes (i.e., candidate consensus nodes). Multiple super nodes can use the EdDSA signature method to generate their own verifiable random numbers based on their own private keys and the hash value of the latest chained block. Each super node sorts its own verifiable random number and the verifiable random numbers received from other candidate nodes, selects r verifiable random numbers according to the sorting results, packages and generates blocks, and chains them on the blockchain (i.e., consensus blockchain). Multiple super nodes chain N blocks in total. The verifiable random numbers in N blocks are obtained and deduplicated, and r verifiable random numbers are selected according to the deduplication results, and then r consensus nodes are determined. Afterwards, the request end of the blockchain system for transactions can send a request to the consensus node and provide transaction data. The consensus node can generate a new block based on the transaction data according to the request end, chain the new block in the business blockchain, and provide feedback to the request end.
[0100] In this embodiment, since each candidate consensus node may not receive the verifiable random numbers sent by all candidate nodes at the same time, each candidate consensus node generates a block including multiple verifiable random numbers, thereby obtaining at least one block of the consensus blockchain, which helps to accurately select a consensus node from each candidate consensus node.
[0101] Figure 6 FIG. 4 is a flow chart of step S4 in some embodiments of the present disclosure. Figure 6 As shown, step S4 may include the following steps:
[0102] S4-1: In response to at least one block constituting a forked chain, a target blockchain is selected from the forked chain based on a sum of verifiable random numbers in each fork point block in the forked chain.
[0103] Since each candidate consensus node may not detect the latest block uploaded by other candidate consensus nodes in time when uploading its own generated blocks to the consensus blockchain, at least one block generated by each candidate consensus node constitutes a forked chain.
[0104] When there is a forked chain in the consensus blockchain, the target blockchain can be selected from the forked chain based on the sum of the verifiable random numbers in each forked block.
[0105] Figure 7 Schematic diagram of a consensus blockchain with a forked chain in an example of the present disclosure. Figure 7 As shown, including block A i-1 Block A i Block A n-1 and Block A n The blockchain of is the business blockchain, that is, the blockchain where the blockchain system transaction blocks exist. n It is the latest block on the business blockchain.
[0106] Since each candidate consensus node fails to detect in time the blocks that have been chained by other candidate consensus nodes when uploading blocks to the chain, a fork exists in the consensus blockchain including block B1, block B2, block B3, block C1, block C2 and block C3, namely: one fork is composed of block B1, block B2 and block B3, and another fork is composed of block C1, block C2 and block C3.
[0107] In the consensus blockchain, blocks B1 and C1 are fork point blocks. The sum of all verifiable random numbers in block B1 is calculated, and the sum of all verifiable random numbers in block C1 is calculated. According to the preset selection method, the target blockchain is selected based on the sum of all verifiable random numbers in block B1 and the sum of all verifiable random numbers in C1. For example, the smaller value of the sum of all verifiable random numbers in block B1 and the sum of all verifiable random numbers in C1 can be taken to select the target blockchain (for example, a blockchain including blocks B1, B2, and B3, or a blockchain including blocks C1, C2, and C3).
[0108] S4-2: Based on the numerical relationship between the verifiable random numbers in each block of the target blockchain, select multiple target verifiable random numbers from the verifiable random numbers in each block of the target blockchain.
[0109] Continuing with the example of step S4-1, if the target blockchain includes block C1, block C2, and block C3, the verifiable random numbers in block C1, block C2, and block C3 are extracted and deduplicated, and multiple target verifiable random numbers are selected based on the deduplication results.
[0110] S4-3: Determine multiple candidate consensus nodes corresponding to multiple target verifiable random numbers as multiple consensus nodes.
[0111] In this embodiment, since each candidate consensus node fails to detect in time the blocks that have been uploaded by other candidate consensus nodes when uploading blocks to the chain, resulting in a forked chain in the consensus blockchain, the target blockchain can be selected from the forked chain based on the sum of the verifiable random numbers in the blocks at each fork point in the forked chain, and the consensus node can be quickly determined based on the target blockchain.
[0112] In some embodiments of the present disclosure, the step of broadcasting the verifiable random number of each candidate consensus node in the consensus node network may include: for each candidate consensus node, generating broadcast information based on its own verifiable random number, the block height of the latest on-chain block and its own public key, and broadcasting the broadcast information in the consensus node network.
[0113] In this embodiment, after each candidate consensus node generates its own verifiable random number, it can broadcast its own verifiable random number, the block height of the latest on-chain block, and its own public key, so that other candidate consensus nodes can use the public key to verify the verifiable random number and help the consensus blockchain anchor the latest on-chain block.
[0114] Figure 8 FIG. 1 is a structural block diagram of a device for determining a consensus node in an embodiment of the present disclosure. Figure 8 As shown, the device for determining the consensus node includes:
[0115] The acquisition module 100 is used to obtain the hash value of the latest block on the blockchain system;
[0116] The verifiable random number processing module 200 is used to generate a verifiable random number of each candidate consensus node based on the private key of each candidate consensus node in the candidate consensus node network and the hash value of the latest on-chain block, and broadcast the verifiable random number of each candidate consensus node in the candidate consensus node network;
[0117] The block processing module 300 is used to generate at least one block based on the numerical relationship of the verifiable random numbers of each candidate consensus node, and chain the at least one block on the consensus blockchain, wherein each block in the at least one block includes multiple verification random numbers, and the multiple verifiable random numbers are selected from the verifiable random numbers of each candidate consensus node, and the consensus blockchain is a blockchain used to select the consensus node;
[0118] The consensus node determination module 400 is used to select multiple consensus nodes from candidate consensus nodes based on the numerical relationship between the verifiable random numbers of at least one block.
[0119] Fig. 9 FIG. 2 is a block diagram of a verifiable random number processing module 200 in one embodiment of the present disclosure. Fig. 9 As shown, the verifiable random number processing module 200 includes:
[0120] The signature unit 210 is used to sign the hash value of the latest on-chain block based on the private key of each candidate consensus node using a preset signature method to obtain the signature result of each candidate consensus node;
[0121] The numerical conversion unit 220 is used to perform numerical conversion on the signature result of each candidate consensus node to obtain a verifiable random number of each candidate consensus node.
[0122] In some embodiments of the present disclosure, the block processing module 300 is used to generate a block including multiple verifiable random numbers for each candidate consensus node based on the numerical relationship between its own verifiable random number and the verifiable random numbers received from other candidate consensus nodes through broadcasting;
[0123] The block processing module 300 is also used to obtain at least one block based on the blocks generated by each candidate consensus node.
[0124] Fig.10 FIG. 4 is a structural block diagram of a consensus node determination module 400 in one embodiment of the present disclosure. Fig.10 As shown, the consensus node determination module 400 includes:
[0125] A target blockchain determination unit 410 is configured to select a target blockchain from the forked chain based on a sum of verifiable random numbers in each fork point block in the forked chain in response to at least one block constituting the forked chain;
[0126] A verifiable random number selection unit 420, configured to select a plurality of target verifiable random numbers from the verifiable random numbers in each block of the target blockchain based on a numerical relationship between the verifiable random numbers in each block of the target blockchain;
[0127] The consensus node determination unit 430 is used to determine multiple candidate consensus nodes corresponding to multiple target verifiable random numbers one by one as multiple consensus nodes.
[0128] In some embodiments of the present disclosure, the verifiable random number processing module 200 includes:
[0129] The broadcast unit 230 is used to generate broadcast information for each candidate consensus node based on its own verifiable random number, the block height of the latest on-chain block and its own public key, and broadcast the broadcast information in the consensus node network.
[0130] It should be noted that the specific implementation of the consensus node determination device of the embodiment of the present disclosure is similar to the specific implementation of the consensus node determination method of the embodiment of the present disclosure, and the technical effect of the consensus node determination device of the embodiment of the present disclosure is similar to the technical effect of the consensus node determination method of the embodiment of the present disclosure. Please refer to the description of the consensus node determination method part for details. In order to reduce redundancy, it is not repeated here.
[0131] The present disclosure also provides a blockchain system, including:
[0132] Blockchain network;
[0133] The above-mentioned consensus node determination device is used to execute the above-mentioned consensus node determination method.
[0134] In addition, an embodiment of the present disclosure further provides an electronic device, including:
[0135] Memory for storing computer programs;
[0136] A processor is used to execute the computer program stored in the memory, and when the computer program is executed, the method for determining the consensus node described in any of the above embodiments of the present disclosure is implemented.
[0137] Below, reference Fig.11 To describe the electronic device according to the embodiment of the present disclosure. Fig.11 As shown, the electronic device includes one or more processors and memory.
[0138] The processor may be a central processing unit (CPU) or other forms of processing units having data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device to perform desired functions.
[0139] The memory may store one or more computer program products, and the memory may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, random access memory (RAM) and / or cache memory (cache), etc. The non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. One or more computer program products may be stored on the computer-readable storage medium, and the processor may run the computer program product to implement the consensus node determination method and / or other desired functions of the various embodiments of the present disclosure described above.
[0140] In one example, the electronic device may further include: an input device and an output device, and these components are interconnected via a bus system and / or other forms of connection mechanisms (not shown).
[0141] In addition, the input device may also include, for example, a keyboard, a mouse, and the like.
[0142] The output device can output various information to the outside, including the determined distance information, direction information, etc. The output device can include, for example, a display, a speaker, a printer, a communication network and a remote output device connected thereto, and the like.
[0143] Of course, to simplify, Fig.11 Only some of the components related to the present disclosure in the electronic device are shown, and components such as a bus, an input / output interface, etc. are omitted. In addition, according to specific application situations, the electronic device may further include any other appropriate components.
[0144] In addition to the above-mentioned methods and devices, an embodiment of the present disclosure may also be a computer program product, which includes computer program instructions, which, when executed by a processor, enable the processor to execute the steps in the method for determining a consensus node according to various embodiments of the present disclosure described in the above part of this specification.
[0145] The computer program product may be written in any combination of one or more programming languages to write program code for performing the operations of the disclosed embodiments, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0146] In addition, an embodiment of the present disclosure may also be a computer-readable storage medium having computer program instructions stored thereon, which, when executed by a processor, causes the processor to execute the steps of the method for determining a consensus node according to various embodiments of the present disclosure described in the above part of this specification.
[0147] The computer readable storage medium can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can include, for example, but is not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0148] The basic principles of the present disclosure are described above in conjunction with specific embodiments. However, it should be noted that the advantages, strengths, effects, etc. mentioned in the present disclosure are only examples and not limitations, and it cannot be considered that these advantages, strengths, effects, etc. are required by each embodiment of the present disclosure. In addition, the specific details disclosed above are only for the purpose of illustration and ease of understanding, and are not limitations. The above details do not limit the present disclosure to the necessity of adopting the above specific details to be implemented.
[0149] Each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the system embodiment, since it basically corresponds to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0150] The block diagrams of the devices, apparatuses, equipment, and systems involved in this disclosure are only illustrative examples and are not intended to require or imply that they must be connected, arranged, and configured in the manner shown in the block diagrams. As will be appreciated by those skilled in the art, these devices, apparatuses, equipment, and systems can be connected, arranged, and configured in any manner. Words such as "including," "comprising," "having," and the like are open words, referring to "including but not limited to," and can be used interchangeably therewith. The words "or" and "and" used herein refer to the words "and / or," and can be used interchangeably therewith, unless the context clearly indicates otherwise. The word "such as" used herein refers to the phrase "such as but not limited to," and can be used interchangeably therewith.
[0151] The method and apparatus of the present disclosure may be implemented in many ways. For example, the method and apparatus of the present disclosure may be implemented by software, hardware, firmware, or any combination of software, hardware, and firmware. The above order of steps for the method is for illustration only, and the steps of the method of the present disclosure are not limited to the order specifically described above, unless otherwise specifically stated. In addition, in some embodiments, the present disclosure may also be implemented as a program recorded in a recording medium, which includes machine-readable instructions for implementing the method according to the present disclosure. Therefore, the present disclosure also covers a recording medium storing a program for executing the method according to the present disclosure.
[0152] It should also be noted that in the apparatus, device and method of the present disclosure, each component or each step can be decomposed and / or recombined. Such decomposition and / or recombination should be regarded as equivalent solutions of the present disclosure.
[0153] The above description of the disclosed aspects is provided to enable any person skilled in the art to make or use the present disclosure. Various modifications to these aspects will be readily apparent to those skilled in the art, and the general principles defined herein may be applied to other aspects without departing from the scope of the present disclosure. Therefore, the present disclosure is not intended to be limited to the aspects shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
[0154] The above description has been given for the purpose of illustration and description. In addition, this description is not intended to limit the embodiments of the present disclosure to the forms disclosed herein. Although multiple example aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, changes, additions and sub-combinations thereof.
Claims
1. A method for determining a consensus node, characterized in that: include: Get the hash value of the latest block on the blockchain system; Based on the private key of each candidate consensus node in the candidate consensus node network and the hash value of the latest on-chain block, a verifiable random number of each candidate consensus node is generated, and the verifiable random number of each candidate consensus node is broadcasted in the candidate consensus node network; Based on the numerical relationship between the verifiable random numbers of the candidate consensus nodes, at least one block is generated, and the at least one block is chained on the consensus blockchain, wherein each block in the at least one block includes multiple verification random numbers, and the multiple verifiable random numbers are selected from the verifiable random numbers of the candidate consensus nodes, and the consensus blockchain is a blockchain for selecting consensus nodes; Based on the numerical relationship between the verifiable random numbers of the at least one block, multiple consensus nodes are selected from the candidate consensus nodes.
2. The method according to claim 1, characterized in that The generating of the verifiable random number of each candidate consensus node based on the private key of each candidate consensus node in the candidate consensus node network and the hash value of the latest on-chain block includes: Using a preset signature method, the hash value of the latest on-chain block is signed based on the private key of each candidate consensus node to obtain the signature result of each candidate consensus node; The signature results of the candidate consensus nodes are numerically converted to obtain verifiable random numbers of the candidate consensus nodes.
3. The method according to claim 1, characterized in that The generating at least one block based on the numerical relationship of the verifiable random numbers of the candidate consensus nodes comprises: For each candidate consensus node, based on the numerical relationship between its own verifiable random number and the verifiable random numbers received from other candidate consensus nodes through broadcasting, generate a block including multiple verifiable random numbers; Based on the blocks generated by the candidate consensus nodes, the at least one block is obtained.
4. The method according to claim 1, characterized in that: The selecting a plurality of consensus nodes from the candidate consensus nodes based on the numerical relationship between the verifiable random numbers of the at least one block comprises: In response to the at least one block constituting a forked chain, selecting a target blockchain from the forked chain based on a sum of verifiable random numbers in each fork point block in the forked chain; Based on the numerical relationship between the verifiable random numbers in each block of the target blockchain, select multiple target verifiable random numbers from the verifiable random numbers in each block of the target blockchain; A plurality of candidate consensus nodes corresponding one-to-one to the plurality of target verifiable random numbers are determined as the plurality of consensus nodes.
5. The method according to any one of claims 1 to 4, characterized in that: The broadcasting of the verifiable random number of each candidate consensus node on the consensus node network includes: For each candidate consensus node, a broadcast message is generated based on its own verifiable random number, the block height of the latest on-chain block and its own public key, and the broadcast message is broadcasted on the consensus node network.
6. A device for determining a consensus node, characterized in that: include: The acquisition module is used to obtain the hash value of the latest block on the blockchain system; A verifiable random number processing module, for generating a verifiable random number of each candidate consensus node based on the private key of each candidate consensus node in the candidate consensus node network and the hash value of the latest on-chain block, and broadcasting the verifiable random number of each candidate consensus node in the candidate consensus node network; A block processing module, configured to generate at least one block based on the numerical relationship between the verifiable random numbers of the candidate consensus nodes, and chain the at least one block on a consensus blockchain, wherein each of the at least one block includes a plurality of verification random numbers, the plurality of verifiable random numbers are selected from the verifiable random numbers of the candidate consensus nodes, and the consensus blockchain is a blockchain for selecting a consensus node; A consensus node determination module is used to select a plurality of consensus nodes from the candidate consensus nodes based on the numerical relationship between the verifiable random numbers of the at least one block.
7. The device according to claim 6, characterized in that The verifiable random number processing module comprises: A signature unit, used to sign the hash value of the latest on-chain block based on the private key of each candidate consensus node using a preset signature method to obtain the signature result of each candidate consensus node; The numerical conversion unit is used to perform numerical conversion on the signature results of each candidate consensus node to obtain a verifiable random number of each candidate consensus node.
8. The device according to claim 6, characterized in that The block processing module is used to generate a block including multiple verifiable random numbers for each candidate consensus node based on the numerical relationship between its own verifiable random number and the verifiable random numbers received from other candidate consensus nodes through broadcasting; The block processing module is further used to obtain the at least one block based on the blocks generated by the candidate consensus nodes.
9. The device according to claim 6, characterized in that The consensus node determination module includes: a target blockchain determining unit, configured to select a target blockchain from the forked chain based on a sum of verifiable random numbers in each fork point block in the forked chain in response to the at least one block constituting the forked chain; A verifiable random number selection unit, configured to select a plurality of target verifiable random numbers from the verifiable random numbers in each block of the target blockchain based on a numerical relationship between the verifiable random numbers in each block of the target blockchain; The consensus node determination unit is used to determine a plurality of candidate consensus nodes corresponding one-to-one to the plurality of target verifiable random numbers as the plurality of consensus nodes.
10. The device according to any one of claims 6 to 9, characterized in that: The verifiable random number processing module comprises: The broadcast unit is used to generate broadcast information for each candidate consensus node based on its own verifiable random number, the block height of the latest on-chain block and its own public key, and broadcast the broadcast information in the consensus node network.
11. A blockchain system, characterized in that: include: Blockchain network; The device according to any one of claims 6 to 10.
Citation Information
Patent Citations
Blockchain consensus node updating method and device
CN112132579A
Node selection method, block chain consensus method, device, system and equipment
CN112953981A