Method, device, equipment and medium for determining leader node based on electric power blockchain

By introducing reliability assessment and self-voting mechanisms into the power trading blockchain, the problem of high complexity in the leader node election in the RAFT consensus mechanism is solved, which improves election efficiency and avoids election failure.

CN113947491BActive Publication Date: 2025-03-14KUNMING POWER EXCHANGE CENT CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111334002.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-11
Publication Date
2025-03-14
Estimated Expiration
2041-11-11

AI Technical Summary

Technical Problem

In the existing power trading blockchain, the election process of leader nodes based on the RAFT consensus mechanism is highly complex, resulting in inefficient.

Method used

By introducing a reliability evaluation mechanism in the power trading blockchain, the reliability evaluation value is compared between nodes and vote by themselves. If the number of votes is the highest or the number of votes is the earliest, it will be determined as the leader node.

Benefits of technology

The election process of leader nodes has been simplified, the efficiency of leader node determination in the RAFT consensus mechanism has been improved, and election failures caused by high complexity have been avoided.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113947491B_ABST
    Figure CN113947491B_ABST
Patent Text Reader

Abstract

The present application relates to the field of blockchain technology, and provides a method for determining a leader node of an electric power trading blockchain based on a RAFT consensus mechanism, an information processing method, a device, an equipment, a medium and a product. The present application can improve the efficiency of determining a leader node in a RAFT consensus mechanism. The method includes: in response to the triggering of a leader election event, sending a voting request and the current reliability evaluation value of this node to other nodes, so that other nodes that receive the voting request compare their current reliability evaluation value with the current reliability evaluation value of this node, and when receiving the comparison result that the current reliability evaluation value of the node fed back by other nodes is lower than the current reliability evaluation value of this node, it is determined to vote for this node, and if this node belongs to the only node with the highest number of votes in this round of leader election or belongs to one of the nodes with the highest number of votes in this round of leader election and the number of votes is determined the earliest, then this node is determined as the leader node.
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 method for determining a leader node of an electric power trading blockchain based on a RAFT consensus mechanism, and an information processing method, device, computer equipment, storage medium and computer program product of an electric power trading blockchain based on a RAFT consensus mechanism. Background Art

[0002] As a new type of data sharing technology, blockchain has promoted the construction of energy Internet with its unique trust building mechanism, formed a decentralized interactive mode of energy flow, information flow and value flow, and realized point-to-point value transfer without the need for a third-party trust mechanism. At the same time, the smart contract function based on blockchain technology makes the execution of programs such as energy trading, demand response, and e-commerce more intelligent and automated. The consensus mechanism is the core of the blockchain, and its role is to verify the authenticity and consistency of data in a decentralized distributed network environment. The consensus mechanism ensures that all nodes make all transactions in a reliable manner without relying on central coordination.

[0003] Among them, the RAFT consensus mechanism is an algorithm that can achieve strong consistency in distributed systems and is very suitable for application scenarios where blockchain nodes change dynamically. However, in the RAFT consensus mechanism currently used by the power blockchain, all nodes need to participate in the process of selecting the leader node and count the number of votes. In the case of a large number of trading nodes in power transactions, the complexity of the leader node election process is greatly increased, resulting in the technical problem of low efficiency in the leader node determination process. Summary of the invention

[0004] Based on this, it is necessary to provide a leader node determination method for an electricity trading blockchain based on the RAFT consensus mechanism, an information processing method, device, computer equipment, storage medium and computer program product for an electricity trading blockchain based on the RAFT consensus mechanism to address the above-mentioned technical problems.

[0005] In a first aspect, the present application provides a method for determining a leader node of a power trading blockchain based on a RAFT consensus mechanism. The method comprises:

[0006] In response to the triggering of the leader election event, a voting request and the current reliability assessment value of the node are sent to other nodes in the power trading blockchain, so that the other nodes that receive the voting request can compare their current reliability assessment value with the current reliability assessment value of the node; wherein the reliability assessment value of each node in the power trading blockchain is calculated based on the historical cumulative value of successful transaction volume, node stability factor, historical cumulative value of error transaction volume and node penalty factor of each node; when the comparison result received from the other nodes that the current reliability assessment value of the node is lower than the current reliability assessment value of the node, it is determined to vote for the node; the number of votes for the node is determined; if the node is the only node with the highest number of votes in this round of leader election, or if the node is one of the nodes with the highest number of votes in this round of leader election and the number of votes is determined the earliest, the node is determined as the leader node of the power trading blockchain.

[0007] In one embodiment, before sending the voting request and the current reliability evaluation value of the node to other nodes of the power trading blockchain, the method further includes:

[0008] Obtain the historical cumulative value of successful transaction volume, node stability factor, historical cumulative value of erroneous transaction volume and node penalty factor of the node; calculate the positive integral part of reliability according to the product of the historical cumulative value of successful transaction volume and the node stability factor, and calculate the negative integral part of reliability according to the product of the historical cumulative value of erroneous transaction volume and the node penalty factor; calculate the current reliability assessment value of the node according to the positive integral part of reliability and the negative integral part of reliability.

