Consensus configuration method and device, equipment, storage medium and computer program product

By constructing voting events in the blockchain to process the application and abandonment events of block nodes, consensus configuration is carried out based on the number of votes and the total number of nodes, the problem of poor consensus security in blockchain is solved, and higher consensus security and decentralization are achieved.

CN120498635APending Publication Date: 2025-08-15中移信息技术有限公司 +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510669186.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-22
Publication Date
2025-08-15

AI Technical Summary

Technical Problem

The existing technology has the problem of poor consensus security in blockchain consensus configuration, especially due to the decline in network decentralization and consensus threats caused by the rights and interests consensus algorithm.

Method used

By constructing voting events to handle events that apply to become and abandon block nodes, consensus configuration is carried out based on the number of votes and the total number of nodes, innovation of the addition and deletion logic of block nodes, and avoiding dependence on digital currency.

Benefits of technology

It improves the consensus security of blockchain, prevents the problem of poor consensus security, and ensures the decentralization and security of blockchain networks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120498635A_ABST
    Figure CN120498635A_ABST
Patent Text Reader

Abstract

The invention discloses a consensus configuration method and device, equipment, a storage medium and a computer program product, and relates to the technical field of blockchains, the method comprises the following steps: when an application event is received, initiating a voting event to a block-out node in a blockchain, the application event comprising an event of applying for becoming the block-out node and an event of applying for giving up the block-out node; determining a vote number corresponding to a target node involved in the application event according to the voting event; and performing consensus configuration on the block chain based on the votes and the total number of nodes, wherein the total number of nodes is the total number of block-out nodes included in the block chain. Compared with the prior art that a right consensus algorithm is used for performing consensus configuration on the block chain, the method provided by the invention has the advantages that the application event is processed by constructing the voting event to elect the block node and abandon the block node, so that an addition and deletion logic of the block node is innovated to perform consensus configuration on the block chain; the dependence of related technologies on digital currency is avoided, and the consensus security of the block chain is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of blockchain technology, and in particular to a consensus configuration method, apparatus, device, storage medium, and computer program product. Background Art

[0002] Currently, the Delegated Proof of Stake (DPOS) algorithm is commonly used when configuring consensus on a blockchain. This algorithm relies on users in the blockchain to use digital currency as collateral to vote to form a consensus to configure the blockchain.

[0003] However, because blockchain's digital currency model is micro-inflationary, which means the total amount of digital currency will slowly increase, users may be able to obtain digital currency dividends by staking digital currency for voting. When a large number of users are attracted by high dividends, voting power will be concentrated in a small number of nodes, resulting in a decrease in the blockchain's network decentralization and threatening the security of the consensus of the entire network. Summary of the Invention

[0004] The main purpose of this application is to provide a consensus configuration method, device, equipment, storage medium and computer program product, aiming to solve the technical problem of poor consensus security when performing consensus configuration on blockchain in related technologies.

[0005] To achieve the above objectives, the present application provides a consensus configuration method, which includes the following steps:

[0006] When an application event is received, a voting event is initiated to the block-producing node in the blockchain. The application event includes an application to become a block-producing node event and an application to give up a block-producing node event;

[0007] Determine the number of votes corresponding to the target node involved in the application event according to the voting event;

[0008] The blockchain is configured for consensus based on the number of votes and the total number of nodes, where the total number of nodes is the total number of block-producing nodes in the blockchain.

[0009] In one embodiment, when an application event is received, the step of initiating a voting event to a block producer node in the blockchain includes:

[0010] When receiving an application from any node other than a block-producing node in the blockchain to become a block-producing node, a voting event is initiated to the block-producing node;

[0011] When receiving an event of requesting to give up the block producing node issued by the block producing node and / or any node on behalf of the block producing node, initiating a voting event to the block producing node;

[0012] In the voting event, if a change is detected in the block producing node list, the voting rights of the block producing node are updated according to the changed block producing node list.

[0013] In one embodiment, the step of performing consensus configuration on the blockchain based on the number of votes and the total number of nodes includes:

[0014] If the number of votes is greater than or equal to a preset proportion of the total number of nodes, the blockchain is configured for consensus according to the application event;

[0015] If the number of votes is less than a preset proportion of the total number of nodes within a preset time period, the blockchain is configured according to the existing consensus and the voting event is canceled.

[0016] In one embodiment, if the number of votes is greater than or equal to a preset proportion of the total number of nodes, the step of performing consensus configuration on the blockchain according to the application event includes:

[0017] If the number of votes is greater than or equal to a preset proportion of the total number of nodes, and the application event is an application to become a block producing node event, then consensus configuration of the blockchain is performed according to the application to become a block producing node event;

[0018] If the number of votes is greater than or equal to a preset proportion of the total number of nodes, and the application event is an application to abandon the block-producing node event, and the number of block-producing nodes in the block-producing node list is greater than or equal to a preset value, then the blockchain is configured for consensus based on the application to abandon the block-producing node event. The application to abandon the block-producing node event is executed at most once in a single cycle;

