CN113947491A - Leader node determination method, device, equipment and medium based on power block chain - Google Patents

Leader node determination method, device, equipment and medium based on power block chain Download PDF

Info

Publication number
CN113947491A
CN113947491A CN202111334002.0A CN202111334002A CN113947491A CN 113947491 A CN113947491 A CN 113947491A CN 202111334002 A CN202111334002 A CN 202111334002A CN 113947491 A CN113947491 A CN 113947491A
Authority
CN
China
Prior art keywords
node
block chain
leader
evaluation value
reliability evaluation
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111334002.0A
Other languages
Chinese (zh)
Inventor
陈然
张加贝
邹贤
陈清贵
孙恒一
赵伟华
王睿琛
吴滇宁
王帮灿
邢玉辉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Kunming Electric Power Transaction Center Co ltd
Original Assignee
Kunming Electric Power Transaction Center Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Kunming Electric Power Transaction Center Co ltd filed Critical Kunming Electric Power Transaction Center Co ltd
Priority to CN202111334002.0A priority Critical patent/CN113947491A/en
Publication of CN113947491A publication Critical patent/CN113947491A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q50/00Information and communication technology [ICT] specially adapted for implementation of business processes of specific business sectors, e.g. utilities or tourism
    • G06Q50/06Energy or water supply