[0009] In one of the embodiments, the node stability factor is determined based on the ratio of the normal transaction participation time of the node to the total transaction time of the power trading blockchain.

[0010] In one of the embodiments, the node penalty factor is determined according to a preset evaluation value interval in which the historical reliability evaluation value of the node is located.

[0011] In the second aspect, the present application also provides an information processing method for a power transaction blockchain based on a RAFT consensus mechanism. The method is applied to the auditor node of the power transaction blockchain, and includes:

[0012] The information related to the leader node in the power trading blockchain is obtained as the information to be reviewed; the power trading blockchain determines the leader node according to the method as described above; if the review result of the information to be reviewed is failure to review, the node related to the information to be reviewed in the power trading blockchain is determined as a malicious node and the reliability evaluation value of the malicious node is updated, and a new round of leader election event is triggered and the malicious node is withdrawn from the new round of leader election.

[0013] In a third aspect, the present application also provides a leader node determination device for a power trading blockchain based on a RAFT consensus mechanism. The device comprises:

[0014] A request sending module, configured to send a voting request and a current reliability evaluation value of the node to other nodes of the power trading blockchain in response to the triggering of a leader election event, so that other nodes receiving the voting request can compare their current reliability evaluation values ​​with the current reliability evaluation value of the node; wherein the reliability evaluation value of each node in the power trading blockchain is calculated based on the cumulative value of the historical successful transaction volume of each node, the node stability factor, the cumulative value of the historical error transaction volume and the node penalty factor;

[0015] A voting determination module, configured to determine to vote for the node when receiving a comparison result that the current reliability evaluation value of the other node is lower than the current reliability evaluation value of the node;

[0016] A vote number determination module, used to determine the number of votes obtained by the node;

[0017] The leadership node determination module is used to determine the node as the leader node of the power trading blockchain if the node is the only node with the highest number of votes in this round of leader election, or if the node is one of the nodes with the highest number of votes in this round of leader election and the time of determining the number of votes is the earliest.

[0018] In a fourth aspect, the present application also provides an information processing device for an electric power transaction blockchain based on a RAFT consensus mechanism. The device is applied to a reviewer node of an electric power transaction blockchain, and includes:

[0019] An information acquisition module, used to acquire information related to the leader node in the power transaction blockchain as information to be reviewed; the power transaction blockchain determines the leader node according to the method described above;

[0020] The post-audit processing module is used to determine the node related to the information to be audited in the power trading blockchain as a malicious node and update the reliability evaluation value of the malicious node if the audit result of the information to be audited is failure to pass the audit, and trigger a new round of leader election event and make the malicious node withdraw from the new round of leader election.

[0021] In a fifth aspect, the present application further provides a computer device. The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:

[0022] In response to the triggering of the leader election event, a voting request and the current reliability assessment value of the node are sent to other nodes in the power trading blockchain, so that the other nodes that receive the voting request can compare their current reliability assessment value with the current reliability assessment value of the node; wherein the reliability assessment value of each node in the power trading blockchain is calculated based on the historical cumulative value of successful transaction volume, node stability factor, historical cumulative value of error transaction volume and node penalty factor of each node; when the comparison result received from the other nodes that the current reliability assessment value of the node is lower than the current reliability assessment value of the node, it is determined to vote for the node; the number of votes for the node is determined; if the node is the only node with the highest number of votes in this round of leader election, or if the node is one of the nodes with the highest number of votes in this round of leader election and the number of votes is determined the earliest, the node is determined as the leader node of the power trading blockchain.

[0023] In a sixth aspect, the present application further provides a computer device. The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:

[0024] The information related to the leader node in the power trading blockchain is obtained as the information to be reviewed; the power trading blockchain determines the leader node according to the method as described above; if the review result of the information to be reviewed is failure to review, the node related to the information to be reviewed in the power trading blockchain is determined as a malicious node and the reliability evaluation value of the malicious node is updated, and a new round of leader election event is triggered and the malicious node is withdrawn from the new round of leader election.

[0025] In a seventh aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented:

[0026] In response to the triggering of the leader election event, a voting request and the current reliability assessment value of the node are sent to other nodes in the power trading blockchain, so that the other nodes that receive the voting request can compare their current reliability assessment value with the current reliability assessment value of the node; wherein the reliability assessment value of each node in the power trading blockchain is calculated based on the historical cumulative value of successful transaction volume, node stability factor, historical cumulative value of error transaction volume and node penalty factor of each node; when the comparison result received from the other nodes that the current reliability assessment value of the node is lower than the current reliability assessment value of the node, it is determined to vote for the node; the number of votes for the node is determined; if the node is the only node with the highest number of votes in this round of leader election, or if the node is one of the nodes with the highest number of votes in this round of leader election and the number of votes is determined the earliest, the node is determined as the leader node of the power trading blockchain.