[0019] If the number of votes is greater than or equal to a preset proportion of the total number of nodes, and the application event is an application to give up the block-producing node event, and the number of block-producing nodes in the block-producing node list is less than a preset value, the blockchain is configured according to the existing consensus.

[0020] In addition, the present application also provides a node admission method, which includes the following steps:

[0021] When receiving a connection request from a target node to the blockchain network, obtaining the connection certificate and node information of the target node;

[0022] Determine whether to allow the target node to access the blockchain network based on the connection certificate and the node information.

[0023] In one embodiment, the step of determining whether to allow the target node to access the blockchain network based on the connection certificate and the node information includes:

[0024] If the connection certificate matches the preset certificate, the node information is included in the security group contract, and there is no other node in the blockchain network that contains the connection certificate and the node information, then the target node is allowed to access the blockchain network;

[0025] If the connection certificate does not match the preset certificate, or the node information is not included in the security combination contract, or there are other nodes in the blockchain network that contain the connection certificate and the node information, the target node is denied access to the blockchain network.

[0026] In addition, to achieve the above objectives, the present application also proposes a consensus configuration device, which includes:

[0027] A voting initiation module is used to initiate a voting event to a block-producing node in the blockchain upon receiving an application event, including an application to become a block-producing node event and an application to give up a block-producing node event;

[0028] A vote counting module, configured to determine the number of votes corresponding to the target node involved in the application event according to the voting event;

[0029] A consensus configuration module is used to perform consensus configuration on the blockchain based on the number of votes and the total number of nodes, where the total number of nodes is the total number of block-producing nodes in the blockchain.

[0030] In addition, to achieve the above-mentioned purpose, the present application also proposes a consensus configuration device, which includes: a memory, a processor, and a consensus configuration program stored on the memory and executable on the processor, wherein the consensus configuration program is configured to implement the steps of the consensus configuration method described above.

[0031] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a consensus configuration program is stored on the storage medium. When the consensus configuration program is executed by the processor, the steps of the consensus configuration method described above are implemented.

[0032] In addition, to achieve the above-mentioned purpose, the present invention also provides a computer program product, which includes a consensus configuration program, and when the consensus configuration program is executed by a processor, it implements the steps of the consensus configuration method described above.

[0033] When receiving an application event, this application initiates a voting event to the block-producing nodes in the blockchain, wherein the application event includes an application event to become a block-producing node and an application to give up a block-producing node; the number of votes corresponding to the target node involved in the application event is determined according to the voting event; the blockchain is configured for consensus based on the number of votes and the total number of nodes, wherein the total number of nodes is the total number of block-producing nodes in the blockchain. Compared with the related art that uses the equity consensus algorithm to perform consensus configuration on the blockchain, the above method of this application proposes a consensus configuration method to construct a voting event, and processes the application event to become a block-producing node and the application to give up a block-producing node based on the voting event to elect a block-producing node and give up a block-producing node, thereby innovating a logic for adding and deleting block-producing nodes to perform consensus configuration on the blockchain, avoiding the related art's reliance on digital currency, and thereby improving the consensus security of the blockchain. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0035] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following briefly introduces the drawings required for use in the embodiments or related technical descriptions. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0036] Figure 1 This is a flowchart of the first embodiment of the consensus configuration method of this application;

[0037] Figure 2 This is a flow chart of the second embodiment of the consensus configuration method of this application;

[0038] Figure 3 This is a flowchart of the third embodiment of the consensus configuration method of this application;

[0039] Figure 4 This is a schematic diagram of one of the admission conditions of the node admission method for this application;

[0040] Figure 5 This is a schematic diagram of the second admission situation of the node admission method for this application;

[0041] Figure 6 This is a schematic diagram of the non-admission situation of the node admission method for this application;

[0042] Figure 7 This is a structural block diagram of the first embodiment of the consensus configuration device of this application;

[0043] Figure 8This is a structural diagram of the consensus configuration device of the hardware operating environment involved in the embodiment of the present application.

[0044] The realization of the objectives, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0045] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not intended to limit the present application.

[0046] It should be noted that the execution subject of the embodiments of the present application can be a computing service device with data processing, network communication, and program execution functions, such as a tablet computer, personal computer, mobile phone, etc., or an electronic device capable of performing the above functions, such as the consensus configuration device described above. The following embodiments are described below using the consensus configuration device as an example.

[0047] This application embodiment provides a consensus configuration method, referring to Figure 1 , Figure 1 This is a flowchart of the first embodiment of the consensus configuration method of this application.

[0048] In this embodiment, the consensus configuration method includes the following steps:

[0049] Step S10: When an application event is received, a voting event is initiated to the block-producing node in the blockchain. The application event includes an event of applying to become a block-producing node and an event of applying to give up a block-producing node.

[0050] It should be noted that the above-mentioned blockchain can be EOS (Enterprise Operation System, a commercial distributed design blockchain operating system).