Landscapes

  • Business, Economics & Management (AREA)
  • Engineering & Computer Science (AREA)
  • Economics (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Finance (AREA)
  • Accounting & Taxation (AREA)
  • Health & Medical Sciences (AREA)
  • Marketing (AREA)
  • General Physics & Mathematics (AREA)
  • Strategic Management (AREA)
  • General Business, Economics & Management (AREA)
  • Public Health (AREA)
  • Tourism & Hospitality (AREA)
  • Primary Health Care (AREA)
  • Human Resources & Organizations (AREA)
  • General Health & Medical Sciences (AREA)
  • Water Supply & Treatment (AREA)
  • Development Economics (AREA)
  • Technology Law (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The application relates to the technical field of block chains, and provides a leader node determination method, an information processing device, equipment, a medium and a product of a power transaction block chain based on a RAFT consensus mechanism. The method and the device can improve the efficiency of determining the leader node in the RAFT consensus mechanism. The method comprises the following steps: responding to the trigger of a leader election event, sending a voting request and a current reliability evaluation value of the node to other nodes, comparing the current reliability evaluation value with the current reliability evaluation value of the node by the other nodes receiving the voting request, determining the node to vote when the current reliability evaluation value fed back by the other nodes is lower than the comparison result of the current reliability evaluation value of the node, and determining the node to be the leader node if the node belongs to the only node with the highest vote number in the current leader election or one of the nodes with the highest vote number in the current leader election and the determination time of the vote number is the earliest.

Description

Leader node determination method, device, equipment and medium based on power block chain
Technical Field
The present application relates to the field of block chain technologies, and in particular, to a leader node determining method for an electric power transaction block chain based on a RAFT consensus mechanism, an information processing method for an electric power transaction block chain based on a RAFT consensus mechanism, an apparatus, a computer device, a storage medium, and a computer program product.
Background
The block chain is used as a novel data sharing technology, the construction of an energy internet is promoted by means of a unique trust establishment mechanism, a decentralized interaction mode of energy source flow, information flow and value flow is formed, and point-to-point value transfer without a third-party trust mechanism is achieved. Meanwhile, the intelligent contract function based on the blockchain technology enables program execution of energy trading, demand response, electronic commerce and the like to be more intelligent and automatic. The consensus mechanism is the core of the blockchain and functions to verify the authenticity and consistency of data in an decentralized, distributed network environment. The consensus mechanism ensures that all nodes make all transactions proceed in a reliable manner without relying on central coordination.
The RAFT consensus mechanism is an algorithm capable of realizing strong consistency of a distributed system, and is very suitable for application scenarios of dynamic changes of block chain nodes. However, in the RAFT consensus mechanism adopted by the existing power block chain, all nodes are required to participate and the voting number is counted in the process of selecting leader nodes, and the complexity of the leader node election process is greatly improved under the condition that a large number of transaction nodes exist in power transaction, so that the technical problem that the efficiency of the leader node determination process is low exists in the technology.
Disclosure of Invention
In view of the above, it is necessary to provide a method for determining a leader node of a power trading block chain based on a RAFT consensus mechanism, a method for processing information of a power trading block chain based on a RAFT consensus mechanism, an apparatus, a computer device, a storage medium, and a computer program product for solving the above technical problems.
In a first aspect, the application provides a leader node determination method for a power transaction block chain based on a RAFT consensus mechanism. The method comprises the following steps:
responding to triggering of a leader election event, sending a voting request and a current reliability evaluation value of a node to other nodes of a power transaction block chain, so that the other nodes receiving the voting request can compare the current reliability evaluation value with the current reliability evaluation value of the node; the reliability evaluation value of each node in the power transaction block chain is obtained by calculation according to the historical successful transaction quantity accumulated value, the node stability factor, the historical error transaction quantity accumulated value and the node penalty factor of each node; when a comparison result that the current reliability evaluation value fed back by the other nodes is lower than the current reliability evaluation value of the node is received, voting is determined for the node; determining the number of votes obtained by the node; and if the node belongs to the only node with the highest ticket number in the current round of leader election, or the node belongs to one of the nodes with the highest ticket number in the current round of leader election and the ticket number determining time is the earliest, determining the node as the leader node of the power transaction block chain.
In one embodiment, before sending the voting request and the current reliability assessment value of the node to other nodes of the power transaction block chain, the method further includes:
acquiring a historical successful transaction quantity accumulated value, a node stability factor, a historical error transaction quantity accumulated value and a node penalty factor of the node; a reliability positive integration part is obtained by calculating according to the product of the historical successful transaction quantity accumulated value and the node stability factor, and a reliability negative integration part is obtained by calculating according to the product of the historical error transaction quantity accumulated value and the node penalty factor; and calculating to obtain the current reliability evaluation value of the node according to the reliability positive integration part and the reliability negative integration part.
In one embodiment, the node stability factor is determined according to the ratio of the normal participation trade time of the node to the total trade time of the power trade block chain.
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.
In a second aspect, the application further provides an information processing method of the power transaction block chain based on the RAFT consensus mechanism. The method is applied to the auditor node of the power transaction block chain, and comprises the following steps:
acquiring information related to a leader node in the power transaction block chain as to-be-audited information; the power transaction blockchain determines leader nodes according to the method; and if the audit result of the information to be audited is that the audit is not passed, determining the node related to the information to be audited in the electric power transaction block chain as a malicious node, updating the reliability evaluation value of the malicious node, triggering a new round of leader election event and enabling the malicious node to quit the new round of leader election.
In a third aspect, the application further provides a leader node determining device of the power transaction block chain based on the RAFT consensus mechanism. The device comprises:
the request sending module is used for responding to triggering of a leader election event, sending a voting request and a current reliability evaluation value of the node to other nodes of the power transaction block chain, so that the other nodes receiving the voting request can compare the current reliability evaluation value with the current reliability evaluation value of the node; the reliability evaluation value of each node in the power transaction block chain is obtained by calculation according to the historical successful transaction quantity accumulated value, the node stability factor, the historical error transaction quantity accumulated value and the node penalty factor of each node;
the voting determination module is used for determining to vote for the node when the current reliability evaluation value fed back by the other nodes is lower than the comparison result of the current reliability evaluation value of the node;
the system comprises a ticket number determining module, a ticket obtaining module and a ticket obtaining module, wherein the ticket number determining module is used for determining the ticket number of the node;
and the leader node determining module is used for determining the node as the leader node of the electric power transaction block chain if the node belongs to the only node with the highest ticket number in the current round of leader election, or the node belongs to one of the nodes with the highest ticket number in the current round of leader election and the determination time of the ticket number is the earliest.
In a fourth aspect, the application further provides an information processing apparatus for a power transaction block chain based on a RAFT consensus mechanism. The device is applied to the reviewer node of the power transaction block chain, and comprises:
the information acquisition module is used for acquiring information related to the leader node in the electric power transaction block chain as to-be-audited information; the power transaction blockchain determines leader nodes according to the method;
and the post-audit processing module is used for determining a node related to the information to be audited in the electric power transaction block chain as a malicious node and updating the reliability evaluation value of the malicious node if the audit result of the information to be audited is that the audit is not passed, and triggering a new round of leader election event and enabling the malicious node to quit the new round of leader election.
In a fifth aspect, the present application further provides a computer device. The computer device comprises a memory storing a computer program and a processor implementing the following steps when executing the computer program:
responding to triggering of a leader election event, sending a voting request and a current reliability evaluation value of a node to other nodes of a power transaction block chain, so that the other nodes receiving the voting request can compare the current reliability evaluation value with the current reliability evaluation value of the node; the reliability evaluation value of each node in the power transaction block chain is obtained by calculation according to the historical successful transaction quantity accumulated value, the node stability factor, the historical error transaction quantity accumulated value and the node penalty factor of each node; when a comparison result that the current reliability evaluation value fed back by the other nodes is lower than the current reliability evaluation value of the node is received, voting is determined for the node; determining the number of votes obtained by the node; and if the node belongs to the only node with the highest ticket number in the current round of leader election, or the node belongs to one of the nodes with the highest ticket number in the current round of leader election and the ticket number determining time is the earliest, determining the node as the leader node of the power transaction block chain.
In a sixth aspect, the present application further provides a computer device. The computer device comprises a memory storing a computer program and a processor implementing the following steps when executing the computer program:
acquiring information related to a leader node in the power transaction block chain as to-be-audited information; the power transaction blockchain determines leader nodes according to the method; and if the audit result of the information to be audited is that the audit is not passed, determining the node related to the information to be audited in the electric power transaction block chain as a malicious node, updating the reliability evaluation value of the malicious node, triggering a new round of leader election event and enabling the malicious node to quit the new round of leader election.
In a seventh aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of:
responding to triggering of a leader election event, sending a voting request and a current reliability evaluation value of a node to other nodes of a power transaction block chain, so that the other nodes receiving the voting request can compare the current reliability evaluation value with the current reliability evaluation value of the node; the reliability evaluation value of each node in the power transaction block chain is obtained by calculation according to the historical successful transaction quantity accumulated value, the node stability factor, the historical error transaction quantity accumulated value and the node penalty factor of each node; when a comparison result that the current reliability evaluation value fed back by the other nodes is lower than the current reliability evaluation value of the node is received, voting is determined for the node; determining the number of votes obtained by the node; and if the node belongs to the only node with the highest ticket number in the current round of leader election, or the node belongs to one of the nodes with the highest ticket number in the current round of leader election and the ticket number determining time is the earliest, determining the node as the leader node of the power transaction block chain.
In an eighth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of:
acquiring information related to a leader node in the power transaction block chain as to-be-audited information; the power transaction blockchain determines leader nodes according to the method; and if the audit result of the information to be audited is that the audit is not passed, determining the node related to the information to be audited in the electric power transaction block chain as a malicious node, updating the reliability evaluation value of the malicious node, triggering a new round of leader election event and enabling the malicious node to quit the new round of leader election.
In a ninth aspect, the present application further provides a computer program product. The computer program product comprising a computer program which when executed by a processor performs the steps of:
responding to triggering of a leader election event, sending a voting request and a current reliability evaluation value of a node to other nodes of a power transaction block chain, so that the other nodes receiving the voting request can compare the current reliability evaluation value with the current reliability evaluation value of the node; the reliability evaluation value of each node in the power transaction block chain is obtained by calculation according to the historical successful transaction quantity accumulated value, the node stability factor, the historical error transaction quantity accumulated value and the node penalty factor of each node; when a comparison result that the current reliability evaluation value fed back by the other nodes is lower than the current reliability evaluation value of the node is received, voting is determined for the node; determining the number of votes obtained by the node; and if the node belongs to the only node with the highest ticket number in the current round of leader election, or the node belongs to one of the nodes with the highest ticket number in the current round of leader election and the ticket number determining time is the earliest, determining the node as the leader node of the power transaction block chain.
In a tenth aspect, the present application further provides a computer program product. The computer program product comprising a computer program which when executed by a processor performs the steps of:
acquiring information related to a leader node in the power transaction block chain as to-be-audited information; the power transaction blockchain determines leader nodes according to the method; and if the audit result of the information to be audited is that the audit is not passed, determining the node related to the information to be audited in the electric power transaction block chain as a malicious node, updating the reliability evaluation value of the malicious node, triggering a new round of leader election event and enabling the malicious node to quit the new round of leader election.
The leader node determining method, the information processing method, the device, the equipment, the medium and the product of the power transaction block chain based on the RAFT consensus mechanism respond to the triggering of a leader election event, send voting requests and the current reliability assessment value of the node to other nodes of the power transaction block chain, so that other nodes receiving the voting requests can compare the current reliability assessment value with the current reliability assessment value of the node, the reliability assessment value is obtained by calculation according to the historical successful transaction quantity accumulated value, the node stability factor, the historical error transaction quantity accumulated value and the node penalty factor of each node, when the current reliability assessment value fed back by other nodes is lower than the comparison result of the current reliability assessment value of the node, the node is determined to vote, and then the number of votes of the node is determined, and if the node belongs to the only node with the highest ticket number in the current round of leader election or the node belongs to one of the nodes with the highest ticket number in the current round of leader election and the ticket number determining time is the earliest, determining the node as the leader node of the power transaction block chain. According to the scheme, the election process of the leader node of the power transaction block is reliably simplified through reliability evaluation, comparison and self-voting, the efficiency of determining the leader node in the RAFT consensus mechanism is improved, and the failure of election caused by the fact that the complexity of the leader node is greatly improved in the traditional technology can be avoided.
Drawings
Fig. 1 is a schematic flowchart of a leader node determination method of a power transaction block chain based on a RAFT consensus mechanism in an embodiment;
fig. 2 is a flowchart illustrating an information processing method of a power transaction block chain based on a RAFT consensus mechanism in an embodiment;
fig. 3 is a specific flowchart of an information processing method of a power transaction block chain based on a RAFT consensus mechanism in an embodiment;
fig. 4 is a block diagram illustrating a leading person node determination device of a power transaction block chain based on a RAFT consensus mechanism in one embodiment;
FIG. 5 is a block diagram of an information processing apparatus of a power transaction block chain based on a RAFT consensus mechanism in an embodiment;
FIG. 6 is a diagram illustrating an internal structure of a computer device according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The leader node determining method of the power transaction block chain based on the RAFT consensus mechanism and the information processing method of the power transaction block chain based on the RAFT consensus mechanism, which are provided by the embodiment of the application, can be applied to the power transaction block chain based on the RAFT consensus mechanism, and are executed by corresponding nodes in the power transaction block chain, and computer devices such as a terminal and a server can form nodes of the power transaction block chain. The terminal can be but not limited to various personal computers, notebook computers, smart phones, tablet computers, internet of things devices and portable wearable devices, and the server can be realized by an independent server or a server cluster formed by a plurality of servers.
The method provided by the application is specifically described below with reference to the embodiments and the accompanying drawings.
In one embodiment, as shown in fig. 1, there is provided a method for determining a leader node of a power transaction block chain based on a RAFT consensus mechanism, including the following steps:
step S101, responding to the trigger of the leader election event, sending a voting request and the current reliability evaluation value of the node to other nodes of the power transaction block chain, so that the other nodes receiving the voting request can compare the current reliability evaluation value with the current reliability evaluation value of the node.
Specifically, in the power transaction block chain based on the RAFT consensus mechanism, if the follower node does not receive a heartbeat signal from the leader node within a set timeout period, the follower node may consider that a server cluster network at this time has a certain change, and possible situations include a server downtime of the leader node, a network failure, an end of the leader node due to the expiration of the lead node and no determination of a new leader node, at this time, the follower node may determine that the leader election event has been triggered, the follower node responds to the trigger of the leader election event, actively initiates the leader election, increases the current due period (term) and may change the identity of the follower node into a candidate node, and then the follower node may send a voting request and a current reliability evaluation value of the follower node to other nodes of the power transaction block chain in parallel, the other nodes receiving the voting request compare the current reliability evaluation value with the current reliability evaluation value of the node.
The reliability evaluation value of each node in the power transaction block chain is calculated according to the historical successful transaction quantity accumulated value, the node stability factor, the historical error transaction quantity accumulated value and the node penalty factor of each node. Specifically, for each node reliability evaluation value, in one embodiment, before sending the voting request and the current reliability evaluation value of the node to other nodes of the power transaction block chain in step S101, the reliability evaluation value may be calculated by the following steps, specifically including:
acquiring a historical successful transaction quantity accumulated value, a node stability factor, a historical error transaction quantity accumulated value and a node penalty factor of the node; a reliability positive integration part is obtained by calculating according to the product of the accumulated value of the historical successful transaction amount and the node stability factor, and a reliability negative integration part is obtained by calculating according to the product of the accumulated value of the historical error transaction amount and the node penalty factor; and calculating to obtain the current reliability evaluation value of the node according to the reliability positive integration part and the reliability negative integration part.
In this embodiment, the reliability evaluation value of the node is calculated by two parts, one part is a reliability positive integration part, the other part is a reliability negative integration part, the reliability positive integration part is calculated according to a product of the historical successful transaction amount cumulative value of the node and the node stability factor, and the reliability negative integration part is calculated according to a product of the historical wrong transaction amount cumulative value of the node and the node penalty factor. Can be expressed by the following formulas, respectively:
Ri=αVs-βVw
wherein R isiRepresenting the current reliability assessment, α V, of the ith node in the power transaction blockchainsRepresents a positive integral of reliability, betaVwRepresenting the negative integral of reliability, alpha and VsRespectively representing the node stability factor and the accumulated value of the historical successful transaction amount,beta and VwAnd respectively representing a node penalty factor and a historical error transaction amount accumulated value, wherein the historical successful transaction amount accumulated value is the historical transaction amount of successful transaction accumulated by the node, the historical error transaction amount accumulated value is the accumulated transaction amount related to the node due to error information, the node stability factor is used for representing the stability degree of the node, and the node penalty factor is used for representing the corresponding penalty degree when the node generates error behavior. Each node in the power trading block chain can calculate its own current reliability assessment value and use it for comparison between nodes.
Further, for the calculation of the reliability assessment value as described above, in some embodiments, the node stability factor is determined according to the ratio of the normal participation trade time of the node to the total trade time of the power trade block chain. Specifically, in this embodiment, the node stability factor α can be expressed by the following formula:
Figure BDA0003349850430000081
wherein N isiIndicating the normal transaction duration of the node i (e.g., the number of days that the node i participates in the power market transaction in the blockchain and has no exit phenomenon due to a fault, etc.), and N indicating the total transaction duration of the power transaction blockchain (e.g., the total number of days that the power transaction blockchain has participated in the power market transaction).
Further, for the calculation of the reliability assessment value as described above, in some embodiments, the node penalty factor is determined according to a preset assessment value interval in which the historical reliability assessment value of the node is located. Specifically, in this embodiment, the node penalty factor β may be represented in a form of a piecewise function based on a historical reliability assessment value, that is, each preset assessment value interval corresponds to one node penalty factor β, and when a node with a high historical reliability assessment value generates an error behavior, the corresponding penalty factor is also larger, where the historical reliability assessment value may be a last reliability assessment value of the node, and may be specifically represented as:
Figure BDA0003349850430000091
wherein, beta1,…,βjFor each preset evaluation value interval ([0, R)1],…,[Rj-1,Rj]) Corresponding node penalty factors, typically β1<…,<βj,R1<…,<RjIs the corresponding evaluation value interval boundary value.
Step S102, when a 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 the node is received, voting is determined for the node;
in this step, the local node may receive a comparison result of the reliability evaluation values fed back by other nodes, if the other nodes compare and find that the current reliability evaluation value of the local node (the node sending the voting request) is higher than the current reliability evaluation value of the other nodes, the other nodes feed back the comparison result to the local node, the other nodes will quit the leader node election and become follower nodes, and the local node, when receiving the comparison result that the current reliability evaluation value of the local node fed back by the other nodes is lower than the current reliability evaluation value of the local node, will vote for itself, thereby accumulating the votes.
Step S103, determining the number of votes obtained by the node;
in this step, after receiving the comparison result fed back by each other node, the node can determine its own number of votes.
And step S104, if the node belongs to the only node with the highest ticket number in the current round of leader election, or the node belongs to one of the nodes with the highest ticket number in the current round of leader election and the ticket number determining time is the earliest, determining the node as the leader node of the power transaction block chain.
In this step, finally, the leader node of the electric power transaction block chain can be determined through the number of votes obtained. If the node is the only node with the highest ticket number in the current round of leader election, determining the node as the leader node of the power transaction block chain; and under the condition that the number of the nodes with the highest ticket number in the current round of leader election comprises a plurality of nodes, if the node belongs to one of the nodes and the ticket number determining time is the earliest, determining the node as the leader node of the power transaction block chain. Once the leader node in the power transaction block chain is determined, confirmation information is sent to other nodes, the leader node selection process is finished, and other nodes can be switched to follower states.
The leader node determining method of the power transaction block chain based on the RAFT common identification mechanism responds to triggering of a leader election event, a voting request and a current reliability evaluation value of a local node are sent to other nodes of the power transaction block chain, so that other nodes receiving the voting request compare the current reliability evaluation value with the current reliability evaluation value of the local node, the reliability evaluation value is obtained through calculation according to a historical successful transaction quantity accumulated value, a node stability factor, a historical error transaction quantity accumulated value and a node penalty factor of each node, when the current reliability evaluation value fed back by the other nodes is lower than a comparison result of the current reliability evaluation value of the local node, the local node votes, and if the local node belongs to a unique node with the highest votes in local leader election or belongs to one of the nodes with the highest votes in local leader election, the votes are determined to vote of the local node And determining the node as the leader node of the power transaction block chain if the ticket obtaining number determining time is the earliest. According to the scheme, the election process of the leader node of the power transaction block is reliably simplified through reliability evaluation, comparison and self-voting, the efficiency of determining the leader node in the RAFT consensus mechanism is improved, and the failure of election caused by the fact that the complexity of the leader node is greatly improved in the traditional technology can be avoided.
In one embodiment, as shown in fig. 2, there is provided an information processing method for a power transaction block chain based on a RAFT consensus mechanism, the method being applicable to an auditor node of the power transaction block chain as described above, and the method including the following steps:
step S201, acquiring information related to a leader node in a power transaction block chain as to-be-audited information; the power transaction blockchain determines leader nodes according to the method;
step S202, if the auditing result of the information to be audited is that the auditing is not passed, determining the node related to the information to be audited in the electric power transaction block chain as a malicious node, updating the reliability evaluation value of the malicious node, triggering a new round of leader election event and enabling the malicious node to quit the new round of leader election.
Specifically, this embodiment will be described with reference to fig. 3. After the leader node in the power transaction block chain is determined, consensus work is started. After the electric power market transaction is completed, the transaction information can be input and audited by the auditor node (the transaction information can be information related to the leader node), and the auditor node sends the transaction information to the leader node after the audit is completed; wherein, the complete log information sent by the leader node to the follower node and the currently submitted new log information (the log information can be corresponding to the information related to the leader node) are checked by the auditor node according to the time stamp, if the information is consistent with the information checked at the previous time of the same transaction, the auditor node submits the new log entry to the audit node log directory, if the information is inconsistent, the audit result is that the audit is not passed, the transaction process and the result of the entry log need to be further verified, and simultaneously, the node related to the information to be audited in the power transaction block chain, namely the leader node, is determined as a malicious node, meanwhile, the reliability of the malicious node is evaluated by adopting the method disclosed by the embodiment, a new round of leader election event is triggered, and the malicious node is enabled to quit the new round of leader election; the stored log content of the elected leader node also needs to be checked by an auditor node as information related to the leader node, the auditor node checks according to a timestamp, a due date and a transaction result, if inconsistent entries exist, namely the audit result is that the audit is not passed, the auditor node determines that the current leader node election fails, the current leader node is determined to be a malicious node, meanwhile, the reliability of the malicious node is evaluated in the mode disclosed by the embodiment, a new round of leader election event is triggered, and the malicious node is enabled to quit the new round of leader election.
According to the scheme of the embodiment, the information copied to the leader node, the information copied to the follower node and the like by the reviewer node is checked by adding the reviewer node in the electric power transaction block chain, so that the influence of the malicious node is prevented, the defects that an original RAFT consensus mechanism cannot well adapt to the consensus requirement condition of the existing malicious node and the malicious node is lacked in prevention and treatment are overcome, the advantages of participation in electric power transaction are favorably exerted, the application of the block chain technology in the electric power transaction is promoted, and the deepening of electric power market reform is assisted.
It should be understood that, although the steps in the flowcharts related to the embodiments as described above are sequentially displayed as indicated by arrows, the steps are not necessarily performed sequentially as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least a part of the steps in the flowcharts related to the embodiments described above may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, and the execution order of the steps or stages is not necessarily sequential, but may be rotated or alternated with other steps or at least a part of the steps or stages in other steps.
Based on the same inventive concept, the embodiment of the present application further provides a leader node determining device of the power transaction block chain based on the RAFT consensus mechanism, which is used for implementing the above related method for determining a leader node of the power transaction block chain based on the RAFT consensus mechanism, and an information processing device of the power transaction block chain based on the RAFT consensus mechanism, which is used for implementing the above related method for processing information of the power transaction block chain based on the RAFT consensus mechanism. The implementation scheme for solving the problem provided by the apparatus is similar to the implementation scheme described in the above method, so specific limitations in the embodiments of one or more of the apparatus for determining a leader node of a power transaction block chain based on the RAFT consensus mechanism and the apparatus for processing information of a power transaction block chain based on the RAFT consensus mechanism provided below may refer to limitations of the method for determining a leader node of a power transaction block chain based on the RAFT consensus mechanism and the method for processing information of a power transaction block chain based on the RAFT consensus mechanism in the above description, and are not described herein again.
In one embodiment, as shown in fig. 4, a leader node determination apparatus of a power transaction block chain based on a RAFT consensus mechanism is provided, and the apparatus 400 may include:
a request sending module 401, configured to send, in response to a trigger of a leader election event, a voting request and a current reliability assessment value of a local node to other nodes of a power transaction block chain, so that the other nodes receiving the voting request compare their current reliability assessment values with the current reliability assessment value of the local node; the reliability evaluation value of each node in the power transaction block chain is obtained by calculation according to the historical successful transaction quantity accumulated value, the node stability factor, the historical error transaction quantity accumulated value and the node penalty factor of each node;
a voting determination module 402, configured to determine to vote for the local node when the current reliability assessment value fed back by the other node is lower than the comparison result of the current reliability assessment value of the local node;
a vote number determining module 403, configured to determine a vote number of the node;
a leader node determining module 404, configured to determine, if the node belongs to the only node with the highest vote count in the current round of leader election, or the node belongs to one of the nodes with the highest vote count in the current round of leader election and the vote count determination time is the earliest, the node as the leader node of the power trading block chain.
In one embodiment, the apparatus 400 may further include: the evaluation value calculation unit is used for acquiring a historical successful transaction amount accumulated value, a node stability factor, a historical error transaction amount accumulated value and a node penalty factor of the node; a reliability positive integration part is obtained by calculating according to the product of the historical successful transaction quantity accumulated value and the node stability factor, and a reliability negative integration part is obtained by calculating according to the product of the historical error transaction quantity accumulated value and the node penalty factor; and calculating to obtain the current reliability evaluation value of the node according to the reliability positive integration part and the reliability negative integration part.
In one embodiment, the node stability factor is determined according to a ratio of a normal participation transaction duration of the node to a total transaction duration of the power transaction block chain.
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.
In one embodiment, as shown in fig. 5, there is provided an information processing apparatus for a power transaction block chain based on a RAFT consensus mechanism, which is applicable to an auditor node of the power transaction block chain, and the apparatus 500 may include:
an information obtaining module 501, configured to obtain information related to a leader node in the power transaction block chain as information to be audited; the power transaction blockchain determines leader nodes according to the method;
and an audit post-processing module 502, configured to determine, if the audit result of the to-be-audited information is that the audit is not passed, a node in the power transaction block chain, which is related to the to-be-audited information, as a malicious node, update a reliability evaluation value of the malicious node, trigger a new round of leader election event, and enable the malicious node to exit the new round of leader election.
All or part of the modules in the device for determining the leader node of the power transaction block chain based on the RAFT consensus mechanism and the device for determining the leader node of the power transaction block chain based on the RAFT consensus mechanism can be realized by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a terminal or a server, and its internal structure diagram may be as shown in fig. 6. The computer device comprises a processor, a memory, and a communication interface connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile 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 an operating system and computer programs in the non-volatile storage medium. The communication interface of the computer device is used for carrying out wired or wireless communication with external devices, and the wireless communication can be realized through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. The computer program is executed by a processor to realize a leader node determination method of the power transaction block chain based on the RAFT common recognition mechanism and an information processing method of the power transaction block chain based on the RAFT common recognition mechanism.
Those skilled in the art will appreciate that the architecture shown in fig. 6 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory having a computer program stored therein, the processor implementing the following steps when executing the computer program:
responding to triggering of a leader election event, sending a voting request and a current reliability evaluation value of a node to other nodes of a power transaction block chain, so that the other nodes receiving the voting request can compare the current reliability evaluation value with the current reliability evaluation value of the node; the reliability evaluation value of each node in the power transaction block chain is obtained by calculation according to the historical successful transaction quantity accumulated value, the node stability factor, the historical error transaction quantity accumulated value and the node penalty factor of each node; when a comparison result that the current reliability evaluation value fed back by the other nodes is lower than the current reliability evaluation value of the node is received, voting is determined for the node; determining the number of votes obtained by the node; and if the node belongs to the only node with the highest ticket number in the current round of leader election, or the node belongs to one of the nodes with the highest ticket number in the current round of leader election and the ticket number determining time is the earliest, determining the node as the leader node of the power transaction block chain.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
acquiring a historical successful transaction quantity accumulated value, a node stability factor, a historical error transaction quantity accumulated value and a node penalty factor of the node; a reliability positive integration part is obtained by calculating according to the product of the historical successful transaction quantity accumulated value and the node stability factor, and a reliability negative integration part is obtained by calculating according to the product of the historical error transaction quantity accumulated value and the node penalty factor; and calculating to obtain the current reliability evaluation value of the node according to the reliability positive integration part and the reliability negative integration part.
In one embodiment, the node stability factor is determined according to a ratio of a normal participation transaction duration of the node to a total transaction duration of the power transaction block chain. :
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.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory having a computer program stored therein, the processor implementing the following steps when executing the computer program:
acquiring information related to a leader node in the power transaction block chain as to-be-audited information; the power transaction blockchain determines leader nodes according to the method; and if the audit result of the information to be audited is that the audit is not passed, determining the node related to the information to be audited in the electric power transaction block chain as a malicious node, updating the reliability evaluation value of the malicious node, triggering a new round of leader election event and enabling the malicious node to quit the new round of leader election.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of:
responding to triggering of a leader election event, sending a voting request and a current reliability evaluation value of a node to other nodes of a power transaction block chain, so that the other nodes receiving the voting request can compare the current reliability evaluation value with the current reliability evaluation value of the node; the reliability evaluation value of each node in the power transaction block chain is obtained by calculation according to the historical successful transaction quantity accumulated value, the node stability factor, the historical error transaction quantity accumulated value and the node penalty factor of each node; when a comparison result that the current reliability evaluation value fed back by the other nodes is lower than the current reliability evaluation value of the node is received, voting is determined for the node; determining the number of votes obtained by the node; and if the node belongs to the only node with the highest ticket number in the current round of leader election, or the node belongs to one of the nodes with the highest ticket number in the current round of leader election and the ticket number determining time is the earliest, determining the node as the leader node of the power transaction block chain.
In one embodiment, the computer program when executed by the processor further performs the steps of:
acquiring a historical successful transaction quantity accumulated value, a node stability factor, a historical error transaction quantity accumulated value and a node penalty factor of the node; a reliability positive integration part is obtained by calculating according to the product of the historical successful transaction quantity accumulated value and the node stability factor, and a reliability negative integration part is obtained by calculating according to the product of the historical error transaction quantity accumulated value and the node penalty factor; and calculating to obtain the current reliability evaluation value of the node according to the reliability positive integration part and the reliability negative integration part.
In one embodiment, the node stability factor is determined according to a ratio of a normal participation transaction duration of the node to a total transaction duration of the power transaction block chain.
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.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of:
acquiring information related to a leader node in the power transaction block chain as to-be-audited information; the power transaction blockchain determines leader nodes according to the method; and if the audit result of the information to be audited is that the audit is not passed, determining the node related to the information to be audited in the electric power transaction block chain as a malicious node, updating the reliability evaluation value of the malicious node, triggering a new round of leader election event and enabling the malicious node to quit the new round of leader election.
In one embodiment, a computer program product is provided, comprising a computer program which, when executed by a processor, performs the steps of:
responding to triggering of a leader election event, sending a voting request and a current reliability evaluation value of a node to other nodes of a power transaction block chain, so that the other nodes receiving the voting request can compare the current reliability evaluation value with the current reliability evaluation value of the node; the reliability evaluation value of each node in the power transaction block chain is obtained by calculation according to the historical successful transaction quantity accumulated value, the node stability factor, the historical error transaction quantity accumulated value and the node penalty factor of each node; when a comparison result that the current reliability evaluation value fed back by the other nodes is lower than the current reliability evaluation value of the node is received, voting is determined for the node; determining the number of votes obtained by the node; and if the node belongs to the only node with the highest ticket number in the current round of leader election, or the node belongs to one of the nodes with the highest ticket number in the current round of leader election and the ticket number determining time is the earliest, determining the node as the leader node of the power transaction block chain.
In one embodiment, the computer program when executed by the processor further performs the steps of:
acquiring a historical successful transaction quantity accumulated value, a node stability factor, a historical error transaction quantity accumulated value and a node penalty factor of the node; a reliability positive integration part is obtained by calculating according to the product of the historical successful transaction quantity accumulated value and the node stability factor, and a reliability negative integration part is obtained by calculating according to the product of the historical error transaction quantity accumulated value and the node penalty factor; and calculating to obtain the current reliability evaluation value of the node according to the reliability positive integration part and the reliability negative integration part.
In one embodiment, the node stability factor is determined according to a ratio of a normal participation transaction duration of the node to a total transaction duration of the power transaction block chain.
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.
In one embodiment, a computer program product is provided, comprising a computer program which, when executed by a processor, performs the steps of:
acquiring information related to a leader node in the power transaction block chain as to-be-audited information; the power transaction blockchain determines leader nodes according to the method; and if the audit result of the information to be audited is that the audit is not passed, determining the node related to the information to be audited in the electric power transaction block chain as a malicious node, updating the reliability evaluation value of the malicious node, triggering a new round of leader election event and enabling the malicious node to quit the new round of leader election.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, database, or other medium used in the embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high-density embedded nonvolatile Memory, resistive Random Access Memory (ReRAM), Magnetic Random Access Memory (MRAM), Ferroelectric Random Access Memory (FRAM), Phase Change Memory (PCM), graphene Memory, and the like. Volatile Memory can include Random Access Memory (RAM), external cache Memory, and the like. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM), among others. The databases referred to in various embodiments provided herein may include at least one of relational and non-relational databases. The non-relational database may include, but is not limited to, a block chain based distributed database, and the like. The processors referred to in the embodiments provided herein may be general purpose processors, central processing units, graphics processors, digital signal processors, programmable logic devices, quantum computing based data processing logic devices, etc., without limitation.
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 for analysis, stored data, presented data, etc.) referred to in the present application are information and data authorized by the user or sufficiently authorized by each party.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the present application. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present application shall be subject to the appended claims.