[0027] In an eighth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented:

[0028] The information related to the leader node in the power trading blockchain is obtained as the information to be reviewed; the power trading blockchain determines the leader node according to the method as described above; if the review result of the information to be reviewed is failure to review, the node related to the information to be reviewed in the power trading blockchain is determined as a malicious node and the reliability evaluation value of the malicious node is updated, and a new round of leader election event is triggered and the malicious node is withdrawn from the new round of leader election.

[0029] In a ninth aspect, the present application further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the following steps are implemented:

[0030] In response to the triggering of the leader election event, a voting request and the current reliability assessment value of the node are sent to other nodes in the power trading blockchain, so that the other nodes that receive the voting request can compare their current reliability assessment value with the current reliability assessment value of the node; wherein the reliability assessment value of each node in the power trading blockchain is calculated based on the historical cumulative value of successful transaction volume, node stability factor, historical cumulative value of error transaction volume and node penalty factor of each node; when the comparison result received from the other nodes that the current reliability assessment value of the node is lower than the current reliability assessment value of the node, it is determined to vote for the node; the number of votes for the node is determined; if the node is the only node with the highest number of votes in this round of leader election, or if the node is one of the nodes with the highest number of votes in this round of leader election and the number of votes is determined the earliest, the node is determined as the leader node of the power trading blockchain.

[0031] In a tenth aspect, the present application further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the following steps are implemented:

[0032] The information related to the leader node in the power trading blockchain is obtained as the information to be reviewed; the power trading blockchain determines the leader node according to the method as described above; if the review result of the information to be reviewed is failure to review, the node related to the information to be reviewed in the power trading blockchain is determined as a malicious node and the reliability evaluation value of the malicious node is updated, and a new round of leader election event is triggered and the malicious node is withdrawn from the new round of leader election.

[0033] The above-mentioned leader node determination method, information processing method, device, equipment, medium and product of the power trading blockchain based on the RAFT consensus mechanism, in response to the triggering of the leader election event, sends a voting request and the current reliability evaluation value of the node to other nodes of the power trading blockchain, so that other nodes that receive the voting request compare their current reliability evaluation value with the current reliability evaluation value of the node, which is calculated based on the historical cumulative value of successful transaction volume, node stability factor, historical cumulative value of error transaction volume and node penalty factor of each node. Then, when the comparison result of the current reliability evaluation value of the node is lower than the current reliability evaluation value of the node, it is determined to vote for the node, and then the number of votes for the node is determined. If the node is the only node with the highest number of votes in this round of leader election or the node is one of the nodes with the highest number of votes in this round of leader election and the number of votes is determined the earliest, the node is determined as the leader node of the power trading blockchain. This scheme reliably simplifies the leader node election process of the power trading block through reliability assessment, comparison and self-voting, improves the efficiency of determining the leader node in the RAFT consensus mechanism, and avoids the election failure of the leader node in traditional technology due to the significant increase in complexity. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] Figure 1 A flowchart of a method for determining a leader node of a power trading blockchain based on a RAFT consensus mechanism in one embodiment;

[0035] Figure 2 It is a flowchart of an information processing method of a power transaction blockchain based on a RAFT consensus mechanism in one embodiment;

[0036] Figure 3 It is a specific flow chart of an information processing method of a power trading blockchain based on a RAFT consensus mechanism in one embodiment;

[0037] Figure 4 A structural block diagram of a leader node determination device of a power transaction blockchain based on a RAFT consensus mechanism in one embodiment;

[0038] Figure 5 It is a structural block diagram of an information processing device of a power transaction blockchain based on a RAFT consensus mechanism in one embodiment;

[0039] Figure 6 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0040] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0041] The leader node determination method of the power transaction blockchain based on the RAFT consensus mechanism and the information processing method of the power transaction blockchain based on the RAFT consensus mechanism provided in the embodiment of the present application can be applied to the power transaction blockchain based on the RAFT consensus mechanism, and executed by the corresponding nodes in the power transaction blockchain. Computer devices such as terminals and servers can constitute nodes of the power transaction blockchain. Among them, the terminal can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, Internet of Things devices, and portable wearable devices, and the server can be implemented as an independent server or a server cluster composed of multiple servers.

[0042] The method provided in this application is described in detail below in conjunction with embodiments and corresponding drawings.

[0043] In one embodiment, Figure 1 As shown, a method for determining a leader node of a power trading blockchain based on a RAFT consensus mechanism is provided, comprising the following steps:

[0044] Step S101, in response to the triggering of the leader election event, sends a voting request and the current reliability assessment value of the node to other nodes of the power trading blockchain, so that other nodes that receive the voting request can compare their current reliability assessment value with the current reliability assessment value of the node.

[0045] Among them, for the triggering of the leader election event, specifically, in the power trading blockchain based on the RAFT consensus mechanism, if the follower node does not receive the heartbeat signal from the leader node within the set timeout period, the follower node may consider that some changes have occurred in the server cluster network at this time. Possible situations include the server crash of the leader node, network failure, the end of the term of the leader node and the new leader node has not yet been determined. At this time, the follower node can determine that the leader election event has been triggered. The follower node responds to the triggering of the leader election event, actively initiates a leader election, increases the current term (term), and can change the identity of this node to a candidate node. Then, this node can send voting requests and the current reliability assessment value of this node to other nodes in the power trading blockchain in parallel. Other nodes that receive the voting request compare their current reliability assessment value with the received current reliability assessment value of the aforementioned node.

[0046] The reliability evaluation value of each node in the power transaction blockchain is calculated based on the cumulative value of the historical successful transaction volume of each node, the node stability factor, the cumulative value of the historical error transaction volume, and the node penalty factor. Specifically, for the reliability evaluation value of each node, in one embodiment, before sending a voting request and the current reliability evaluation value of the node to other nodes in the power transaction blockchain in step S101, the reliability evaluation value can be calculated by the following steps, specifically including:

[0047] Obtain the historical cumulative value of successful transaction volume, node stability factor, historical cumulative value of error transaction volume and node penalty factor of this node; calculate the positive integral part of reliability according to the product of the cumulative value of historical successful transaction volume and the node stability factor, and calculate the negative integral part of reliability according to the product of the cumulative value of historical error transaction volume and the node penalty factor; calculate the current reliability assessment value of this node according to the positive integral part of reliability and the negative integral part of reliability.

[0048] In this embodiment, the reliability evaluation value of this node is calculated by two parts, one is the positive integral part of reliability, and the other is the negative integral part of reliability. The positive integral part of reliability is calculated based on the product of the cumulative value of the historical successful transaction volume of this node and the node stability factor, and the negative integral part of reliability is calculated based on the product of the cumulative value of the historical error transaction volume of this node and the node penalty factor. They can be expressed by the following formulas:

[0049] R i =αV s -βV w

[0050] Among them, R i represents the current reliability evaluation value of the i-th node in the power transaction blockchain, αV s Represents the positive integral of reliability, βV w Represents the negative integral of reliability, α and V s Represent the node stability factor and the cumulative value of historical successful transactions, β and V respectively w They represent the node penalty factor and the cumulative value of historical error transactions, respectively. The cumulative value of historical successful transactions is the cumulative historical transaction volume of successful transactions of the node, and the cumulative value of historical error transactions is the cumulative transaction volume involved in the node due to error information. The node stability factor is used to characterize the stability of the node, and the node penalty factor is used to characterize the corresponding penalty level when the node generates an error behavior. Using the above formula, each node in the power transaction blockchain can calculate its current reliability assessment value and use it for comparison between nodes.

[0051] Further, for the calculation of the reliability evaluation value as described above, in some embodiments, the node stability factor is determined according to the ratio of the normal transaction duration of the node to the total transaction duration of the power transaction blockchain. Specifically, in this embodiment, the node stability factor α can be expressed by the following formula:

[0052]

[0053] Among them, N i It represents the normal transaction duration of the node i (such as the number of days that the node i participates in the electricity market transaction in the blockchain and does not exit due to failures, etc.), and N represents the total transaction duration of the electricity transaction blockchain (such as the total number of days that the electricity transaction blockchain has participated in the electricity market transaction).

[0054] Further, for the calculation of the reliability evaluation value as described above, in some embodiments, the node penalty factor is determined according to the preset evaluation value interval in which the historical reliability evaluation value of the node is located. Specifically, in this embodiment, the node penalty factor β can be expressed in the form of a piecewise function based on the historical reliability evaluation value, that is, each preset evaluation value interval corresponds to a node penalty factor β, and when a node with a high historical reliability evaluation value generates an erroneous behavior, the corresponding penalty factor is also large. The historical reliability evaluation value can specifically be the previous reliability evaluation value of the node, which can be specifically expressed as:

[0055]

[0056] Among them, β1,…,β j For each preset evaluation value interval ([0,R1],…,[R j-1 ,R j ]) The corresponding node penalty factor is generally β1<…,<β j , R1<…,<R j is the boundary value of the corresponding evaluation value interval.

[0057] Step S102, when receiving a comparison result from other nodes that their current reliability evaluation values ​​are lower than the current reliability evaluation value of the current node, determining to vote for the current node;

[0058] In this step, this node can receive the reliability evaluation value comparison results fed back by other nodes. If the other node finds that the current reliability evaluation value of the aforementioned node (the node that sends the voting request) is higher than the current reliability evaluation value of the other node itself, the other node will feedback the comparison result to the aforementioned node, and the other node will withdraw from this round of leader node election and become a follower node. When this node receives the comparison result fed back by other nodes that its current reliability evaluation value is lower than the current reliability evaluation value of this node, it will vote for itself, thereby continuously accumulating votes.

[0059] Step S103, determining the number of votes of the node;