[0051] It is understood that when a node submits the aforementioned "apply to become a block producer" event to the consensus configuration device, it indicates its intention to become a block producer; when a node submits the aforementioned "apply to relinquish block producer" event to the consensus configuration device, it indicates its intention to relinquish block producer status. The aforementioned voting event gathers the opinions of block producers on the application event by obtaining the votes of each block producer. Therefore, only block producers have voting rights. To ensure fairness, each block producer has equal voting weight in the voting event.

[0052] In a specific implementation, the conditions for applying to become a block producer can be: any user can apply to become a block producer, and this interface can be used to update the user's application information. Users who have already become block producers cannot apply again; users who are already in the application list cannot apply again. The conditions for applying to relinquish block producer status can be: only block producers can apply to relinquish block producer status; any user can apply to relinquish block producer status on behalf of a block producer; users who are already in the application list cannot apply again. Block producers can vote on both applications to become block producers and applications to relinquish block producer status; block producers cannot vote on the same application more than once.

[0053] Step S20: Determine the number of votes corresponding to the target node involved in the application event according to the voting event.

[0054] It should be noted that, when the above-mentioned application event is an event of applying to become a block-producing node, the above-mentioned target node can be any node that applies to become a block-producing node, and the corresponding number of votes can be the total number of votes obtained by any node that applies to become a block-producing node in this voting event; when the above-mentioned application event is an event of applying to give up the block-producing node, the above-mentioned target node can be the block-producing node that applies to give up the block-producing node, and the corresponding number of votes can be the total number of votes obtained by the block-producing node that applies to give up the block-producing node in this voting event.

[0055] Step S30: performing consensus configuration on the blockchain based on the number of votes and the total number of nodes, where the total number of nodes is the total number of block-producing nodes in the blockchain.

[0056] In a specific implementation, it is possible to determine whether the block nodes in the blockchain have reached a consensus on the application event corresponding to the vote event based on the above-mentioned number of votes and the total number of nodes. When the number of votes reaches a certain pre-set condition (for example, the number of votes accounts for more than a certain ratio of the total number of nodes), it can be considered that the block nodes in the blockchain have reached a consensus on the application event corresponding to the vote event, and therefore the application event can be approved for execution, and the blockchain is configured for consensus based on the application event. At the same time, in this embodiment, in order to avoid the voting operation being performed when the number of votes does not meet the conditions, a voting time can be set for the voting event, that is, if the number of votes still does not meet the pre-set conditions at the end of the voting time, it can be considered that the block nodes in the blockchain have not reached a consensus on the application event corresponding to the vote event, and therefore the application event is not approved for execution. At this time, the consensus of the previous time period or the default consensus can be used to configure the blockchain for consensus.

[0057] In addition, in this embodiment, the consensus configuration will involve five parts: modifying the system configuration, registering candidate nodes for block generation, node voting, exiting the candidate node list, and canceling voting.

[0058] The Modify System Configuration section is used to modify the parameters for dynamic block generation / consensus switching. The parameters that can be modified are shown in Table 1 below. DPOS (Delegated Proof of Stake) stands for Delegated Proof of Stake, and POA (Proof of Authority) stands for Proof of Authority.

[0059] Table 1

[0060]

[0061]

[0062] The method used to modify the system configuration is called setconfig (set configuration). The parameter list corresponding to this method name is shown in Table 2 below.

[0063] Table 2

[0064] Parameter name Parameter Type illustrate Example key name Configuration item key consensus value uint64_t Configuration item value 2

[0065] In the block production candidate node registration part, the POA consensus and DPOS consensus use this interface to register candidate nodes, and after being voted by the corresponding consensus, they become block production nodes. The method used in the block production candidate node registration part is called regproducer (register producer). The corresponding parameter list of this method name is shown in Table 3 below.

[0066] Table 3

[0067]

[0068] In the node voting section, users with voting rights vote for candidate block producers. For the DPOS consensus, users who stake resources have voting rights. Users set up proxies and arrays of voted nodes as normal to cast their votes. For the POA consensus, all block producers have voting rights. To maintain compatibility with the DPOS consensus interface, the proxy field is unused, and the producers array only accepts the zeroth element. The method used in the node voting section is called voteproducer (vote producer). The corresponding parameters for this method are shown in Table 4 below.

[0069] Table 4

[0070] Parameter name Parameter Type illustrate Example voter name voters testprodbbbb proxy name Proxy Voter "" producers vector Voted nodes [testprodcccc]

[0071] In the "Exit Candidate Node List" section, you can exit the candidate node. After the POA consensus vote, the node will be removed from the candidate list. The proposer initiates a proposal to cause the producer to exit the candidate node. The method used to exit the candidate node list is called "unregprodpoa" (unregister producer in POA). The corresponding parameters are shown in Table 5 below.

[0072] Table 5

[0073] Parameter name Parameter Type illustrate Example producer name Exited nodes testprodaaaa proposer name Proposer testprodeeee

[0074] In the cancel vote section, if a proposal fails to reach consensus within 48 hours, this interface can be called to cancel the vote. The method used to cancel the vote is called cancelvote (cancel vote), and the corresponding parameters are shown in Table 6 below.

[0075] Table 6

[0076]

