CN117560161B - Method and device for rotating consensus nodes of block chain and readable storage medium - Google Patents

Method and device for rotating consensus nodes of block chain and readable storage medium Download PDF

Info

Publication number
CN117560161B
CN117560161B CN202410042944.9A CN202410042944A CN117560161B CN 117560161 B CN117560161 B CN 117560161B CN 202410042944 A CN202410042944 A CN 202410042944A CN 117560161 B CN117560161 B CN 117560161B
Authority
CN
China
Prior art keywords
block
consensus
node
nodes
current round
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
CN202410042944.9A
Other languages
Chinese (zh)
Other versions
CN117560161A (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.)
China Mobile Information System Integration Co ltd
China Mobile Communications Group Co Ltd
China Mobile Xiongan ICT Co Ltd
China Mobile System Integration Co Ltd
Original Assignee
China Mobile Information System Integration Co ltd
China Mobile Communications Group Co Ltd
China Mobile Xiongan ICT Co Ltd
China Mobile System Integration 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 China Mobile Information System Integration Co ltd, China Mobile Communications Group Co Ltd, China Mobile Xiongan ICT Co Ltd, China Mobile System Integration Co Ltd filed Critical China Mobile Information System Integration Co ltd
Priority to CN202410042944.9A priority Critical patent/CN117560161B/en
Publication of CN117560161A publication Critical patent/CN117560161A/en
Application granted granted Critical
Publication of CN117560161B publication Critical patent/CN117560161B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/50Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using hash chains, e.g. blockchains or hash trees
    • 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
    • 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3236Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions
    • H04L9/3239Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions involving non-keyed hash functions, e.g. modification detection codes [MDCs], MD5, SHA or RIPEMD
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3247Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving digital signatures
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/40Network security protocols
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2209/00Additional information or applications relating to cryptographic mechanisms or cryptographic arrangements for secret or secure communication H04L9/00
    • H04L2209/46Secure multiparty computation, e.g. millionaire problem
    • H04L2209/463Electronic voting

Abstract

The application discloses a block chain consensus node rotation method and device and a readable storage medium, wherein the method comprises the following steps: the common node of the current wheel of the block chain sequentially completes the block writing operation of the block corresponding to the multiple common codes of the current wheel; after the candidate nodes of the current round of the block chain complete the block writing operation in the appointed block of the current round, broadcasting pseudo transactions, wherein the pseudo transactions broadcasted by each candidate node carry verifiable function values determined based on the hash of the first block of the current round and sign by adopting a private key of the corresponding candidate node; after the current round of block writing operation of the last block is completed, verifying the pseudo transaction broadcasted by each candidate node by the current round of block writing operation of the last block of the current round of block writing operation, and counting the verified pseudo transaction; and selecting a preset number of candidate nodes from candidate nodes passing verification of the pseudo transaction as the consensus nodes of the next round of consensus according to a preset screening rule and a counting result, thereby improving the safety of the blockchain system.

Description