[0060] In this step, the node can determine its own number of votes after receiving the comparison results fed back by other nodes.

[0061] Step S104: If this node is the only node with the highest number of votes in this round of leader election, or if this node is one of the nodes with the highest number of votes in this round of leader election and the time of determining the number of votes is the earliest, then this node is determined as the leader node of the power trading blockchain.

[0062] In this step, the leader node of the power trading blockchain can be finally determined by the number of votes. If this node is the only node with the highest number of votes in this round of leader election, then this node will be determined as the leader node of the power trading blockchain; if there are multiple nodes with the highest number of votes in this round of leader election, if this node belongs to one of them and the number of votes is determined the earliest, then this node will be determined as the leader node of the power trading blockchain. Once the leader node in the power trading blockchain is determined, it will send confirmation information to other nodes, the leader node selection process ends, and other nodes will switch to follower status.

[0063] The above-mentioned method for determining the leader node of the power trading blockchain based on the RAFT consensus mechanism responds to the triggering of the leader election event, sends a voting request and the current reliability evaluation value of the node to other nodes of the power trading blockchain, so that other nodes that receive the voting request compare their current reliability evaluation value with the current reliability evaluation value of the node, which is calculated according to the historical successful transaction volume accumulation value, node stability factor, historical error transaction volume accumulation value and node penalty factor of each node, and then when receiving the comparison result that the current reliability evaluation value of the node is lower than the current reliability evaluation value of the node, it is determined to vote for the node, and then the number of votes of the node is determined. If the node belongs to the only node with the highest number of votes in this round of leader election or the node belongs to one of the nodes with the highest number of votes in this round of leader election and the number of votes is determined the earliest, the node is determined as the leader node of the power trading blockchain. The scheme reliably simplifies the leader node election process of the power trading block through reliability evaluation, comparison and self-voting, improves the efficiency of determining the leader node in the RAFT consensus mechanism, and can also avoid the election failure of the leader node in the traditional technology due to the significant increase in complexity.

[0064] In one embodiment, Figure 2 As shown, a method for processing information of a power transaction blockchain based on a RAFT consensus mechanism is provided, which can be applied to the auditor node of the power transaction blockchain as described above, and the method includes the following steps:

[0065] Step S201, obtaining information related to the leader node in the power transaction blockchain as information to be reviewed; the power transaction blockchain determines the leader node according to the method described above;

[0066] Step S202: If the audit result of the information to be audited is failure to pass the audit, the node related to the information to be audited in the power trading blockchain is determined as a malicious node and the reliability evaluation value of the malicious node is updated, and a new round of leader election event is triggered and the malicious node is withdrawn from the new round of leader election.

[0067] Specific, combined Figure 3This embodiment is explained. After the leader node in the power transaction blockchain is determined, the consensus work begins. Among them, when the power market transaction is completed, the transaction information can be entered first and reviewed by the reviewer node (the transaction information can correspond to the information related to the leader node), and the reviewer node sends it to the leader node after verification; among them, for the completed log information sent by the leader node to the follower node and the currently submitted new log information (these log information can correspond to the information related to the leader node), it is also necessary to be verified by the reviewer node according to the timestamp. If the information is consistent with the previous verified information of the same transaction, the reviewer node submits the new log entry to the audit node log directory. If the information is inconsistent, that is, the audit result is that the audit fails, the transaction process and results of the entry log need to be further verified and processed, and at the same time, the nodes in the power transaction blockchain related to the information to be audited, that is, The leader node is determined to be a malicious node, and the reliability of the malicious node is evaluated in the manner disclosed in the aforementioned embodiment, and a new round of leader election events is triggered, and the malicious node is withdrawn from the new round of leader election; wherein, the storage log content of the elected leader node also needs to be checked by the auditor node as information related to the leader node, and the auditor node checks according to the timestamp, term of office and transaction results. If there are inconsistent entries, that is, the audit result is failure to pass the audit, then the auditor node determines that the current leader node election is invalid, and determines the current leader node as a malicious node. At the same time, the reliability of the malicious node is evaluated in the manner disclosed in the aforementioned embodiment, and a new round of leader election events is triggered, and the malicious node is withdrawn from the new round of leader election.

[0068] The scheme of the above-mentioned embodiment adds an auditor node in the power trading blockchain to verify information such as information copied to the leader node and information copied from the leader node to the follower node, so as to prevent the influence of malicious nodes, thereby overcoming the defects of the original RAFT consensus mechanism that cannot adapt well to the consensus requirements of the existence of malicious nodes and lacks the prevention and processing of malicious nodes. It is conducive to giving full play to its advantages in participating in power trading, promoting the application of blockchain technology in power trading, and helping to deepen the reform of the power market.

[0069] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0070] Based on the same inventive concept, the embodiment of the present application also provides a leader node determination device for a power trading blockchain based on the RAFT consensus mechanism for implementing the above-mentioned method for determining a leader node of a power trading blockchain based on the RAFT consensus mechanism, and an information processing device for a power trading blockchain based on the RAFT consensus mechanism for implementing the above-mentioned method for processing information of a power trading blockchain based on the RAFT consensus mechanism. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above-mentioned method, so the specific limitations in the embodiments of one or more leader node determination devices for a power trading blockchain based on the RAFT consensus mechanism and information processing devices for a power trading blockchain based on the RAFT consensus mechanism provided below can be found in the above-mentioned limitations on the leader node determination method for a power trading blockchain based on the RAFT consensus mechanism and the information processing method for a power trading blockchain based on the RAFT consensus mechanism, which will not be repeated here.

[0071] In one embodiment, Figure 4 As shown, a leader node determination device for a power transaction blockchain based on a RAFT consensus mechanism is provided, and the device 400 may include:

[0072] The request sending module 401 is used to send a voting request and the current reliability evaluation value of the node to other nodes of the power trading blockchain in response to the triggering of the leader election event, so that other nodes that receive the voting request can compare their current reliability evaluation value with the current reliability evaluation value of the node; wherein the reliability evaluation value of each node in the power trading blockchain is calculated based on the historical successful transaction volume accumulation value, node stability factor, historical error transaction volume accumulation value and node penalty factor of each node;

[0073] The voting determination module 402 is configured to determine to vote for the node when receiving a comparison result that the current reliability evaluation value of the node fed back by the other node is lower than the current reliability evaluation value of the node;

[0074] The vote number determination module 403 is used to determine the vote number of the node;

[0075] The leader node determination module 404 is used to determine the node as the leader node of the power trading blockchain if the node is the only node with the highest number of votes in this round of leader election, or if the node is one of the nodes with the highest number of votes in this round of leader election and the time of determining the number of votes is the earliest.

[0076] In one embodiment, the device 400 may also include: an evaluation value calculation unit, which is used to obtain the historical successful transaction volume accumulation value, node stability factor, historical error transaction volume accumulation value and node penalty factor of the node; the reliability positive integral part is calculated according to the product of the historical successful transaction volume accumulation value and the node stability factor, and the reliability negative integral part is calculated according to the product of the historical error transaction volume accumulation value and the node penalty factor; the current reliability evaluation value of the node is calculated according to the reliability positive integral part and the reliability negative integral part.

[0077] In one embodiment, the node stability factor is determined based on the ratio of the normal transaction participation time of the node to the total transaction time of the power transaction blockchain.

[0078] In one embodiment, the node penalty factor is determined according to a preset evaluation value interval in which the historical reliability evaluation value of the node is located.

[0079] In one embodiment, Figure 5 As shown, an information processing device for a power transaction blockchain based on a RAFT consensus mechanism is provided, which can be applied to a reviewer node of a power transaction blockchain. The device 500 may include:

[0080] The information acquisition module 501 is used to acquire information related to the leader node in the power transaction blockchain as information to be reviewed; the power transaction blockchain determines the leader node according to the method described above;

[0081] The post-audit processing module 502 is used to determine the node related to the information to be audited in the power trading blockchain as a malicious node and update the reliability evaluation value of the malicious node if the audit result of the information to be audited is failure to pass the audit, and trigger a new round of leader election event and make the malicious node withdraw from the new round of leader election.

[0082] The above-mentioned leader node determination device of the power transaction blockchain based on the RAFT consensus mechanism and each module in the leader node determination device of the power transaction blockchain based on the RAFT consensus mechanism can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0083] In one embodiment, a computer device is provided. The computer device may be a terminal or a server. The internal structure diagram thereof may be as follows: Figure 6 As shown. The computer device includes a processor, a memory, and a communication interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with external devices in a wired or wireless manner, and the wireless method can be implemented through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a leader node determination method of an electric power trading blockchain based on a RAFT consensus mechanism and an information processing method of an electric power trading blockchain based on a RAFT consensus mechanism are implemented.

[0084] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0085] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:

[0086] In response to the triggering of the leader election event, a voting request and the current reliability assessment value of the node are sent to other nodes in the power trading blockchain, so that the other nodes that receive the voting request can compare their current reliability assessment value with the current reliability assessment value of the node; wherein the reliability assessment value of each node in the power trading blockchain is calculated based on the historical cumulative value of successful transaction volume, node stability factor, historical cumulative value of error transaction volume and node penalty factor of each node; when the comparison result received from the other nodes that the current reliability assessment value of the node is lower than the current reliability assessment value of the node, it is determined to vote for the node; the number of votes for the node is determined; if the node is the only node with the highest number of votes in this round of leader election, or if the node is one of the nodes with the highest number of votes in this round of leader election and the number of votes is determined the earliest, the node is determined as the leader node of the power trading blockchain.

[0087] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0088] Obtain the historical cumulative value of successful transaction volume, node stability factor, historical cumulative value of erroneous transaction volume and node penalty factor of the node; calculate the positive integral part of reliability according to the product of the historical cumulative value of successful transaction volume and the node stability factor, and calculate the negative integral part of reliability according to the product of the historical cumulative value of erroneous transaction volume and the node penalty factor; calculate the current reliability assessment value of the node according to the positive integral part of reliability and the negative integral part of reliability.

[0089] In one embodiment, the node stability factor is determined according to the ratio of the normal transaction duration of the node to the total transaction duration of the power transaction blockchain.

[0090] In one embodiment, the node penalty factor is determined according to a preset evaluation value interval in which the historical reliability evaluation value of the node is located.

[0091] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:

[0092] The information related to the leader node in the power trading blockchain is obtained as the information to be reviewed; the power trading blockchain determines the leader node according to the method as described above; if the review result of the information to be reviewed is failure to review, the node related to the information to be reviewed in the power trading blockchain is determined as a malicious node and the reliability evaluation value of the malicious node is updated, and a new round of leader election event is triggered and the malicious node is withdrawn from the new round of leader election.

[0093] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0094] In response to the triggering of the leader election event, a voting request and the current reliability assessment value of the node are sent to other nodes in the power trading blockchain, so that the other nodes that receive the voting request can compare their current reliability assessment value with the current reliability assessment value of the node; wherein the reliability assessment value of each node in the power trading blockchain is calculated based on the historical cumulative value of successful transaction volume, node stability factor, historical cumulative value of error transaction volume and node penalty factor of each node; when the comparison result received from the other nodes that the current reliability assessment value of the node is lower than the current reliability assessment value of the node, it is determined to vote for the node; the number of votes for the node is determined; if the node is the only node with the highest number of votes in this round of leader election, or if the node is one of the nodes with the highest number of votes in this round of leader election and the number of votes is determined the earliest, the node is determined as the leader node of the power trading blockchain.

[0095] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0096] Obtain the historical cumulative value of successful transaction volume, node stability factor, historical cumulative value of erroneous transaction volume and node penalty factor of the node; calculate the positive integral part of reliability according to the product of the historical cumulative value of successful transaction volume and the node stability factor, and calculate the negative integral part of reliability according to the product of the historical cumulative value of erroneous transaction volume and the node penalty factor; calculate the current reliability assessment value of the node according to the positive integral part of reliability and the negative integral part of reliability.

[0097] In one embodiment, the node stability factor is determined based on the ratio of the normal transaction participation time of the node to the total transaction time of the power transaction blockchain.

[0098] In one embodiment, the node penalty factor is determined according to a preset evaluation value interval in which the historical reliability evaluation value of the node is located.

[0099] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0100] The information related to the leader node in the power trading blockchain is obtained as the information to be reviewed; the power trading blockchain determines the leader node according to the method as described above; if the review result of the information to be reviewed is failure to review, the node related to the information to be reviewed in the power trading blockchain is determined as a malicious node and the reliability evaluation value of the malicious node is updated, and a new round of leader election event is triggered and the malicious node is withdrawn from the new round of leader election.

[0101] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:

[0102] In response to the triggering of the leader election event, a voting request and the current reliability assessment value of the node are sent to other nodes in the power trading blockchain, so that the other nodes that receive the voting request can compare their current reliability assessment value with the current reliability assessment value of the node; wherein the reliability assessment value of each node in the power trading blockchain is calculated based on the historical cumulative value of successful transaction volume, node stability factor, historical cumulative value of error transaction volume and node penalty factor of each node; when the comparison result received from the other nodes that the current reliability assessment value of the node is lower than the current reliability assessment value of the node, it is determined to vote for the node; the number of votes for the node is determined; if the node is the only node with the highest number of votes in this round of leader election, or if the node is one of the nodes with the highest number of votes in this round of leader election and the number of votes is determined the earliest, the node is determined as the leader node of the power trading blockchain.

[0103] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0104] Obtain the historical cumulative value of successful transaction volume, node stability factor, historical cumulative value of erroneous transaction volume and node penalty factor of the node; calculate the positive integral part of reliability according to the product of the historical cumulative value of successful transaction volume and the node stability factor, and calculate the negative integral part of reliability according to the product of the historical cumulative value of erroneous transaction volume and the node penalty factor; calculate the current reliability assessment value of the node according to the positive integral part of reliability and the negative integral part of reliability.

[0105] In one embodiment, the node stability factor is determined based on the ratio of the normal transaction participation time of the node to the total transaction time of the power transaction blockchain.

[0106] In one embodiment, the node penalty factor is determined according to a preset evaluation value interval in which the historical reliability evaluation value of the node is located.

[0107] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:

[0108] The information related to the leader node in the power trading blockchain is obtained as the information to be reviewed; the power trading blockchain determines the leader node according to the method as described above; if the review result of the information to be reviewed is failure to review, the node related to the information to be reviewed in the power trading blockchain is determined as a malicious node and the reliability evaluation value of the malicious node is updated, and a new round of leader election event is triggered and the malicious node is withdrawn from the new round of leader election.

[0109] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0110] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.

[0111] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0112] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A method for determining the leader node of a power trading blockchain based on the RAFT consensus mechanism, characterized in that: The method comprises: In response to the triggering of the leader election event, a voting request and the current reliability evaluation value of the node are sent to other nodes in the power trading blockchain, so that other nodes that receive the voting request compare their current reliability evaluation values ​​with the current reliability evaluation value of the node; wherein the reliability evaluation value of each node in the power trading blockchain is calculated based on the historical successful transaction volume accumulation value, node stability factor, historical error transaction volume accumulation value and node penalty factor of each node; When receiving a comparison result that the current reliability evaluation value of the other node is lower than the current reliability evaluation value of the current node, determining to vote for the current node; Determine the number of votes of the node; If the node is the only node with the highest number of votes in this round of leader election, or if the node is one of the nodes with the highest number of votes in this round of leader election and the number of votes is determined earliest, then the node is determined as the leader node of the power trading blockchain; Before sending the voting request and the current reliability evaluation value of the node to other nodes of the power transaction blockchain, the method further includes: Obtain the historical successful transaction volume accumulation value, node stability factor, historical error transaction volume accumulation value and node penalty factor of the node; The reliability positive integral part is calculated according to the product of the cumulative value of the historical successful transaction volume and the node stability factor, and the reliability negative integral part is calculated according to the product of the cumulative value of the historical error transaction volume and the node penalty factor; the node stability factor is determined according to the ratio of the normal transaction time of the node to the total transaction time of the power transaction blockchain; The current reliability evaluation value of the node is calculated based on the reliability positive integral part and the reliability negative integral part.

2. The method according to claim 1, characterized in that: The node penalty factor is determined according to a preset evaluation value interval in which the historical reliability evaluation value of the node is located.

3. An information processing method for power trading blockchain based on RAFT consensus mechanism, characterized in that: The method is applied to the auditor node of the power transaction blockchain, and comprises: Acquire information related to the leader node in the power transaction blockchain as information to be reviewed; the power transaction blockchain determines the leader node according to the method described in any one of claims 1 to 2; If the audit result of the information to be audited is failure, the node related to the information to be audited in the power trading blockchain is determined as a malicious node and the reliability evaluation value of the malicious node is updated, and a new round of leader election event is triggered and the malicious node is withdrawn from the new round of leader election.

4. A leader node determination device for a power trading blockchain based on a RAFT consensus mechanism, characterized in that: The device comprises: A request sending module, configured to send a voting request and a current reliability evaluation value of the node to other nodes of the power trading blockchain in response to the triggering of a leader election event, so that other nodes receiving the voting request can compare their current reliability evaluation values ​​with the current reliability evaluation value of the node; wherein the reliability evaluation value of each node in the power trading blockchain is calculated based on the cumulative value of the historical successful transaction volume of each node, the node stability factor, the cumulative value of the historical error transaction volume and the node penalty factor; A voting determination module, configured to determine to vote for the node when receiving a comparison result that the current reliability evaluation value of the other node is lower than the current reliability evaluation value of the node; A vote number determination module, used to determine the number of votes obtained by the node; A leader node determination module, configured to determine the node as the leader node of the power trading blockchain if the node is the only node with the highest number of votes in the current round of leader election, or if the node is one of the nodes with the highest number of votes in the current round of leader election and the number of votes is determined earliest; An evaluation value calculation unit is used to obtain the historical cumulative value of successful transaction volume, node stability factor, historical cumulative value of erroneous transaction volume and node penalty factor of the node; the positive reliability integral part is calculated according to the product of the historical cumulative value of successful transaction volume and the node stability factor, and the negative reliability integral part is calculated according to the product of the historical cumulative value of erroneous transaction volume and the node penalty factor; the current reliability evaluation value of the node is calculated according to the positive reliability integral part and the negative reliability integral part; the node stability factor is determined according to the ratio of the normal transaction participation time of the node to the total transaction time of the power transaction blockchain.

5. An information processing device for power trading blockchain based on RAFT consensus mechanism, characterized in that: An auditor node applied to a power transaction blockchain, the device comprising: An information acquisition module, used to acquire information related to the leader node in the power transaction blockchain as information to be reviewed; the power transaction blockchain determines the leader node according to the method described in any one of claims 1 to 2; The post-audit processing module is used to determine the node related to the information to be audited in the power trading blockchain as a malicious node and update the reliability evaluation value of the malicious node if the audit result of the information to be audited is failure to pass the audit, and trigger a new round of leader election event and make the malicious node withdraw from the new round of leader election.

6. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 3 are implemented.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 3 are implemented.

8. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 3 are implemented.

Citation Information

Patent Citations

  • A block chain consensus method and device based on a Raft algorithm

    CN109714404A

  • Block chain consensus method and device, electronic equipment and storage medium

    CN112822239A