[0077] When receiving an application event, this embodiment initiates a voting event to the block-producing nodes in the blockchain. The application event includes an application to become a block-producing node event and an application to give up a block-producing node event; the number of votes corresponding to the target node involved in the application event is determined based on the voting event; the blockchain is configured for consensus based on the number of votes and the total number of nodes, where the total number of nodes is the total number of block-producing nodes in the blockchain. Compared to the related art that uses a stake consensus algorithm to perform consensus configuration on the blockchain, the above method of this embodiment proposes a consensus configuration method to construct a voting event, and based on the voting event, processes the application to become a block-producing node event and the application to give up a block-producing node event to elect a block-producing node and give up a block-producing node, thereby innovating a logic for adding and deleting block-producing nodes to perform consensus configuration on the blockchain, avoiding the related art's reliance on digital currency, and thereby improving the consensus security of the blockchain.

[0078] refer to Figure 2 , Figure 2 This is a flowchart of the second embodiment of the consensus configuration method of this application.

[0079] In a feasible implementation, step S10 may include:

[0080] Step S101: When receiving an event of an application to become a block producing node from any node other than a block producing node in the blockchain, a voting event is initiated to the block producing node.

[0081] It is understandable that since users who have already become block-producing nodes cannot apply again, the above-mentioned application event to become a block-producing node can be issued by any node in the blockchain except the block-producing node.

[0082] Step S102: When receiving an event of applying to give up the block producing node issued by the block producing node and / or any node on behalf of the block producing node, a voting event is initiated to the block producing node.

[0083] Step S103: In the voting event, if it is detected that the block producing node list has changed, the voting rights of the block producing node are updated according to the changed block producing node list.

[0084] It should be understood that to ensure the validity of voting events, when a change is detected in the list of block-producing nodes, the voting rights of the block-producing nodes can be updated according to the changed list of block-producing nodes. In other words, the block-producing nodes with voting rights are updated in real time to prevent non-block-producing nodes from influencing the voting results. For example, if it is detected during voting that nodes A and B in the block-producing node list have relinquished their block-producing node status, the system will automatically revoke the voting rights of nodes A and B.

[0085] In a feasible implementation, step S30 may include:

[0086] Step S301: If the number of votes is greater than or equal to a preset proportion of the total number of nodes, consensus configuration is performed on the blockchain according to the application event.

[0087] It should be noted that the above preset ratio can be flexibly set by the administrator, for example, 2 / 3.

[0088] It should be understood that if the number of votes is greater than or equal to a preset proportion of the total number of nodes, it can indicate that the block-producing nodes in the blockchain have reached a consensus at this time, so the blockchain can be configured for consensus based on the specific application event.

[0089] In the specific implementation, if the number of votes is greater than or equal to the preset proportion of the total number of nodes, the application event will enter the waiting state and will no longer be voted.

[0090] Step S302: If the number of votes is less than a preset proportion of the total number of nodes within a preset time period, the blockchain is configured according to the existing consensus and the voting event is canceled.

[0091] It should be noted that the above preset duration can be flexibly set by the administrator, for example, 48 hours.

[0092] It should be understood that if the number of votes received within a preset time period is less than a preset proportion of the total number of nodes, this indicates that the block-producing nodes in the blockchain have not reached consensus. Therefore, there is no need to modify the blockchain consensus, and the existing consensus can be used to configure the blockchain. At the same time, to avoid unnecessary resource consumption, the voting event can be canceled when it is determined that the block-producing nodes in the blockchain have not reached consensus. This means that users will no longer be allowed to vote. Any user can cancel the voting event. After cancellation, the user can immediately re-submit the application event, and users cannot initiate the application event without canceling the application.

[0093] In a feasible implementation, step S301 may include:

[0094] Step S3011: If the number of votes is greater than or equal to a preset proportion of the total number of nodes, and the application event is an application to become a block-producing node event, consensus configuration is performed on the blockchain based on the application to become a block-producing node event.

[0095] Step S3012: If the number of votes is greater than or equal to a preset proportion of the total number of nodes, and the application event is an event of applying to give up the block-producing node, and the number of block-producing nodes in the block-producing node list is greater than or equal to a preset value, then the blockchain is configured for consensus based on the event of applying to give up the block-producing node. The event of applying to give up the block-producing node is executed at most once in a single cycle.

[0096] In specific implementations, the consensus configuration device system will query every certain period of time (e.g., 60 seconds) to see if there are any pending application events. All applications to become block-producing nodes will be executed. At the same time, to prevent a large number of block-producing nodes from exiting in a short period of time, which would prevent the irreversible block from growing, the application to abandon the block-producing node event will be executed at most once within a cycle. Once the application is confirmed, the operation of changing the block-producing node (i.e., adding a block-producing node or deleting a block-producing node, where the application to become a block-producing node event corresponds to adding a block-producing node, and the application to abandon the block-producing node event corresponds to deleting a block-producing node) will be executed immediately, and the new block-producing node list will be submitted to the blockchain system.

[0097] Step S3013: If the number of votes is greater than or equal to a preset proportion of the total number of nodes, and the application event is an event of applying to give up the block-producing node, and the number of block-producing nodes in the block-producing node list is less than a preset value, the blockchain is configured according to the existing consensus.