Method and device for rotating consensus nodes of block chain and readable storage medium
Technical Field
The present disclosure relates to the field of blockchain technologies, and in particular, to a blockchain consensus node rotation method and apparatus, and a readable storage medium.
Background
When there are more nodes in the blockchain network, the node identity is generally divided into a consensus node and a non-consensus node, and the actual consensus flow is only participated by the consensus node, and the non-consensus node does not participate. However, the number of nodes is an intuitive representation of the degree of decentralization of a blockchain system, and in order to ensure fairness, security and decentration of the blockchain system as a whole, it is necessary to enable node identities to implement node role rotations according to a certain rule. Currently, the common node group update scheme in the coalition chain is mainly based on the rotation of a preset sequence, namely, the role rotation of the nodes is implemented in the system through a preset sequence, or the rotation sequence is obtained through a deterministic algorithm.
For a rotation mechanism based on a preset sequence, an attacker may directly acquire or calculate which of the next round of consensus nodes is, and according to the rotation sequence of the consensus nodes obtained in this way, the attacker can gather attack calculation force to aim at the next round of preset consensus nodes and humidify the next round of preset consensus nodes in advance, so that the attack is completed before the next round of consensus begins, and the security of a blockchain system is seriously threatened.
Disclosure of Invention
An objective of the embodiments of the present application is to provide a method and an apparatus for rotation of common nodes of a blockchain, and a readable storage medium, which are used for solving the problem of low security of the blockchain system.
In order to solve the technical problems, the present specification is implemented as follows:
in a first aspect, a method for rotating a common node of a blockchain is provided, including:
the common node of the current wheel of the block chain sequentially completes the block writing operation of the block corresponding to the multiple common codes of the current wheel;
after the candidate nodes of the current round of the block chain complete the block writing operation in the appointed block of the current round, broadcasting pseudo transactions, wherein the pseudo transactions broadcasted by each candidate node carry verifiable function values determined based on the hash of the first block of the current round and sign by adopting a private key of the corresponding candidate node;
after the current round of consensus nodes of the block chain complete the block writing operation of the last block of the current round of consensus, verifying the pseudo transaction broadcasted by each candidate node and counting the ticket of the verified pseudo transaction;
and selecting a preset number of candidate nodes from candidate nodes which pass verification of the pseudo transaction as consensus nodes of the next round of consensus according to preset screening rules and a counting result by the consensus nodes of the current round of the blockchain.
Optionally, the designated blocks include a plurality of blocks, each designated block being spaced apart by a predetermined number of blocks,
after the block writing operation is completed by the appointed block of the current round, the candidate node of the current round of the block chain broadcasts a pseudo transaction, which comprises the following steps:
broadcasting a pseudo transaction after a candidate node of a current round of a block chain completes a block writing operation in a first appointed block of the current round;
each candidate node checks whether the corresponding pseudo transaction is successfully broadcast;
if the candidate node fails, the candidate node broadcasting the failure rebroadcasts the pseudo transaction after the second designated block of the current round completes the writing block operation, wherein the second designated block is generated later than the first designated block.
Optionally, after the block writing operation is completed by the designated block of the current round, the candidate node of the current round of the blockchain further includes:
calculating a hash value of a first block of a current round of the block chain by a target candidate node of the current round;
the target candidate node inputs the hash value of the first block of the current round and the private key of the target candidate node into a verifiable random function to obtain a verifiable function value of the target candidate node and signs by adopting the private key of the target candidate node;
and the target candidate node encapsulates the signed verifiable function value to obtain a corresponding pseudo transaction.
Optionally, after completing the block writing operation of the current round of consensus last block of the current round, the consensus node of the current round of the blockchain verifies the pseudo transaction broadcasted by each candidate node, including:
after completing the block writing operation of the last block of the current round of the block chain, verifying the signed verifiable function value carried by the target pseudo transaction through the public key of the target candidate node to judge whether the private key of the target candidate node is correct or not or whether the verifiable function value of the target candidate node is determined based on the hash of the first block of the current round;
if yes, the target consensus node determines that the target pseudo transaction is verified.
Optionally, according to a preset screening rule, selecting a predetermined number of candidate nodes from candidate nodes with validated pseudo transactions as the consensus nodes of the next round of consensus according to a preset screening rule, wherein the method comprises the following steps:
determining random bits of verifiable function values of each pseudo transaction corresponding to the ticket counting result by a consensus node of a current round of a blockchain;
reordering candidate nodes of a current round of a blockchain according to the size ordering of the random bits;
a predetermined number of candidate nodes arranged at the forefront are determined as consensus nodes of the next round of consensus.
Optionally, the random bits are the first four bits of the verifiable function value.
Optionally, the method further comprises:
reducing the preset number of consensus nodes arranged at the forefront into candidate nodes according to the first-in first-out principle;
the reduced consensus node is replaced with the consensus node determined to be the next round of consensus.
Optionally, after selecting a predetermined number of candidate nodes from the candidate nodes that the pseudo transaction passes verification as consensus nodes of the next round of consensus, further comprising:
after the next round of consensus begins, the consensus nodes of the current round of the blockchain sequentially check whether the previous round of consensus has undergone a consensus node rotation, wherein one of the consensus nodes checks once when the block writing operation of one block is completed.
In a second aspect, there is provided a blockchain consensus node rotation device comprising a processor and a memory storing a program or instructions executable on the processor, which when executed by the processor, implement the steps of the method as described in the first aspect.
In a third aspect, there is provided a readable storage medium having stored thereon a program or instructions which when executed by a processor implement the steps of the method according to the first aspect.
In the embodiment of the application, the block writing operation of the block corresponding to the multiple times of consensus of the current wheel is sequentially completed through the consensus node of the current wheel of the block chain; after the candidate nodes of the current round of the block chain complete the block writing operation in the appointed block of the current round, broadcasting pseudo transactions, wherein the pseudo transactions broadcasted by each candidate node carry verifiable function values determined based on the hash of the first block of the current round and sign by adopting a private key of the corresponding candidate node; after the current round of consensus nodes of the block chain complete the block writing operation of the last block of the current round of consensus, verifying the pseudo transaction broadcasted by each candidate node and counting the ticket of the verified pseudo transaction; according to preset screening rules, a preset number of candidate nodes are selected from candidate nodes which pass verification of pseudo transactions to serve as the next round of consensus nodes according to preset screening rules, so that dynamic random rotation of the consensus nodes and the candidate nodes can be achieved, randomization of candidate node queues is achieved, under the condition that private keys are not leaked, an observer cannot calculate the result of identity rotation of the consensus nodes, opponent behavior difficulty is improved, the possibility that the consensus nodes are attacked is effectively reduced, and the safety of a blockchain system is improved. And the multiparty nodes participate in the candidate node screening process, and the participated candidate nodes can verify the authenticity of the random rotation scheme, so that the fairness and the safety of the consensus nodes are ensured.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiments of the application and together with the description serve to explain the application and do not constitute an undue limitation to the application. In the drawings:
FIG. 1 is a flow chart of a method for rotation of common nodes of a blockchain in accordance with an embodiment of the present application.
Fig. 2 is one of application scenarios of a block chain common node rotation method according to an embodiment of the present application.
FIG. 3 is a second application scenario diagram of a block chain common node rotation method according to an embodiment of the present application.
FIG. 4 is a block diagram of a block chain consensus node rotation device according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all, of the embodiments of the present application. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments herein without making any inventive effort, are intended to be within the scope of the present application. The reference numerals in the present application are only used to distinguish the steps in the scheme, and are not used to limit the execution sequence of the steps, and the specific execution sequence controls the description in the specification.
In order to solve the problems in the prior art, an embodiment of the present application provides a rotation method of consensus nodes of a blockchain, including: the common node of the current wheel of the block chain sequentially completes the block writing operation of the block corresponding to the multiple common codes of the current wheel; after the candidate nodes of the current round of the block chain complete the block writing operation in the appointed block of the current round, broadcasting pseudo transactions, wherein the pseudo transactions broadcasted by each candidate node carry verifiable function values determined based on the hash of the first block of the current round and sign by adopting a private key of the corresponding candidate node; after the current round of consensus nodes of the block chain complete the block writing operation of the last block of the current round of consensus, verifying the pseudo transaction broadcasted by each candidate node and counting the ticket of the verified pseudo transaction; and selecting a preset number of candidate nodes from candidate nodes which pass verification of the pseudo transaction as consensus nodes of the next round of consensus according to preset screening rules and a counting result by the consensus nodes of the current round of the blockchain.
According to the block chain consensus node rotation method, the consensus nodes and the candidate nodes can be dynamically and randomly rotated, so that the randomization of the candidate node queues is achieved, and under the condition that a private key is not revealed, an observer cannot calculate the result of the consensus node identity rotation, and therefore the possibility that the consensus nodes are attacked is effectively reduced. And the multiparty nodes participate in the candidate node screening process, and the participated candidate nodes can verify the authenticity of the random rotation scheme, so that the fairness and the safety of the consensus nodes are ensured.
As shown in fig. 1, the common node rotation method in the embodiment of the present application includes the following steps 102 to 108.
Step 102, the common node of the current round of the block chain sequentially completes the writing block operation of the block corresponding to the multiple times of common identification of the current round.
In the embodiment of the application, the block chain comprises consensus nodes and candidate nodes, wherein the consensus nodes are nodes which participate in the current round of consensus, the consensus nodes are selected from the candidate nodes, and the candidate nodes do not participate in the current round of consensus. One round of consensus includes a plurality of consensus, for example 128 times or 256 times, etc., and one round of consensus includes a preset number of consensus times.
The number of the consensus nodes and the candidate nodes is a plurality, and the consensus nodes and the candidate nodes can be configured in a consensus queue. Before the start of the blockchain network, the public keys of all nodes are configured in the blockchain network as a node public key list through a single configuration file, and an initial consensus queue is configured. To prevent a situation that the initialization cannot be started, configuration items of all nodes in the initialization configuration are ensured to be consistent.
In connection with fig. 2, for example, the consensus queue is configured with a total of 100 nodes, 20 of which are consensus nodes and 80 of which are candidate nodes. The public key 12 of the consensus node and the public key 14 of the candidate node are arranged in the consensus queue 10. The point in time when the consensus queue 10 is initially configured corresponds to stage a and is prior to the blockchain network initiation stage B.
The items of the configuration file corresponding configuration are shown in the following table 1, for example:
TABLE 1
Wherein the total number of nodes is, for example, 100 in the example; the number of consensus nodes, i.e. how many nodes participate in the consensus, in the example 20, the number of candidate nodes is 100-20=80.
The public keys of all 100 nodes are arranged in sequence in the consensus queue, the public keys of the nodes of the first round of consensus nodes are placed in the first 20 public keys, and the public keys of the nodes of the candidate nodes are placed in the last 80 public keys. The rotation period, i.e. how many blocks are followed by a batch of consensus nodes, is rotated, for example once every 256 blocks.
The number of the replacement nodes in each round, namely the number of the replaced consensus nodes after the completion of each round of consensus, is not more than one fifth to one third of the number of the consensus nodes.
In addition, the target node can be designated, and the target node does not participate in the rotation of the consensus node all the time, and is used as a resident node, namely the node identity of initial configuration is always kept.
All consensus nodes will initiate accounting by selecting which node generates a new block in a consensus through the consensus algorithm, i.e. obtain accounting rights, and this process of generating a new block is called block out. Then, all consensus nodes perform a write operation on one block out of the blocks in one consensus, and billing is performed. Taking an example where a round of consensus includes 256 times of consensus, 256 blocks are sequentially generated by all the consensus nodes, and all the nodes perform a block writing operation to the blocks generated at the time point of each consensus.
After the block chain is started in phase B, the first round of consensus begins according to the initial configuration. At this time, the initially configured consensus queue may be seen in a Serialized Ledger (SLE) on the creation block, and the consensus is performed for the corresponding consensus node.
Through initial configuration, the whole process is completed by the system after the block chain is started, and interaction with a user or operation and maintenance personnel is not needed.
The number of consensus rounds may include a plurality of rounds, e.g., N rounds, for example, one round generating 256 blocks, and then after the N rounds of consensus are completed, 256 x N blocks are generated. The first block constructed in the first round of consensus is called the creation block, which contains the information of the initial consensus queue.
In the embodiment of the present application, the current wheel in step 102 may be the first wheel or the ith wheel, 1<i N.
Step 104, after the candidate nodes of the current round of the blockchain complete the block writing operation in the specified block of the current round, broadcasting pseudo transactions, wherein the pseudo transactions broadcasted by each candidate node carry verifiable function values determined based on the hash of the first block of the current round and sign by adopting a private key of the corresponding candidate node.
Instead of the actual transaction being issued by the user on the blockchain, the transaction issued by the account of the candidate node, the pseudo transaction is used only for subsequent selection of the candidate node as the consensus node for the next round of consensus. The broadcasted pseudo transactions are collected into a pool of votes 20, and the pseudo transactions 22 in the pool of votes 20 may be arranged in a certain order.
In the embodiment of the application, the candidate node broadcasts the pseudo transaction in the process that the consensus node executes the current round of consensus, and the time point of broadcasting the pseudo transaction may be after all the consensus nodes complete the block writing operation in the designated block of the current round. The designated block is any one of the blocks generated by the current wheel.
Optionally, in step 104, the specified blocks include a plurality of blocks, and a predetermined number of blocks are spaced between each specified block. After the block writing operation is completed by the appointed block of the current round, the candidate node of the current round of the block chain broadcasts a pseudo transaction, which comprises the following steps: broadcasting a pseudo transaction after a candidate node of a current round of a block chain completes a block writing operation in a first appointed block of the current round; each candidate node checks whether the corresponding pseudo transaction is successfully broadcast; if the candidate node fails, the candidate node broadcasting the failure rebroadcasts the pseudo transaction after the second designated block of the current round completes the writing block operation, wherein the second designated block is generated later than the first designated block.
In the above embodiment, the candidate node may broadcast the pseudo transaction at a plurality of different points in time for the current round. The different points in time are separated by a certain number of blocks. All candidate nodes can broadcast the pseudo transaction at the time point of the designated block generated at the earliest, and in order to solve the problem of the broadcasting failure of the pseudo transaction, whether the pseudo transaction of the candidate nodes is successfully broadcast can be detected at the time point of the designated block generated at the next time point. Each candidate node detects the fake transaction broadcasted by itself, and if the fake transaction broadcast at the previous time point fails, the failed candidate node rebroadcasts the fake transaction. If the broadcast of the pseudo transaction at the previous point in time is successful, the successful candidate node is not re-broadcast.
For example, in each round of consensus, candidate nodes have three opportunities to broadcast a dummy transaction, each performed on the 64m th block of the current round, where m e {1,2,3}. That is, the designated blocks are the 64 th block, the 128 th block, and the 192 th block of the current wheel. Referring to fig. 2 and 3, each candidate node performs a dummy transaction broadcast after completing the block writing operation in the block 64 corresponding to the stage C and the block 192 corresponding to the stage D.
By providing multiple detection opportunities for each candidate node, upon detecting that there are no VRFs broadcast by the candidate node in the transaction set, the corresponding candidate node may broadcast again, ensuring that the candidate node enters the voting pool 20.
Optionally, after the block writing operation is completed by the designated block of the current round, the candidate node of the current round of the blockchain further includes: calculating a hash value of a first block of a current round of the block chain by a target candidate node of the current round; the target candidate node inputs the hash value of the first block of the current round and the private key of the target candidate node into a verifiable random function to obtain a verifiable function value of the target candidate node and signs by adopting the private key of the target candidate node; and the target candidate node encapsulates the signed verifiable function value to obtain a corresponding pseudo transaction.
After the blockchain is started, all candidate nodes can begin to execute the hash value calculation of the first block of the current round, for example, 256 blocks in one round can hash the generated block of the first round when the first round is in common and hash the 257 th block when the second round is in common. Each candidate node then takes the hash value of the first chunk of the current round and its node private key as input to a verifiable random function (Verifiable Random Function, VRF), i.e., VRF input: { block hash value, private key }. Through the VRF function, a verifiable function value of the target candidate node and a proof obtained by signing by adopting a private key of the target candidate node can be output, namely VRF output: { verifiable function value, proof }. The verifiable function value may be a hash value with a certain number of bits, e.g. 32 bytes.
The verifiable random function is an encryption scheme that maps the input to a verifiable pseudo-random output, the verifiable random function can obtain a random output VRF and proof through the VRF input of the target candidate node, and the correctness of the output VRF can be verified with the proof, indicating that the output VRF is generated by the target candidate node through the VRF input. The output value of the VRF contains, in addition to the random hash value, a proof that provides zero knowledge proof of the verification of the random value, i.e., proof of which candidate node the random value was generated from without knowing the candidate node private key.
Optionally, after completing the block writing operation of the current round of consensus last block of the current round, the consensus node of the current round of the blockchain verifies the pseudo transaction broadcasted by each candidate node, including: after completing the block writing operation of the last block of the current round of the block chain, verifying the signed verifiable function value carried by the target pseudo transaction through the public key of the target candidate node to judge whether the private key of the target candidate node is correct or not or whether the verifiable function value of the target candidate node is determined based on the hash of the first block of the current round; if yes, the target consensus node determines that the target pseudo transaction is verified.
To ensure the correctness of the pseudo-transaction placed in the voting pool, candidate nodes are selected for subsequent selection as consensus nodes for the next round of consensus. The pseudo transactions broadcast by each candidate node can be verified after the current round of consensus nodes complete the block writing operation of the current round of consensus last block, and the verified pseudo transactions are collected into the voting pool 20.
Specifically, all consensus nodes of the current round will agree on these pseudo transactions placed in the pool 20. To prevent false VRF outputs from being placed into the transaction set, each candidate node broadcasts a dummy transaction that requires VRF verification to be performed. It can be known from the input field of the VRF function and the verification mode that if the private key provided by a candidate node is incorrect, or the hash is not performed on the correct reference block, i.e. the first block of the current round, the verification cannot be performed, and only the verification-correct pseudo transaction is put into the voting pool 20.
Verification of the pseudo transaction requires the contents of the following table 2:
TABLE 2
The pool of votes is stored in the SLE, and each block-out completion may be updated, and the pseudo-transactions recorded in the pool of votes include VRF output broadcast by candidate nodes. The consensus node obtains the public key and the proof of the target candidate node, and verifies or signs the signed verifiable function value carried by the pseudo transaction.
And 106, after the current round of common node of the block chain completes the block writing operation of the current round of common last block, verifying the pseudo transaction broadcasted by each candidate node and counting the ticket for the verified pseudo transaction.
In this embodiment, after the last block of each round of consensus, for example, the writing block operation of the block 256 corresponding to the stage E shown in fig. 3, all the consensus nodes of the current round count each pseudo transaction collected in the voting pool 20.
And step 108, selecting a preset number of candidate nodes from the candidate nodes verified by the pseudo transaction as the consensus nodes of the next round of consensus according to preset screening rules and the counting result.
According to the counting result of each consensus node, the candidate node queues in the consensus queue 10 are reordered based on a certain rule, and the candidate node ranked at the forefront becomes the consensus node in the next round.
Optionally, according to a preset screening rule, selecting a predetermined number of candidate nodes from candidate nodes with validated pseudo transactions as the consensus nodes of the next round of consensus according to a preset screening rule, wherein the method comprises the following steps: determining random bits of verifiable function values of each pseudo transaction corresponding to the ticket counting result by a consensus node of a current round of a blockchain; reordering candidate nodes of a current round of a blockchain according to the size ordering of the random bits; a predetermined number of candidate nodes arranged at the forefront are determined as consensus nodes of the next round of consensus. The random bits are the first four bits of the verifiable function value.
Referring to fig. 3, the candidate nodes in the consensus queue 10 are reordered according to random bits of verifiable function values in the ticket counting results of each consensus node to obtain a candidate node ordering queue 30. The ordering of the candidate node ordering queue 30 is mapped to the consensus queue 10, thereby reordering the candidate node public key list in the consensus queue 10.
Because the first four bits of the verifiable function value hash are random, this achieves randomization of the candidate node queues. Under the condition that the private key is not revealed, the observer cannot calculate the result of identity rotation of the consensus node, so that the difficulty of opponent behavior is improved, and the possibility of attack of the consensus node is effectively reduced. And the multiparty nodes participate in the candidate node screening process, the system synchronously records the change of the consensus node list on the chain in real time for inquiry, and the participating candidate nodes can verify the authenticity of the random rotation scheme.
Optionally, after selecting the predetermined number of candidate nodes as consensus nodes for the next round of consensus, further comprising: reducing the preset number of consensus nodes arranged at the forefront into candidate nodes according to the first-in first-out principle; the reduced consensus node is replaced with the consensus node determined to be the next round of consensus.
And according to the counting result, implementing the role rotation of the consensus nodes. Starting from the first block of the next round, the consensus node change will be reflected in the consensus queue. For example, the corresponding number of consensus nodes may be reduced to candidate nodes according to the principle of first-in first-out, last-in last-out. That is, the first consensus node in the first consensus queue is first reduced to candidate node, and the node newly raised to the first consensus node is finally reduced after the current consensus. If the target consensus node is designated as a resident node in the initial configuration and is selected to rotate on the round, the resident node is skipped and the change is applied to the next consensus node in the consensus queue.
After the counting has been completed, the consensus queue 10 may be emptied of the voting pool 20 in preparation for receiving a new round of spurious transactions broadcast by candidate nodes of the consensus.
In one embodiment, after selecting a predetermined number of candidate nodes from the candidate nodes for which the pseudo transaction is verified as consensus nodes for a next round of consensus, further comprising: after the next round of consensus begins, the consensus nodes of the current round of the blockchain sequentially check whether the previous round of consensus has undergone a consensus node rotation, wherein one of the consensus nodes checks once when the block writing operation of one block is completed.
Checking whether the last round of consensus has rotated consensus nodes includes checking whether all consensus nodes have counted and rotated and checking whether the voting pool is empty.
Referring to fig. 3, starting from the first block corresponding to the phase F of the second round of consensus, namely, the block 257, the 20 consensus nodes sequentially check whether the previous round of consensus is rotated by the consensus nodes, and each check is completed by one consensus node, so that the check period of the 20 consensus nodes starts from the block-out time point of the block 257 to the block-out time point of the block 276 corresponding to the phase G.
In the embodiment of the application, the block writing operation of the block corresponding to the multiple times of consensus of the current wheel is sequentially completed through the consensus node of the current wheel of the block chain; after the candidate nodes of the current round of the block chain complete the block writing operation in the appointed block of the current round, broadcasting pseudo transactions, wherein the pseudo transactions broadcasted by each candidate node carry verifiable function values determined based on the hash of the first block of the current round and sign by adopting a private key of the corresponding candidate node; after the current round of consensus nodes of the block chain complete the block writing operation of the last block of the current round of consensus, verifying the pseudo transaction broadcasted by each candidate node and counting the ticket of the verified pseudo transaction; according to preset screening rules, selecting a preset number of candidate nodes from candidate nodes which pass verification of pseudo transactions as the next round of consensus nodes according to preset screening rules, so that dynamic random rotation of the consensus nodes and the candidate nodes can be realized, randomization of candidate node queues is achieved, and under the condition that a private key is not leaked, an observer cannot calculate the result of identity rotation of the consensus nodes, the difficulty of opponent behavior is improved, and the possibility of attack of the consensus nodes is effectively reduced. And the multiparty nodes participate in the candidate node screening process, and the participated candidate nodes can verify the authenticity of the random rotation scheme, so that the fairness and the safety of the consensus nodes are ensured.
Optionally, as shown in fig. 4, the embodiment of the present application further provides a device 2000 for rotating a common node of a blockchain, which includes a processor 2400 and a memory 2200, where the memory 2200 stores a program or an instruction that can be executed on the processor 2400, and the program or the instruction implements each step of the embodiment of the rotating a common node of a blockchain when executed by the processor 2400, and can achieve the same technical effect, so that repetition is avoided and no further description is given here.
The embodiment of the present application further provides a readable storage medium, where a program or an instruction is stored on the readable storage medium, where each process of the above-mentioned arbitrary block chain common node rotation method embodiment is implemented when the program or the instruction is executed by a processor, and the same technical effects can be achieved, so that repetition is avoided, and no detailed description is given here. The readable storage medium includes a computer readable storage medium, such as Read-Only Memory (ROM), random access Memory (Random Access Memory, RAM), magnetic disk or optical disk, etc.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk), including several instructions for causing a terminal (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the method described in the embodiments of the present application.
The embodiments of the present application have been described above with reference to the accompanying drawings, but the present application is not limited to the above-described embodiments, which are merely illustrative and not restrictive, and many forms may be made by those of ordinary skill in the art without departing from the spirit of the present application and the scope of the claims, which are also within the protection of the present application.

Claims (10)

1. A method for rotation of consensus nodes of a blockchain, comprising:
the common node of the current wheel of the block chain sequentially completes the block writing operation of the block corresponding to the multiple common codes of the current wheel;
after the candidate nodes of the current round of the block chain complete the block writing operation in the appointed block of the current round, broadcasting pseudo transactions, wherein the pseudo transactions broadcasted by each candidate node carry verifiable function values determined based on the hash of the first block of the current round and sign by adopting a private key of the corresponding candidate node;
after the current round of consensus nodes of the block chain complete the block writing operation of the last block of the current round of consensus, verifying the pseudo transaction broadcasted by each candidate node and counting the ticket of the verified pseudo transaction;
and selecting a preset number of candidate nodes from candidate nodes which pass verification of the pseudo transaction as consensus nodes of the next round of consensus according to preset screening rules and a counting result by the consensus nodes of the current round of the blockchain.
2. The method of claim 1, wherein the designated blocks comprise a plurality of blocks, each designated block being spaced apart by a predetermined number of blocks,
after the block writing operation is completed by the appointed block of the current round, the candidate node of the current round of the block chain broadcasts a pseudo transaction, which comprises the following steps:
broadcasting a pseudo transaction after a candidate node of a current round of a block chain completes a block writing operation in a first appointed block of the current round;
each candidate node checks whether the corresponding pseudo transaction is successfully broadcast;
if the candidate node fails, the candidate node broadcasting the failure rebroadcasts the pseudo transaction after the second designated block of the current round completes the writing block operation, wherein the second designated block is generated later than the first designated block.
3. The method of claim 1, wherein the candidate nodes for the current round of the blockchain, after the specified block of the current round completes a write block operation, are further comprised of:
calculating a hash value of a first block of a current round of the block chain by a target candidate node of the current round;
the target candidate node inputs the hash value of the first block of the current round and the private key of the target candidate node into a verifiable random function to obtain a verifiable function value of the target candidate node and signs by adopting the private key of the target candidate node;
and the target candidate node encapsulates the signed verifiable function value to obtain a corresponding pseudo transaction.
4. The method of claim 3, wherein the current round of consensus nodes of the blockchain verify the dummy transactions broadcast by each candidate node after completing the block writing operation of the current round of consensus last block, comprising:
after completing the block writing operation of the last block of the current round of the block chain, verifying the signed verifiable function value carried by the target pseudo transaction through the public key of the target candidate node to judge whether the private key of the target candidate node is correct or not or whether the verifiable function value of the target candidate node is determined based on the hash of the first block of the current round;
if yes, the target consensus node determines that the target pseudo transaction is verified.
5. The method of claim 1, wherein selecting a predetermined number of candidate nodes from the candidate nodes for which the pseudo-transaction is validated as the consensus node for the next round of consensus according to the preset screening rule and based on the ticketing result, the consensus node for the current round of blockchain comprises:
determining random bits of verifiable function values of each pseudo transaction corresponding to the ticket counting result by a consensus node of a current round of a blockchain;
reordering candidate nodes of a current round of a blockchain according to the size ordering of the random bits;
a predetermined number of candidate nodes arranged at the forefront are determined as consensus nodes of the next round of consensus.
6. The method of claim 5, wherein the random bits are the first four bits of the verifiable function value.
7. The method as recited in claim 5, further comprising:
reducing the preset number of consensus nodes arranged at the forefront into candidate nodes according to the first-in first-out principle;
the reduced consensus node is replaced with the consensus node determined to be the next round of consensus.
8. The method of claim 1, further comprising, after selecting a predetermined number of candidate nodes from the candidate nodes for which the pseudo-transaction is validated as consensus nodes for a next round of consensus:
after the next round of consensus begins, the consensus nodes of the current round of the blockchain sequentially check whether the previous round of consensus has undergone a consensus node rotation, wherein one of the consensus nodes checks once when the block writing operation of one block is completed.
9. A block chain consensus node rotation apparatus, comprising: a memory and a processor electrically connected to the memory, the memory storing a program or instructions executable by the processor, the program or instructions implementing the steps of the method of any one of claims 1 to 8 when executed by the processor.
10. A readable storage medium, characterized in that it has stored thereon a program or instructions which, when executed by a processor, implement the steps of the method according to any of claims 1 to 8.
CN202410042944.9A 2024-01-11 2024-01-11 Method and device for rotating consensus nodes of block chain and readable storage medium Active CN117560161B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410042944.9A CN117560161B (en) 2024-01-11 2024-01-11 Method and device for rotating consensus nodes of block chain and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410042944.9A CN117560161B (en) 2024-01-11 2024-01-11 Method and device for rotating consensus nodes of block chain and readable storage medium

Publications (2)

Publication Number Publication Date
CN117560161A CN117560161A (en) 2024-02-13
CN117560161B true CN117560161B (en) 2024-04-09

Family

ID=89813283

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410042944.9A Active CN117560161B (en) 2024-01-11 2024-01-11 Method and device for rotating consensus nodes of block chain and readable storage medium

Country Status (1)

Country Link
CN (1) CN117560161B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2020011182A1 (en) * 2018-07-10 2020-01-16 云图有限公司 Consensus method, device and system based on effective computation power contribution
CN112953981A (en) * 2019-11-26 2021-06-11 北京沃东天骏信息技术有限公司 Node selection method, block chain consensus method, device, system and equipment
CN113939821A (en) * 2019-05-16 2022-01-14 区块链控股有限公司 System and method for non-parallel mining on a workload justification blockchain network

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP3435273A1 (en) * 2017-07-25 2019-01-30 Gemalto Sa Consensus protocol for permissioned ledgers

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2020011182A1 (en) * 2018-07-10 2020-01-16 云图有限公司 Consensus method, device and system based on effective computation power contribution
CN113939821A (en) * 2019-05-16 2022-01-14 区块链控股有限公司 System and method for non-parallel mining on a workload justification blockchain network
CN112953981A (en) * 2019-11-26 2021-06-11 北京沃东天骏信息技术有限公司 Node selection method, block chain consensus method, device, system and equipment

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
一种基于分组的区块链共识算法;张思贤;文捷;;计算机应用与软件;20200312(03);全文 *

Also Published As

Publication number Publication date
CN117560161A (en) 2024-02-13

Similar Documents

Publication Publication Date Title
CN107220130B (en) Method, device and system for realizing information consensus at nodes of block chain
CN109165945B (en) Representative node device election method and device, computer device and storage medium
CN108848055B (en) Block chain consensus method, accounting node and node
CN111629039B (en) Block chain consensus method, client, endorsement node and sequencing node
CN107566124B (en) Hash operation-based consensus establishing method, block chain system and storage medium
CN110300172B (en) Block chain data consensus method and related equipment
CN108711212B (en) Voting certificate storage method, device and system
US11017036B2 (en) Publicly verifiable proofs of space
CN109753269B (en) Random number generation method, device, equipment and storage medium for block chain
CN110445616B (en) Block packing node packing sequence determining method, equipment and storage medium
CN110599177A (en) Transaction verification method and related equipment
CN111010284B (en) Processing method of block to be identified, related device and block chain system
CN110912705B (en) Distributed electronic voting method and system based on block chain
CN108234134A (en) Block synchronous method and system
CN107911819B (en) Method and system for selecting packaging node based on mobile phone number
CN112689848A (en) Consensus method of block chain data and related equipment
CN112700314A (en) Auction method and system based on mixed block chain
CN110661656B (en) Block chain rapid consensus method and device
CN112187475A (en) Method and device for performing multi-center accounting based on trusted computing and related products
CN117560161B (en) Method and device for rotating consensus nodes of block chain and readable storage medium
CN111881147B (en) Processing method and device of computing task, storage medium and processor
CN114884968A (en) Situation awareness method based on block chain privacy transaction and related device
CN112583908B (en) Block chain consensus method, system, equipment and medium applied to block outlet node
CN112261145B (en) New block chain generation method and device
CN108306937A (en) Sending method, acquisition methods, server and the storage medium of short message verification code

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