Claims (10)

1. A leader node determination method of a power transaction block chain based on a RAFT (reversible addition-fragmentation chain) consensus mechanism is characterized by comprising the following steps:
responding to triggering of a leader election event, sending a voting request and a current reliability evaluation value of a node to other nodes of a power transaction block chain, so that the other nodes receiving the voting request can compare the current reliability evaluation value with the current reliability evaluation value of the node; the reliability evaluation value of each node in the power transaction block chain is obtained by calculation according to the historical successful transaction quantity accumulated value, the node stability factor, the historical error transaction quantity accumulated value and the node penalty factor of each node;
when a comparison result that the current reliability evaluation value fed back by the other nodes is lower than the current reliability evaluation value of the node is received, voting is determined for the node;
determining the number of votes obtained by the node;
and if the node belongs to the only node with the highest ticket number in the current round of leader election, or the node belongs to one of the nodes with the highest ticket number in the current round of leader election and the ticket number determining time is the earliest, determining the node as the leader node of the power transaction block chain.
2. The method of claim 1, wherein before sending the voting request and the current reliability assessment value of the node to other nodes of the power transaction block chain, the method further comprises:
acquiring a historical successful transaction quantity accumulated value, a node stability factor, a historical error transaction quantity accumulated value and a node penalty factor of the node;
a reliability positive integration part is obtained by calculating according to the product of the historical successful transaction quantity accumulated value and the node stability factor, and a reliability negative integration part is obtained by calculating according to the product of the historical error transaction quantity accumulated value and the node penalty factor;
and calculating to obtain the current reliability evaluation value of the node according to the reliability positive integration part and the reliability negative integration part.
3. The method of claim 2, wherein the node stability factor is determined according to a ratio of a normal participation trade time of the node to a total trade time of the power trade block chain.
4. The method according to claim 2, wherein 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.
5. An information processing method of a power transaction block chain based on a RAFT (reversible addition-fragmentation chain) consensus mechanism is applied to an auditor node of the power transaction block chain, and comprises the following steps:
acquiring information related to a leader node in the power transaction block chain as to-be-audited information; determining a leader node by the power trading block chain according to the method of any one of claims 1 to 4;
and if the audit result of the information to be audited is that the audit is not passed, determining the node related to the information to be audited in the electric power transaction block chain as a malicious node, updating the reliability evaluation value of the malicious node, triggering a new round of leader election event and enabling the malicious node to quit the new round of leader election.
6. A leader node determination apparatus of a power transaction block chain based on a RAFT consensus mechanism, the apparatus comprising:
the request sending module is used for responding to triggering of a leader election event, sending a voting request and a current reliability evaluation value of the node to other nodes of the power transaction block chain, so that the other nodes receiving the voting request can compare the current reliability evaluation value with the current reliability evaluation value of the node; the reliability evaluation value of each node in the power transaction block chain is obtained by calculation according to the historical successful transaction quantity accumulated value, the node stability factor, the historical error transaction quantity accumulated value and the node penalty factor of each node;
the voting determination module is used for determining to vote for the node when the current reliability evaluation value fed back by the other nodes is lower than the comparison result of the current reliability evaluation value of the node;
the system comprises a ticket number determining module, a ticket obtaining module and a ticket obtaining module, wherein the ticket number determining module is used for determining the ticket number of the node;
and the leader node determining module is used for determining the node as the leader node of the electric power transaction block chain if the node belongs to the only node with the highest ticket number in the current round of leader election, or the node belongs to one of the nodes with the highest ticket number in the current round of leader election and the determination time of the ticket number is the earliest.
7. An information processing device of a power transaction block chain based on a RAFT (reversible addition-fragmentation chain) consensus mechanism is applied to an auditor node of the power transaction block chain, and the device comprises:
the information acquisition module is used for acquiring information related to the leader node in the electric power transaction block chain as to-be-audited information; determining a leader node by the power trading block chain according to the method of any one of claims 1 to 4;
and the post-audit processing module is used for determining a node related to the information to be audited in the electric power transaction block chain as a malicious node and updating the reliability evaluation value of the malicious node if the audit result of the information to be audited is that the audit is not passed, and triggering a new round of leader election event and enabling the malicious node to quit the new round of leader election.
8. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor, when executing the computer program, implements the steps of the method of any of claims 1 to 5.
9. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 5.
10. A computer program product comprising a computer program, characterized in that the computer program realizes the steps of the method of any one of claims 1 to 5 when executed by a processor.
CN202111334002.0A 2021-11-11 2021-11-11 Leader node determination method, device, equipment and medium based on power block chain Pending CN113947491A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111334002.0A CN113947491A (en) 2021-11-11 2021-11-11 Leader node determination method, device, equipment and medium based on power block chain

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111334002.0A CN113947491A (en) 2021-11-11 2021-11-11 Leader node determination method, device, equipment and medium based on power block chain