[0098] It should be noted that the above preset value can be flexibly set by the administrator, for example, 1.

[0099] In the specific implementation, since the system does not allow the block-producing node list to be empty, when there is only the last block-producing node in the block-producing node list, the application to abandon the block-producing node event will not be executed. At this time, the blockchain consensus configuration can be performed based on the existing consensus.

[0100] In this embodiment, when an event of an application to become a block-producing node is received from any node other than the block-producing node in the blockchain, a voting event is initiated to the block-producing node; when an event of an application to give up the block-producing node is received from the block-producing node and / or any node on behalf of the block-producing node, a voting event is initiated to the block-producing node; in the voting event, if a change is detected in the block-producing node list, the voting rights of the block-producing node are updated according to the changed block-producing node list; if the number of votes is greater than or equal to the preset proportion of the total number of nodes, and the application event is an event of applying to become a block-producing node, the blockchain is configured according to the event of applying to become a block-producing node; if the number of votes is greater than or equal to the preset proportion of the total number of nodes, The preset proportion of the total number of nodes, and the application event is an application to give up the block node event, and the number of block nodes in the block node list is greater than or equal to the preset value, then the blockchain is configured according to the consensus based on the application to give up the block node event, and the application to give up the block node event is executed at most once in a single cycle; if the number of votes is greater than or equal to the preset proportion of the total number of nodes, and the application event is an application to give up the block node event, and the number of block nodes in the block node list is less than the preset value, then the blockchain is configured according to the existing consensus; if the number of votes is less than the preset proportion of the total number of nodes within the preset time, then the blockchain is configured according to the existing consensus and the voting event is canceled. The above method of this embodiment defines the application conditions and voting conditions of each node in the blockchain, and continuously updates the voting rights of the block node in the voting event, ensuring the validity of the vote. At the same time, based on the relationship between the number of votes and the total number of nodes, it is possible to accurately understand whether the block-producing nodes in the blockchain have reached a consensus. That is, when the number of votes is greater than or equal to the preset proportion of the total number of nodes, it indicates that a consensus has been reached, and the blockchain can be configured for consensus based on the application event. When the number of votes is less than the preset proportion of the total number of nodes, it indicates that a consensus has not been reached, and therefore configuration can be performed based on the existing consensus.

[0101] The present application also provides a node admission method, referring to Figure 3 , Figure 3 This is a flowchart of the first embodiment of the node admission method of this application.

[0102] In this embodiment, the node admission method includes the following steps:

[0103] Step S1: When receiving a connection request from a target node to a blockchain network, obtain the connection certificate and node information of the target node.

[0104] It should be understood that the target node can be any node with network connectivity, and the blockchain network can be the system network of the EOS blockchain. The connection certificate is used to establish a TLS (Transport Layer Security) connection between nodes, ensuring node communication security and node access control. The node information can include the node's name, IP address, behavior record, public key, etc., which is not limited in this embodiment.

[0105] Step S2: Determine whether to allow the target node to access the blockchain network based on the connection certificate and the node information.

[0106] It should be understood that the above-mentioned connection certificate and the above-mentioned node information can be verified: if the connection certificate and the node information are both verified, it is determined that the above-mentioned target node is allowed to access the blockchain network; if the connection certificate fails to pass the verification and / or the node information fails to pass the verification, it is determined that the above-mentioned target node is not allowed to access the blockchain network.

[0107] In a feasible implementation, step S2 may include:

[0108] Step S21: If the connection certificate matches the preset certificate, the node information is included in the security group contract, and there is no other node in the blockchain network that contains the connection certificate and the node information, then the target node is allowed to access the blockchain network.

[0109] It should be noted that the pre-set certificate is a certificate that can establish a TLS (Transport Layer Security) connection between nodes, ensuring the security of peer-to-peer (P2P) communication and node access control. Specifically, the pre-set certificate is issued by an administrator, and the target node must load the pre-set certificate to be admitted to the blockchain network.

[0110] The aforementioned security contract represents a design paradigm for high-security smart contracts on the blockchain. It allows administrators to add and remove node information. Only nodes approved by the contract table are allowed to join the blockchain network. It also supports dynamic removal. If a node has been approved for addition and connected to the blockchain network and its corresponding node information is removed from the security contract, it will be kicked out of the blockchain network and will no longer synchronize block information from the blockchain network.

[0111] In a specific implementation, if the connection certificate of the target node matches the preset certificate, the node information is included in the security combination contract, and there are no other nodes in the blockchain network that contain the connection certificate and node information, then it is determined that the connection certificate and node information of the target node have passed the verification, and therefore it can be allowed to enter the blockchain network.

[0112] For example, reference may be made to Figure 4 , Figure 4 This is a schematic diagram of one of the admission conditions of the node admission method of this application. Figure 4 In the example, pem indicates the preset certificate, pub_key1 in the security contract corresponds to node 1, pub_key2 corresponds to node 2, and pub_key3 corresponds to node 3. "abcd......xyz" indicates other node information examples, which will not be described here. Figure 4 The connection certificates of nodes 1 to 3 all match the preset certificates (that is, the node has loaded the preset certificates), and the node information is included in the security group contract (that is, the node has joined the security group contract), and there are no other nodes in the blockchain network that contain connection certificates and node information. Therefore, nodes 1 to 3 can be admitted to the blockchain network.

[0113] You can also refer to Figure 5 , Figure 5 This is the second schematic diagram of the access situation of the node access method of this application. Figure 5 In the example, pem indicates the preset certificate, pub_key1 in the security contract corresponds to node 1, pub_key2 corresponds to node 2, pub_key3 corresponds to node 3, and pub_key4 corresponds to node 4. "abcd......xyz" indicates other node information examples, which will not be described here. Figure 5 The connection certificates of nodes 1 to 4 all match the preset certificates, the node information is included in the security combination contract, and there are no other nodes in the blockchain network that contain connection certificates and node information. Therefore, nodes 1 to 4 can be admitted to the blockchain network.

[0114] Step S22: If the connection certificate does not match the preset certificate, or the node information is not included in the security combination contract, or there are other nodes in the blockchain network that contain the connection certificate and the node information, the target node is denied access to the blockchain network.

[0115] In a specific implementation, if the connection certificate of the target node does not match the preset certificate, it can be determined that the connection certificate of the target node has not passed the verification; if the node information of the target node is not included in the security group contract, it can be determined that the node information of the target node has not passed the verification. In addition, since this embodiment stipulates that only one node with the same certificate and public key can be allowed to join the blockchain network in the entire system, after the node joins the blockchain network, other nodes with the same certificate and public key will be rejected from joining the blockchain network. Therefore, if there are other nodes in the blockchain network that contain the same connection certificate and the above-mentioned node information as the target node (that is, there are other nodes in the blockchain network that have the same certificate and public key as the target node), the public key of the target node can be extracted from the node information of the target node.

[0116] For example, reference may be made to Figure 6 , Figure 6 This is a schematic diagram of the non-admission situation of the node admission method of this application. It can be seen that Figure 6 Although node 4 has joined the security contract, it has not loaded the preset certificate. Although node 5 has loaded the preset certificate, it has not joined the security contract. Therefore, both node 4 and node 5 are not allowed to enter the blockchain network.

[0117] When receiving a connection request from a target node to a blockchain network, this embodiment obtains the target node's connection certificate and node information. If the connection certificate matches a preset certificate, the node information is included in the security contract, and no other node in the blockchain network contains the connection certificate and node information, the target node is allowed to access the blockchain network. If the connection certificate does not match the preset certificate, or the node information is not included in the security contract, or no other node in the blockchain network contains the connection certificate and node information, the target node is denied access to the blockchain network. This embodiment proposes a node access method, namely, constructing a security contract to further control the access and disconnection of the target node based on the contract layer. At the same time, node access is controlled based on the preset certificate, and access nodes are managed through the security contract. In addition, nodes that do not meet the access requirements can be removed through the security contract, prohibiting them from accessing the blockchain network, thereby ensuring the network security of the blockchain network.

[0118] Reference Figure 7 , Figure 7 This is a structural block diagram of the first embodiment of the consensus configuration device of this application.

[0119] like Figure 7 As shown, the consensus configuration device proposed in the embodiment of the present application includes:

[0120] The voting initiation module 701 is used to initiate a voting event to a block-producing node in the blockchain upon receiving an application event, wherein the application event includes an event of applying to become a block-producing node and an event of applying to give up a block-producing node;

[0121] The vote counting module 702 is used to determine the number of votes corresponding to the target node involved in the application event according to the voting event;

[0122] The consensus configuration module 703 is used to perform consensus configuration on the blockchain based on the number of votes and the total number of nodes, where the total number of nodes is the total number of block-producing nodes in the blockchain.

[0123] When receiving an application event, this embodiment initiates a voting event to the block-producing nodes in the blockchain. The application event includes an application to become a block-producing node event and an application to give up a block-producing node event; the number of votes corresponding to the target node involved in the application event is determined based on the voting event; the blockchain is configured for consensus based on the number of votes and the total number of nodes, where the total number of nodes is the total number of block-producing nodes in the blockchain. Compared to the related art that uses a stake consensus algorithm to perform consensus configuration on the blockchain, the above method of this embodiment proposes a consensus configuration method to construct a voting event, and based on the voting event, processes the application to become a block-producing node event and the application to give up a block-producing node event to elect a block-producing node and give up a block-producing node, thereby innovating a logic for adding and deleting block-producing nodes to perform consensus configuration on the blockchain, avoiding the related art's reliance on digital currency, and thereby improving the consensus security of the blockchain.

[0124] Based on the first embodiment of the consensus configuration device of the present application, a second embodiment of the consensus configuration device of the present application is proposed.

[0125] In this embodiment, the voting initiation module 701 is further used to initiate a voting event to the block-producing node when receiving an event of an application from any node other than the block-producing node in the blockchain to become a block-producing node; when receiving an event of an application from the block-producing node and / or any node to give up the block-producing node on behalf of the block-producing node, initiate a voting event to the block-producing node; in the voting event, if a change is detected in the block-producing node list, the voting rights of the block-producing node are updated according to the changed block-producing node list.

[0126] Furthermore, the consensus configuration module 703 is also used to perform consensus configuration on the blockchain according to the application event if the number of votes is greater than or equal to the preset proportion of the total number of nodes; if the number of votes is less than the preset proportion of the total number of nodes within a preset time period, perform consensus configuration on the blockchain according to the existing consensus and cancel the voting event.

[0127] Furthermore, the consensus configuration module 703 is also used to, if the number of votes is greater than or equal to a preset proportion of the total number of nodes, and the application event is an event of applying to become a block-producing node, then the blockchain is consensus configured according to the event of applying to become a block-producing node; if the number of votes is greater than or equal to a preset proportion of the total number of nodes, and the application event is an event of applying to give up a block-producing node, and the number of block-producing nodes in the block-producing node list is greater than or equal to a preset value, then the blockchain is consensus configured according to the event of applying to give up a block-producing node, and the event of applying to give up a block-producing node is executed at most once in a single cycle; if the number of votes is greater than or equal to a preset proportion of the total number of nodes, and the application event is an event of applying to give up a block-producing node, and the number of block-producing nodes in the block-producing node list is less than a preset value, then the blockchain is consensus configured according to the existing consensus.

[0128] Other embodiments or specific implementations of the consensus configuration device of the present application can refer to the above-mentioned method embodiments and will not be repeated here.

[0129] The present application provides a consensus configuration device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the consensus configuration method in the above-mentioned embodiment one.

[0130] Reference below Figure 8 , which shows a schematic diagram of the structure of a consensus configuration device suitable for implementing the embodiments of the present application. The consensus configuration device in the embodiments of the present application may include, but is not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), in-vehicle terminals (such as in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 8 The consensus configuration device shown is merely an example and should not limit the functions and scope of use of the embodiments of the present application.

[0131] like Figure 8As shown, the consensus configuration device may include a processing device 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes based on programs stored in a read-only memory 1002 or programs loaded from a storage device 1003 into a random access memory 1004. Random access memory 1004 also stores various programs and data required for the operation of the consensus configuration device. The processing device 1001, the read-only memory 1002, and the random access memory 1004 are connected to each other via a bus 1005. An input / output interface 1006 is also connected to the bus. Typically, the following systems can be connected to the input / output interface 1006: an input device 1007 including, for example, a touch screen, touchpad, keyboard, mouse, image sensor, microphone, accelerometer, gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD), speaker, vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, hard disk, etc.; and a communication device 1009. Communication device 1009 can allow the consensus configuration device to communicate with other devices wirelessly or wired to exchange data. Although the figure shows a consensus configuration device with various systems, it should be understood that it is not required to implement or have all of the systems shown. More or fewer systems can be implemented or have alternatively.

[0132] In particular, according to the embodiments disclosed in the present application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, the embodiments disclosed in the present application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program comprising program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via a communication device, or installed from a storage device 1003, or installed from a read-only memory 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are performed.

[0133] The consensus configuration device provided in this application, employing the consensus configuration method described in the aforementioned embodiment, can address the technical issue of poor consensus security in blockchain consensus configuration in related technologies. Compared to related technologies, the consensus configuration device provided in this application achieves the same beneficial effects as the consensus configuration method described in the aforementioned embodiment. Other technical features of the consensus configuration device are the same as those disclosed in the aforementioned embodiment and are not further elaborated here.

[0134] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any one or more embodiments or examples in a suitable manner.

[0135] The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.

[0136] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer program) stored thereon, and the computer-readable program instructions are used to execute the consensus configuration method in the above-mentioned embodiment.

[0137] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems or devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer 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 thereof. In this embodiment, the computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.

[0138] The computer-readable storage medium may be included in the consensus configuration device; or it may exist independently without being assembled into the consensus configuration device.

[0139] The above-mentioned computer-readable storage medium carries one or more programs. When the above-mentioned one or more programs are executed by the consensus configuration device, the consensus configuration device can write computer program codes for performing the operations of the present application in one or more programming languages or a combination thereof. The above-mentioned programming languages include object-oriented programming languages, such as Java, Smalltalk, C++; and also include conventional procedural programming languages, such as "C" language or similar programming languages. The program code can be executed entirely on the user computer, partially on the user computer, as an independent software package, partially on the user computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer can be connected to the user computer through any type of network, such as a local area network (LAN) or a wide area network (WAN), or connected to an external computer (for example, connected through the Internet using an Internet service provider).

[0140] The flow charts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, program segment or a part of code, and the module, program segment or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented by a dedicated hardware-based system that performs the specified function or operation, or can be implemented by a combination of dedicated hardware and computer instructions.

[0141] The modules described in the embodiments of the present application may be implemented in software or hardware, wherein the name of a module does not necessarily limit the unit itself.

[0142] The computer-readable storage medium provided in this application stores computer-readable program instructions (i.e., a computer program) for executing the consensus configuration method described above. This computer-readable storage medium can address the technical issue of poor consensus security in blockchain consensus configuration in related technologies. Compared to related technologies, the beneficial effects of the computer-readable storage medium provided in this application are the same as those of the consensus configuration method provided in the above embodiments, and are not further elaborated here.

[0143] The present application also provides a computer program product, comprising a computer program, which implements the steps of the consensus configuration method as described above when executed by a processor.

[0144] The computer program product provided in this application can solve the technical problem of consensus configuration. Compared with the relevant technology, the beneficial effects of the computer program product provided in this application are the same as the beneficial effects of the consensus configuration method provided in the above embodiment, and will not be repeated here.

[0145] The above description is only part of the embodiments of the present application and does not limit the patent scope of the present application. All equivalent structural transformations made by using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect application in other related technical fields are included in the patent protection scope of the present application.

Claims

1. A consensus configuration method, characterized in that: The consensus configuration method includes the following steps: When an application event is received, a voting event is initiated to the block-producing node in the blockchain. The application event includes an application to become a block-producing node event and an application to give up a block-producing node event; Determine the number of votes corresponding to the target node involved in the application event according to the voting event; The blockchain is configured for consensus based on the number of votes and the total number of nodes, where the total number of nodes is the total number of block-producing nodes in the blockchain.

2. The consensus configuration method according to claim 1, characterized in that: The step of initiating a voting event to a block producing node in the blockchain upon receiving an application event includes: When receiving an application from any node other than a block-producing node in the blockchain to become a block-producing node, a voting event is initiated to the block-producing node; When receiving an event of requesting to give up the block producing node issued by the block producing node and / or any node on behalf of the block producing node, initiating a voting event to the block producing node; In the voting event, if a change is detected in the block producing node list, the voting rights of the block producing node are updated according to the changed block producing node list.

3. The consensus configuration method according to claim 1, wherein: The step of performing consensus configuration on the blockchain based on the number of votes and the total number of nodes includes: If the number of votes is greater than or equal to a preset proportion of the total number of nodes, the blockchain is configured for consensus according to the application event; If the number of votes is less than a preset proportion of the total number of nodes within a preset time period, the blockchain is configured according to the existing consensus and the voting event is canceled.

4. The consensus configuration method according to claim 3, characterized in that: If the number of votes is greater than or equal to a preset proportion of the total number of nodes, the step of performing consensus configuration on the blockchain according to the application event includes: If the number of votes is greater than or equal to a preset proportion of the total number of nodes, and the application event is an application to become a block producing node event, then consensus configuration of the blockchain is performed according to the application to become a block producing node event; If the number of votes is greater than or equal to a preset proportion of the total number of nodes, and the application event is an application to abandon the block-producing node event, and the number of block-producing nodes in the block-producing node list is greater than or equal to a preset value, then the blockchain is configured for consensus based on the application to abandon the block-producing node event. The application to abandon the block-producing node event is executed at most once in a single cycle; If the number of votes is greater than or equal to a preset proportion of the total number of nodes, and the application event is an application to give up the block-producing node event, and the number of block-producing nodes in the block-producing node list is less than a preset value, the blockchain is configured according to the existing consensus.

5. A node admission method, characterized in that: The node admission method comprises the following steps: When receiving a connection request from a target node to the blockchain network, obtaining the connection certificate and node information of the target node; Determine whether to allow the target node to access the blockchain network based on the connection certificate and the node information.

6. The node admission method according to claim 5, wherein: The step of determining whether to allow the target node to access the blockchain network based on the connection certificate and the node information includes: If the connection certificate matches the preset certificate, the node information is included in the security group contract, and there is no other node in the blockchain network that contains the connection certificate and the node information, then the target node is allowed to access the blockchain network; If the connection certificate does not match the preset certificate, or the node information is not included in the security combination contract, or there are other nodes in the blockchain network that contain the connection certificate and the node information, the target node is denied access to the blockchain network.

7. A consensus configuration device, characterized in that: The consensus configuration device includes: A voting initiation module is used to initiate a voting event to a block-producing node in the blockchain upon receiving an application event, including an application to become a block-producing node event and an application to give up a block-producing node event; A vote counting module, configured to determine the number of votes corresponding to the target node involved in the application event according to the voting event; A consensus configuration module is used to perform consensus configuration on the blockchain based on the number of votes and the total number of nodes, where the total number of nodes is the total number of block-producing nodes in the blockchain.

8. A consensus configuration device, characterized in that: The device includes: a memory, a processor, and a consensus configuration program stored in the memory and executable on the processor, wherein the consensus configuration program is configured to implement the steps of the consensus configuration method according to any one of claims 1 to 4.

9. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a consensus configuration program is stored on the storage medium. When the consensus configuration program is executed by a processor, the steps of the consensus configuration method according to any one of claims 1 to 4 are implemented.

10. A computer program product, characterized in that The computer program product includes a consensus configuration program, and when the consensus configuration program is executed by a processor, the steps of the consensus configuration method according to any one of claims 1 to 4 are implemented.