Publications (1)

Publication Number Publication Date
CN113947491A true CN113947491A (en) 2022-01-18

Family

ID=79337830

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111334002.0A Pending CN113947491A (en) 2021-11-11 2021-11-11 Leader node determination method, device, equipment and medium based on power block chain

Country Status (1)

Country Link
CN (1) CN113947491A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114726867A (en) * 2022-02-28 2022-07-08 重庆趣链数字科技有限公司 Hot standby multi-master method based on Raft

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114726867A (en) * 2022-02-28 2022-07-08 重庆趣链数字科技有限公司 Hot standby multi-master method based on Raft
CN114726867B (en) * 2022-02-28 2023-09-26 重庆趣链数字科技有限公司 Hot standby multi-main method based on Lift

Similar Documents

Publication Publication Date Title
CN110378694B (en) Block chain data processing method and device, computer equipment and storage medium
CN110503558A (en) A kind of processing method and processing device based on block catenary system
CN104811344A (en) Network dynamic service monitoring method and apparatus
CN109285069B (en) Resource transfer method, device and server
US11115804B2 (en) Subscription to dependencies in smart contracts
CN113947491A (en) Leader node determination method, device, equipment and medium based on power block chain
CN112488745A (en) Intelligent charge control management method, device, equipment and storage medium
CN111626498A (en) Equipment operation state prediction method, device, equipment and storage medium
US11606442B2 (en) Subscription to edits of blockchain transaction
CN112163929A (en) Service recommendation method and device, computer equipment and storage medium
CN111444010B (en) Consensus method based on computing resource computing power certification
US11140094B2 (en) Resource stabilization in a distributed network
CN114626841A (en) Resource transfer processing method, device, computer device, medium, and program product
CN114549149A (en) Smart grid energy transaction data processing method and device and computer equipment
CN113835780A (en) Event response method and device
CN111061558A (en) Method, device, computer equipment and storage medium for processing virtual resource data
CN116911975A (en) Resource processing method, device, computer equipment and medium based on block chain
CN115439229A (en) Service data processing method and device, computer equipment and storage medium
CN116188178A (en) Resource information processing method, device, equipment, storage medium and product
CN117692516A (en) Service access processing method, device, computer equipment and storage medium
CN117391330A (en) Financial business handling sequence determining method, device and computer equipment
CN115422897A (en) Method and device for processing resource transfer message, computer equipment and storage medium
CN116862487A (en) Transaction asset processing method, apparatus, device, storage medium and program product
CN117132283A (en) Identification method, apparatus, computer device, storage medium, and program product
CN116962158A (en) Credit value adjustment and demand response method suitable for demand response block chain system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination