Message consensus method and device, electronic equipment and storage medium

By screening nodes that meet the energy threshold and evaluation mechanism in the alliance chain system for message consensus, the alliance chain performance bottleneck problem is solved, the fault tolerance and risk resistance of the blockchain network are improved, and the performance of the transaction system is optimized.

CN120434253APending Publication Date: 2025-08-05AGRICULTURAL BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510706896.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-29
Publication Date
2025-08-05

AI Technical Summary

Technical Problem

The performance bottleneck problem of the alliance chain system is due to improper selection of consensus algorithms, resulting in poor performance of the supply chain financial system.

Method used

By receiving messages from the first node, verifying and sending a second message, filtering out nodes that meet the preset energy threshold and evaluation mechanism for communication, determining the number of messages and generating sending instructions, transmitting the fourth message to the fourth node, and optimizing the message consensus process.

Benefits of technology

It improves the fault tolerance and risk resistance of the entire blockchain network, reduces the number of communications, and optimizes the performance within the transaction system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120434253A_ABST
    Figure CN120434253A_ABST
Patent Text Reader

Abstract

The invention discloses a message consensus method and device, electronic equipment and a storage medium. The method comprises: receiving a first message from a first node; verifying the first message, and sending a second message to a third node according to a verification result; receiving third messages, and determining the number of the third messages; generating an information sending instruction according to the third message quantity and the first preset message quantity; and transmitting a fourth message to the fourth node according to the information sending instruction. According to the method, through message transmission and verification of multiple nodes, the number of communication times in the message consensus process can be reduced, the performance of the whole block chain network in a transaction system is optimized, and meanwhile the anti-risk capacity of the whole block chain network can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of financial technology, and in particular to a message consensus method, device, electronic device and storage medium. Background Art

[0002] The "dual-chain integration" model of blockchain and supply chain is an effective means to solve problems such as information islands, low credit transmission, low scenario credibility, and difficult risk control in traditional supply chain finance. The characteristics of blockchain technology such as de-neutrality, tamper-proofing, security and reliability provide a safe and reliable credit system underlying design for the entire chain scenario of supply chain finance, while ensuring the integrity and leakage prevention capabilities of transaction data. Through the design of smart contracts, risk factors of each link, scenario, and transaction in the supply chain are monitored and warned, thereby enhancing the risk control capabilities of the financial system and providing financial institutions, upstream and downstream enterprises in the supply chain, and regulatory agencies with an effective intelligent risk control system.

[0003] Blockchains come in three main forms: public, private, and consortium. Consortium chains offer a lower degree of decentralization, making them more suitable for supply chain finance risk management scenarios that require privacy protection and strict internal oversight. However, the performance bottleneck of consortium chain systems is determined by the chosen consensus algorithm. Due to the "impossible triangle" of decentralization, security, and scalability, no single consensus algorithm currently meets the requirements of all application scenarios. Different consensus algorithms have varying effectiveness and performance in different scenarios, leading to poor performance in supply chain finance systems. Summary of the Invention

[0004] The present invention provides a message consensus method, device, electronic device and storage medium to solve the problem of poor regional chain performance.

[0005] According to one aspect of the present invention, a message consensus method is provided, comprising:

[0006] receiving a first message from a first node; the first message including operation information for modifying resource information; the first node being configured to receive the operation information for modifying resource information and coordinate a consensus process for the operation information for modifying resource information;

[0007] The first message is verified, and a second message is sent to a third node based on the verification result; the second message is used to instruct verification of the third node status, and the third message is fed back to the second node; the second node is a node selected for communication based on a preset energy threshold and a preset evaluation mechanism; the preset energy threshold is a threshold for node energy consumption; the preset evaluation mechanism is to evaluate whether a node can be used as a second node based on the node's attribute information, performance information, and historical transmission status; the node is a device within the transaction system;

[0008] receiving a third message and determining the number of third messages; the third message being a feedback message sent by the third node to the second message;

[0009] Generate an information sending instruction according to the third message quantity and the first preset message quantity;

[0010] A fourth message is transmitted to the fourth node according to the information sending instruction; the fourth message includes operation information for changing the resource information.

[0011] According to another aspect of the present invention, a message consensus device is provided, comprising:

[0012] A first message receiving module is configured to receive a first message from a first node; the first message includes operation information for changing resource information; the first node is configured to receive the operation information for changing resource information and coordinate a consensus process for the operation information for changing resource information;

[0013] A second message sending module is configured to verify the first message and send a second message to a third node based on the verification result; the second message is configured to indicate verification of the third node's status and to provide feedback of the third message to the second node; the second node is a node selected for communication based on a preset energy threshold and a preset evaluation mechanism; the preset energy threshold is a threshold for node energy consumption; the preset evaluation mechanism is configured to assess whether a node can be used as a second node based on the node's attribute information, performance information, and historical transmission status; and the node is a device within the trading system;

[0014] a third message receiving module, configured to receive a third message and determine the number of third messages; the third message being a feedback message sent by the third node to the second message;

[0015] An information sending instruction generating module, configured to generate an information sending instruction according to the third message quantity and the first preset message quantity;

[0016] The message transmission module is used to transmit a fourth message to the fourth node according to the information sending instruction; the fourth message includes operation information for changing resource information.

[0017] According to another aspect of the present invention, an electronic device is provided, comprising:

[0018] at least one processor; and

[0019] a memory communicatively connected to the at least one processor; wherein,

[0020] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the message consensus method described in any embodiment of the present invention.

[0021] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the message consensus method described in any embodiment of the present invention when executed.

[0022] The technical solution of the embodiment of the present invention receives a first message from a first node; verifies the first message, and sends a second message to a third node based on the verification result. The first message is verified to ensure that when a fault occurs in the first node, it can be replaced in time. After verification, the second message is sent to ensure the security of message transmission; receives a third message and determines the number of third messages; generates an information sending instruction based on the number of third messages and the first preset number of messages, which can improve the fault tolerance of the entire blockchain network while also improving the efficiency of message transmission; transmits a fourth message to a fourth node based on the information sending instruction, which can achieve one-time sending of the fourth message, reducing the number of message transmissions while also improving transmission efficiency. This method can reduce the number of communications in the message consensus process through message transmission and verification of multiple nodes, optimize the performance of the entire blockchain network within the transaction system, and improve the risk resistance of the entire blockchain network.

[0023] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present invention, nor is it intended to limit the scope of the present invention. Other features of the present invention will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0025] Figure 1A flowchart of a message consensus method provided by an embodiment of the present invention;

[0026] Figure 2 A flowchart of another message consensus method provided by an embodiment of the present invention;

[0027] Figure 3 A schematic diagram of the structure of a message consensus device provided by an embodiment of the present invention;

[0028] Figure 4 A schematic diagram of the structure of an electronic device for implementing the message consensus method according to an embodiment of the present invention. DETAILED DESCRIPTION

[0029] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.

[0030] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0031] Figure 1 This is a flow chart of a message consensus method provided by an embodiment of the present invention. This embodiment is applicable to the situation where the transaction information generated in the transaction system is synchronized with the entire blockchain network. The method can be executed by a message consensus device, which can be implemented in the form of hardware and / or software. The message consensus device can be configured in any electronic device with network communication function. Figure 1 As shown, the method includes:

[0032] S110, receiving a first message from a first node; the first message includes operation information for changing resource information; the first node is used to receive the operation information for changing resource information and coordinate a consensus process for the operation information for changing resource information.

[0033] The first message consists of the operation information for changing the resource information, the message sequence number, and the current consensus round. The message sequence number is used to mark the order in which the first message is sent.

[0034] Furthermore, the first message may be expressed as:<PREPARE,H(m),s,T> , m>. Where H(m) is the message digest; s is the message sequence number; T is the current consensus round; and m is the operation information for changing resource information.

[0035] The primary node is the master node for message consensus within the trading system. It receives operational information generated by the trading system regarding changes to resource information and coordinates the consensus process for these changes. A heartbeat mechanism and a master-slave mechanism ensure high availability and stability for the trading system.

[0036] The heartbeat mechanism is a method of periodically sending lightweight signals to monitor whether the first node or the first node is in operation. The master-slave mechanism is to set a backup node for the first node and quickly switch to the backup node when the first node fails to ensure the continuous operation of the system.

[0037] Among them, the consensus process is the process of synchronizing the operation information of changing resource information to all nodes in the entire blockchain network.

[0038] In the above steps, the determination of the first node can reduce the communication cost in the entire blockchain network and greatly improve the scalability of the network.

[0039] Specifically, the second node receives the first message sent by the first node.

[0040] Among them, the second node, also known as the consensus node, is responsible for verifying the first message and synchronizing the operation information of changing the resource information in the first message to all nodes in the entire blockchain network.

[0041] Furthermore, before each round of message consensus begins, it is necessary to screen the second node, that is, to screen the second node according to a preset energy threshold and a preset evaluation mechanism.

[0042] Furthermore, after obtaining the second node, a fixed organization needs to be formed between the nodes. There are two types of organizations: the main organization and the consensus organization. The main organization is an organization that includes all first nodes and is responsible for receiving operational information generated by the transaction system to change resource information and coordinating the consensus process for operational information to change resource information. Multiple consensus organizations exist in parallel, and each consensus organization contains a certain number of second nodes. During each preset time period, each consensus organization will select the second node with the highest trust value in the current organization as the communication node, responsible for communicating with other nodes to complete the consensus task. The construction of the consensus organization is based on the trust value of the second node to ensure an efficient and reliable consensus process. The consensus organization will be rebuilt based on the trust value during each preset time period. Among them, the trust value is used to indicate whether the second node can be used.

[0043] The preset evaluation mechanism is one of the conditions for evaluating whether a node can be used as a second node based on the node's attribute information, performance information, and historical transmission status.

[0044] Furthermore, the evaluation process of the preset evaluation mechanism is as follows: A node's attribute information and performance information are compared against preset evaluation requirements one by one. If the preset evaluation requirements are met, the node status is marked as usable. The node's attribute information, performance information, and historical transmission status are quantified to obtain a credibility value. This credibility value is compared with the preset credibility value, and the comparison result is used as one of the criteria for evaluating the second node.

[0045] The preset energy threshold can be expressed by the following formula:

[0046]

[0047] Among them, E run The minimum energy consumed by the node; E trans The minimum energy consumed by a node to transmit a message; T is the number of rounds of message consensus within a preset time period; t is the time required for a node to participate in one round of message consensus.

[0048] For example, within a preset time period, assuming that n nodes are selected as second nodes, the selected n second nodes will be divided into l consensus organizations, and each consensus organization contains n / l second nodes.

[0049] In the above steps, the selection of the second node can improve the fault tolerance and risk resistance of the regional chain while reducing the number of communications.

[0050] Furthermore, before the first node sends the first message, the first node signs the first message.

[0051] Furthermore, if the first message sent by the first node is not received, the first node is instructed to be replaced. This is because the first node sends the first message, but the second node does not receive it within a preset time.

[0052] Furthermore, before the first node sends the first message, a time period switching protocol needs to be determined. Multiple consensus nodes and consensus organizations will be elected within each preset time period to participate in multiple rounds of consensus processes. If consensus fails or the preset time period ends, a new preset time period will be entered to ensure the activity of the entire blockchain network.

[0053] In the above steps, the time period switching protocol can reduce the communication cost in the network and greatly improve the scalability of the entire blockchain network.

[0054] S120. Verify the first message and send a second message to the third node based on the verification result; the second message is used to indicate the verification of the third node status, and feedback the third message to the second node; the second node is a node for communication screened according to a preset energy threshold and a preset evaluation mechanism; the preset energy threshold is the threshold for node energy consumption; the preset evaluation mechanism is to evaluate whether the node can be used as the second node based on the node's attribute information, performance information and historical transmission status; the node is a device within the transaction system.

[0055] The preset evaluation mechanism is one of the conditions for evaluating whether a node can be used as a second node based on the node's attribute information, performance information, and historical transmission status.

[0056] The evaluation process of the preset evaluation mechanism is as follows: A node's attribute information and performance information are compared against preset evaluation requirements one by one. If the requirements are met, the node status is marked as usable. The node's attribute information, performance information, and historical transmission status are quantified to obtain a trust value. This trust value is compared with the preset trust value, and the comparison result is used as one of the criteria for evaluating the second node.

[0057] The historical transmission status refers to the transmission status of the fifth node before the current second node selection time.

[0058] Among them, the third node is a communication node in a different consensus organization from the second node.

[0059] The second message contains the second node number, message sequence number, and the current consensus round. The second message can be expressed as:<EXECUTE,s,T,i> , where s is the message sequence number; T is the current consensus round; and i is the second node number.

[0060] Specifically, after receiving the first message, the second node parses the first message to obtain the signature information and the operation information for modifying the resource information. The second node verifies the signature information to see if it matches the signature of the first node recorded in the second node. If so, the second node sends a second message to the third node and saves the operation information for modifying the resource information. If not, the node instructs the first node to switch.

[0061] Furthermore, the second node sends a sixth message to the first node while sending the second message to the third node. The sixth message is used to instruct the first node to establish message transmission with the second node.

[0062] Furthermore, after receiving the second message, the third node parses the second message and performs verification based on the parsed content. If the verification passes, the third node sends the third message to the second node.

[0063] The third message is used to feed back the verification result to the second node.

[0064] S130. Receive a third message and determine the number of third messages; the third message is a feedback message sent by the third node to the second message.

[0065] Specifically, the second node receives the third message sent by the third node, and counts the received third messages to obtain the number of third messages.

[0066] S140: Generate an information sending instruction according to the third message quantity and the first preset message quantity.

[0067] The information sending instruction is used to instruct the second node to send a message containing operation information for changing resource information to the fourth node.

[0068] Specifically, if the acquired third message quantity is the same as the first preset message quantity, a message sending instruction is generated.

[0069] In the above steps, if the preset number of messages is met, a message sending instruction is generated. This ensures that even if there are nodes that cannot participate in the consensus process normally, the sending of messages will not be affected, but the message sending instruction can still be generated, thereby improving the fault tolerance of the regional chain network.

[0070] Among them, the reasons why nodes cannot participate in the consensus process normally and cannot complete the consensus are: malicious sending of error information, offline and insufficient node energy.

[0071] S150. Transmit a fourth message to the fourth node according to the information sending instruction; the fourth message includes operation information for changing resource information.

[0072] Among them, the fourth node is a node that is located in the same consensus organization as the second node and participates in the message consensus process.

[0073] The fourth message contains operation information for changing resource information. The fourth message can be expressed as: <synchronize>,m>, where m is the operation information for changing resource information.

[0074] Specifically, the second node responds to the information sending instruction, generates a fourth message with the operation information of changing the resource information, and sends the fourth message to the fourth node.

[0075] Furthermore, after receiving the fourth message, the fourth node parses the fourth message to obtain operation information for changing the resource information and saves the operation information for changing the resource information.

[0076] Furthermore, after the fourth node saves the operation information of changing the resource information, the method further includes: the sixth node synchronizing the operation information of changing the resource information saved by the fourth node.

[0077] The sixth node is a node in the same block as the second node that does not directly participate in the consensus process. It is mainly responsible for submitting transaction requests and updating the local ledger after consensus is reached. The local ledger is used to record operation information that changes resource information.

[0078] For example, Figure 2 As shown, the first node generates a first message based on the acquired operation information regarding resource changes. The first node signs the first message and sends it to the second node of each consensus organization. The second node verifies the first message and, if verified, stores it locally. The second node sends a second message to the third node. Upon receiving the second message, the third node verifies the legitimacy of the second message, records the number of valid second messages received, and checks whether it has received 2f identical second messages from different nodes. If so, each consensus organization's communication node sends a synchronize message (the fourth message) to the organization's fourth node. Each consensus organization's non-communication node (the fourth node) receives and verifies the synchronize message, stores it in its local log, and synchronizes it with the sixth node. Each consensus organization's communication node sends a reply message to the first node. The consensus process is completed after the first node has received f+1 reply messages. The master node is the first node, and the communication node is the second node. For communication node B2, the third node is a communication node within consensus organizations A and C, and the fourth node is a replica node within consensus organization B.

[0079] Further, from Figure 2 It can be seen that although there are malicious nodes, the consensus process can still be completed.

[0080] Furthermore, malicious nodes are divided into ordinary malicious nodes and communicating malicious nodes. Ordinary malicious nodes are nodes that are not second nodes; communicating malicious nodes are malicious second nodes. Furthermore, the number of communicating malicious nodes must exceed f = (n / k-1) / 3, which will affect the consensus process. There is no limit on the number of ordinary malicious nodes.

[0081] Optionally, at least one method for determining the second node includes steps A1-A4:

[0082] Step A1, determine the first energy consumption of the fifth node; the fifth node is the node to be screened by the second node; the first energy consumption is the total energy consumed by the fifth node for message transmission and operation within a preset time period.

[0083] Specifically, the average power of the fifth node is determined, and the energy consumed by the fifth node during operation within a preset time period is determined based on the obtained average power. The energy consumed by the fifth node during message transmission within the preset time period is determined based on the energy consumed by the fifth node when sending and receiving messages within the preset time period. The energy consumed by the fifth node during operation and the energy consumed by message transmission within the preset time period are summed to obtain a first energy consumption.

[0084] Furthermore, the fifth node receives or sends a message through a transceiver circuit.

[0085] Furthermore, the energy consumption of sending a message comes from signal amplification and circuit loss. Furthermore, the energy consumption of sending a message can be expressed as:

[0086] E tx =kE elec +kE amp d α ;

[0087] Where k is the size of the message sent; d is the transmission distance; α is the path loss exponent; E elec is the circuit energy consumption; E amp is the energy consumption of the amplifier.

[0088] The energy consumption of receiving a message comes from circuit processing, that is, the energy consumption generated when demodulating or decoding the message after receiving it. Furthermore, the energy consumption of receiving a message can be expressed as:

[0089] E rx =kE elec ;

[0090] Among them, k is the size of the message to be sent; E elec The energy consumption of the circuit.

[0091] Step A2: Determine the attribute information and performance information of the fifth node; the performance information is used to characterize the message transmission capability of the fifth node.

[0092] Attribute information describes the fifth node's functionality and location. This attribute information includes information about the manufacturer, node functionality, node location, and node configuration. This attribute information is provided when the fifth node joins the trading system network and registers with the first node. It serves as a preliminary basis for assessing the fifth node's trustworthiness. The trustworthiness value indicates whether the fifth node is usable.

[0093] Furthermore, the trust value is composed of a basic trust value and a historical consensus trust value. The basic trust value is quantified by attribute information and performance information. The historical consensus trust value is a quantitative score of the fifth node's transmission status before the current second node selection time, that is, a quantitative score of historical behavior.

[0094] Among them, historical behavior is used to describe the number of successful participation of the fifth node in message consensus after registration, failure records, and whether it has been reported for misconduct. Misconduct represents the behavior that fails to reach information consensus.

[0095] Furthermore, the manufacturer information is used to characterize the credibility of the manufacturer or operator of the fifth node, wherein the credibility of the manufacturer or operator is used to characterize the quality of the fifth node produced by the manufacturer or operator.

[0096] The performance information is used to describe the message transmission capability of the fifth node. Further, the performance information includes computing capability, network stability, and response time.

[0097] Furthermore, each time a second node is screened, historical behavior information is recalculated. Specifically, the fifth node calculates an additional credibility value based on its historical consensus completion times and whether it has engaged in malicious behavior. If a node engages in malicious behavior, its base credibility value is cleared, and the fifth node is required to re-register with the first node. The credibility value indicates whether the fifth node can be used in the current round of message consensus.

[0098] Specifically, the attribute information, performance information and historical transmission status of the fifth node are obtained from the node database.

[0099] Among them, the node database is used to record the attribute information, performance information and historical transmission status of all nodes in the trading system.

[0100] Step A3: Determine the fifth node status based on the attribute information, performance information, and preset evaluation requirements; the fifth node status is used to indicate whether the fifth node is available.

[0101] The preset evaluation requirement is used to represent the conditions that the fifth node needs to meet as the second node. Furthermore, the preset evaluation requirement is determined based on the actual message consensus requirement.

[0102] Specifically, the attribute information and performance information are compared with the corresponding items in the preset evaluation requirements. If all are met, the fifth node status is considered to be usable; if one item is not met, the fifth node status is considered to be unusable.

[0103] Step A4: Filter the fifth node according to the fifth node state and the first energy consumption to obtain the second node.

[0104] Specifically, if the first energy consumption is greater than or equal to the preset energy threshold, and the fifth node status is usable, then the fifth node is considered to be able to serve as the second node; if the first energy consumption is less than the preset energy threshold, or the fifth node status is unusable, then the fifth node is considered not to be able to serve as the second node.

[0105] Furthermore, the screening of the fifth node also needs to consider the fifth node's credibility. That is, if the fifth node is in the usable state, the corresponding attribute information, performance information, and historical transmission status of the fifth node are quantified to obtain a credibility value. If the credibility value is greater than the preset credibility value, the fifth node can be used as the second node; if the credibility value is less than the preset credibility value, the fifth node cannot be used as the second node. If the fifth node is in the unusable state, the fifth node cannot be used as the second node.

[0106] The preset energy threshold can be expressed by the following formula:

[0107]

[0108] Among them, E run The minimum energy consumed by the node during the preset time period; E trans It is the minimum energy consumed by a node to transmit a message within a preset time period; T is the number of rounds of message consensus within the preset time period; t is the time required for a node to participate in one round of message consensus.

[0109] Optionally, determining the first energy consumption of the fifth node includes steps B1-B2:

[0110] Step B1, determine the second energy consumption and the third energy consumption of the fifth node; the second energy consumption is the energy consumption generated when the fifth node is running; the third energy consumption is the energy consumption generated when the fifth node is transmitting a message.

[0111] The second energy consumption is the energy required for the fifth node to maintain operation within a preset time period, and is determined by average power.

[0112] Furthermore, the second energy consumption=average power (watt, W)×operating time (hour, h)÷1000.

[0113] The third energy consumption includes: the energy consumption generated when the fifth node receives a message and the energy consumption generated when the fifth node sends a message within a preset time period.

[0114] Furthermore, the energy consumed in sending a message comes from signal amplification and circuit loss. The energy consumed in receiving a message comes from circuit processing, that is, the energy consumed when demodulating or decoding the message after receiving it.

[0115] Specifically, based on the average power of the fifth node, an energy consumption required for the fifth node to operate within a preset time period is determined as the second energy consumption. A total energy consumption of the fifth node for receiving messages and a total energy consumption of the fifth node for sending messages within the preset time period are determined, and the sum of the energy consumptions is calculated to obtain a third energy consumption.

[0116] Step B2: Determine the first energy consumption according to the second energy consumption and the third energy consumption.

[0117] Specifically, the second energy consumption and the third energy consumption are summed to obtain the first energy consumption.

[0118] Optionally, after transmitting the fourth message to the fourth node according to the information sending instruction, steps C1-C3 are included:

[0119] Step C1: After receiving the fourth message, the fourth node verifies the fourth message.

[0120] Specifically, after receiving the fourth message, the fourth node parses the fourth message to obtain the signature information and the operation information for changing the resource information, verifies the legitimacy of the second node based on the signature information, and verifies the legitimacy of the operation information.

[0121] The legitimacy of the second node is used to indicate whether the second node is a communication node of the block where the fourth node is located.

[0122] Blocks are the basic data units that make up a blockchain. They are structured data blocks that store operational information related to resource changes and the blockchain's state. Blockchain is a decentralized, tamper-proof, secure, and reliable distributed accounting technology. Its core feature is that it eliminates the control of traditional centralized institutions, enabling every node to share the same ledger, enabling the exchange of digital assets and the formation of consensus. The ledger is used to record operational information related to resource changes.

[0123] The legitimacy of the operation information is used to indicate whether the operation information used to modify the resource information is garbled information or has been tampered with.

[0124] Step C2: If the verification is successful, the operation information of changing the resource information in the fourth message is saved, and a content verification success message is sent to the second node.

[0125] Specifically, if the verification is successful, the fourth node will save the operation information of the resource information change and synchronize the information to the block where it is located. After the verification is successful, the fourth node sends a content verification success message to the second node.

[0126] Furthermore, the fourth node synchronizes information with the block it is in by synchronizing the resource information change operation information with the sixth node in its block and determining whether the resource information change operation information it receives is the same as that received by other fourth nodes in the block. If they are not the same, it is considered that the message consensus is wrong and there is a malicious node in the trading system.

[0127] Step C3: If the verification fails, the fourth message consensus fails.

[0128] Specifically, if the verification fails, the consensus on the fourth message fails. Further, the reasons for the consensus failure are: 1. The fourth node is a malicious node and cannot receive the fourth message. 2. The second node times out when transmitting the fourth message or the fourth node times out when receiving the fourth message, resulting in the fourth node not receiving the fourth message and being unable to verify, thus causing the verification to fail. 3. The second node is a malicious node, and the fourth message transmitted to the fourth node is maliciously tampered with or cannot be sent to the fourth node, such as Figure 2 As shown in the figure, the malicious node C2 cannot transmit messages to other nodes.

[0129] A malicious node refers to a node that engages in malicious behavior. Malicious behavior can include violations of protocol rules and undermining the security of the trading system by the second node, such as tampering with information contained in messages or sending a large number of invalid messages.

[0130] Optionally, after the fourth message consensus fails, steps D1-D3 are included:

[0131] Step D1: The first node receives the fifth message sent by the second node; the fifth message is used to indicate whether the fourth message is successfully transmitted.

[0132] Specifically, after receiving the verification results fed back by all the fourth nodes, the second node sends the fifth message to the first node.

[0133] Among them, the fifth message is recorded as a reply message.

[0134] Step D2: The first node determines the fifth message quantity.

[0135] Specifically, the first node counts the received fifth messages to obtain the number of fifth messages.

[0136] Step D3: If the fifth number of messages meets the second preset number of messages, the current round of message consensus is completed.

[0137] Specifically, if the number of fifth messages received by the first node is the same as the second preset number of messages, the message consensus for the current round is complete. If the number of fifth messages received by the first node is different from the second preset number of messages, then a node in the current round failed to synchronize the operation information for modifying resource information.

[0138] Optionally, after the current round of message consensus is completed, steps E1-E2 are included:

[0139] Step E1: Determine the transmission status of the second node; the transmission status is used to indicate whether the second node can complete message transmission in the current round of message consensus.

[0140] Specifically, determine the message sending and receiving status of each second node in the current message consensus round. If the second node can complete all message transmissions and message receptions, the transmission status is that the transmission can be completed; if the second node has a failed message transmission or message reception, the transmission status is that the transmission cannot be completed.

[0141] Furthermore, message transmission or reception failures include message sending timeouts, second node failures, and malicious behavior. Malicious behavior can include violations of protocol rules by the second node that undermine the security of the trading system, such as tampering with information contained in messages or sending a large number of invalid messages.

[0142] Step E2: If the transmission status is that the transmission can be completed, a second value is superimposed on the first value; the first value can represent the quantitative score of the historical transmission status of the second node; the second value is the quantitative score of the current round of transmission status.

[0143] The second value is a fixed value.

[0144] The first value is composed of the quantitative scores of the performance information and attribute information of the second node and the quantitative scores of the historical message transmission of the second node. The first value can represent the trustworthiness of the second node when transmitting messages, that is, whether the second node is usable.

[0145] Specifically, if the transmission condition is that the transmission can be completed, a second value is determined, the second value is superimposed on the first value to obtain a third value, and the third value is saved in the node database.

[0146] Step E3: If the transmission status is that the transmission cannot be completed, clear the first value and re-register the second node.

[0147] Specifically, if the transmission condition is that the transmission can be completed, the first value is cleared, and the second node is re-registered at the first node.

[0148] Furthermore, after evaluating the transmission status of the second node, the third node can also be evaluated. That is, if the third node can successfully receive the message sent by the second node and can successfully synchronize the operation information for changing the resource information contained in the message, the fifth value is obtained.

[0149] The fifth value is a quantified score of the information synchronization status of the third node, and is also a fixed value.

[0150] The above steps evaluate the transmission status of the nodes, which is conducive to increasing the credibility of the nodes to ensure the security of data transmission while also improving the fault tolerance and risk resistance of the transaction system.

[0151] The technical solution of this embodiment is to receive a first message from a first node; verify the first message, and send a second message to a third node based on the verification result; verify the first message to ensure that when the first node fails, it can be replaced in time; after verification, the second message is sent to ensure the security of message transmission; receive a third message and determine the number of third messages; generate an information sending instruction based on the number of third messages and the first preset number of messages, which can improve the fault tolerance of the entire blockchain network while also improving the efficiency of message transmission; transmit a fourth message to a fourth node based on the information sending instruction, which can achieve one-time sending of the fourth message, reducing the number of message transmissions while also improving transmission efficiency. This method can reduce the number of communications in the message consensus process through message transmission and verification of multiple nodes, optimize the performance of the entire blockchain network within the transaction system, and improve the risk resistance of the entire blockchain network.

[0152] Figure 3 This is a structural diagram of a message consensus device provided by an embodiment of the present invention. This embodiment is applicable to the situation where the transaction information generated in the transaction system is synchronized with the entire blockchain network. The message consensus device can be implemented in the form of hardware and / or software, and the message consensus device can be configured in any electronic device with network communication function. Figure 3 As shown, the device includes: a first message receiving module 210, a second message sending module 220, a third message receiving module 230, an information sending instruction generating module 240 and a message transmission module 250, wherein:

[0153] First message receiving module 210: used to receive a first message from a first node; the first message includes operation information for changing resource information; the first node is used to receive the operation information for changing resource information and coordinate the consensus process of the operation information for changing resource information;

[0154] Second message sending module 220: used to verify the first message and send a second message to the third node based on the verification result; the second message is used to indicate the verification of the third node status and to feed back the third message to the second node; the second node is a node selected for communication based on a preset energy threshold and a preset evaluation mechanism; the preset energy threshold is a threshold for node energy consumption; the preset evaluation mechanism is to evaluate whether a node can be used as a second node based on the node's attribute information, performance information, and historical transmission status; the node is a device within the trading system;

[0155] The third message receiving module 230 is used to receive a third message and determine the number of third messages; the third message is a feedback message sent by the third node to the second message;

[0156] An information sending instruction generating module 240 is configured to generate an information sending instruction according to the third message quantity and the first preset message quantity;

[0157] Message transmission module 250: used to transmit a fourth message to the fourth node according to the information sending instruction; the fourth message includes operation information for changing resource information.

[0158] Optionally, the first message receiving module 210 includes:

[0159] an energy consumption determining unit, configured to determine a first energy consumption of a fifth node; the fifth node being a node to be screened by the second node; the first energy consumption being the total energy consumed by the fifth node for message transmission and operation within a preset time period;

[0160] an information determining unit, configured to determine attribute information and performance information of the fifth node; the performance information being used to characterize a message transmission capability of the fifth node;

[0161] A state evaluation unit is used to determine the state of the fifth node based on the attribute information, the performance information and the preset evaluation requirements; the state of the fifth node is used to indicate whether the fifth node is available;

[0162] a second node determining unit, configured to screen the fifth node according to the fifth node state and the first energy consumption to obtain a second node;

[0163] Optionally, the energy consumption determination unit is specifically configured to:

[0164] Determine a second energy consumption and a third energy consumption of the fifth node; the second energy consumption is the energy consumption generated when the fifth node is running; the third energy consumption is the energy consumption generated when the fifth node transmits a message;

[0165] The first energy consumption is determined according to the second energy consumption and the third energy consumption.

[0166] Optional message consensus device, including:

[0167] Verification module: used for the fourth node to verify the fourth message after receiving the fourth message;

[0168] Information saving module: used for saving the operation information of changing the resource information in the fourth message if the verification is successful, and sending a content verification success message to the second node;

[0169] Consensus failure module: used to indicate that the fourth message consensus fails if verification fails.

[0170] Optional message consensus device, including:

[0171] A fifth message receiving module: configured for the first node to receive a fifth message sent by the second node; the fifth message is used to indicate whether the fourth message is successfully transmitted;

[0172] A fifth message quantity determining module: configured for the first node to determine the fifth message quantity;

[0173] Consensus completion module: used to complete the current round of message consensus if the fifth message quantity meets the second preset message quantity.

[0174] Optional message consensus device, including:

[0175] Transmission status determination module: used to determine the transmission status of the second node; the transmission status is used to indicate whether the second node can complete the message transmission in the current round of message consensus;

[0176] A value determination module is configured to superimpose a second value on the first value if the transmission condition indicates that the transmission can be completed; the first value is a quantitative score of the second node's historical transmission condition; and the second value is a quantitative score of the current round of transmission condition.

[0177] Registration module: used for clearing the first value and re-registering the second node if the transmission situation is that the transmission cannot be completed.

[0178] The message consensus device provided in the embodiment of the present invention can execute the message consensus method provided in any embodiment of the present invention described above, and has the corresponding functions and beneficial effects of executing the message consensus method. For detailed processes, please refer to the relevant operations of the message consensus method in the aforementioned embodiment.

[0179] Figure 4 A schematic diagram of the structure of an electronic device for implementing the message consensus method of an embodiment of the present invention. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0180] like Figure 4 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., which is communicatively connected to the at least one processor 11. The memory stores a computer program that can be executed by the at least one processor. The processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 into the random access memory (RAM) 13. Various programs and data required for the operation of the electronic device 10 can also be stored in the RAM 13. The processor 11, ROM 12, and RAM 13 are connected to each other via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0181] Multiple components in the electronic device 10 are connected to the I / O interface 15, including an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a magnetic disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.

[0182] The processor 11 can be any general-purpose and / or specialized processing component with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various specialized artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as the message consensus method.

[0183] In some embodiments, the message consensus method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the message consensus method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform the message consensus method in any other appropriate manner (e.g., by means of firmware).

[0184] Various embodiments of the systems and techniques described herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system-on-chip systems (SOCs), programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system comprising at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0185] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when the computer program is executed by the processor, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The computer program may be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0186] In the context of the present invention, computer-readable storage media can be tangible media that can contain or store a computer program for use with an instruction execution system, device or equipment or used in combination with an instruction execution system, device or equipment. Computer-readable storage media can include but are not limited to electronic, magnetic, optical, electromagnetic, infrared or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, computer-readable storage media can be machine-readable signal media. More specific examples of machine-readable storage media can include electrical connections based on one or more lines, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0187] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0188] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0189] A computing system may include clients and servers. The clients and servers are typically remote from each other and typically interact via a communication network. This client-server relationship arises through computer programs running on the respective computers, creating a client-server relationship. The server may be a cloud server, also known as a cloud computing server or cloud host. This server is a hosting product within the cloud computing service ecosystem that addresses the management difficulties and limited scalability of traditional physical hosting and VPS services.

[0190] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in the present invention can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solution of the present invention can be achieved. This is not limited herein.

[0191] The above specific embodiments do not limit the scope of protection of the present invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention are intended to be included within the scope of protection of the present invention.< / synchronize>

Claims

1. A message consensus method, characterized in that: include: receiving a first message from a first node; The first message includes operation information for changing resource information; The first node is used to receive operation information for changing resource information and coordinate the consensus process of the operation information for changing resource information; Verify the first message and send a second message to the third node based on the verification result; the second message is used to instruct the verification of the third node status and feedback the third message to the second node; The second node is a node for communication selected according to a preset energy threshold and a preset evaluation mechanism; the preset energy threshold is a threshold for node energy consumption; The preset evaluation mechanism is to evaluate whether a node can be used as a second node based on the node's attribute information, performance information, and historical transmission status; the node is a device within the transaction system; receiving a third message and determining the number of third messages; the third message being a feedback message sent by the third node to the second message; Generate an information sending instruction according to the third message quantity and the first preset message quantity; A fourth message is transmitted to the fourth node according to the information sending instruction; the fourth message includes operation information for changing the resource information.

2. The method according to claim 1, characterized in that At least one method for determining the second node includes: Determining a first energy consumption of a fifth node; the fifth node is a node to be screened by the second node; the first energy consumption is the total energy consumed by the fifth node for message transmission and operation within a preset time period; Determining attribute information and performance information of the fifth node; the performance information is used to characterize the message transmission capability of the fifth node; determining a fifth node state according to the attribute information, the performance information, and a preset evaluation requirement; the fifth node state being used to indicate whether the fifth node is usable; The fifth node is screened according to the fifth node state and the first energy consumption to obtain a second node.

3. The method according to claim 2, characterized in that The determining the first energy consumption of the fifth node includes: Determine a second energy consumption and a third energy consumption of the fifth node; the second energy consumption is the energy consumption generated when the fifth node is running; the third energy consumption is the energy consumption generated when the fifth node transmits a message; A first energy consumption is determined according to the second energy consumption and the third energy consumption.

4. The method according to claim 1, wherein After transmitting the fourth message to the fourth node according to the information sending instruction, the method includes: After receiving the fourth message, the fourth node verifies the fourth message; If the verification is successful, the operation information of changing the resource information in the fourth message is saved, and a content verification success message is sent to the second node; If the verification fails, the fourth message consensus fails.

5. The method according to claim 4, characterized in that After the fourth message consensus fails, including: The first node receives a fifth message sent by the second node; the fifth message is used to indicate whether the fourth message is successfully transmitted; The first node determines the fifth message quantity; If the fifth number of messages meets the second preset number of messages, the current round of message consensus is completed.

6. The method according to claim 5, characterized in that After the current round of message consensus is completed, it includes: Determine the transmission status of the second node; the transmission status is used to indicate whether the second node can complete message transmission in the current round of message consensus; If the transmission condition is that the transmission can be completed, a second value is superimposed on the first value; the first value is the quantized score of the historical transmission condition of the second node; the second value is the quantized score of the current round of transmission condition; If the transmission condition is that the transmission cannot be completed, the first value is cleared and the second node is re-registered.

7. A message consensus device, characterized in that: include: A first message receiving module, configured to receive a first message from a first node; The first message includes operation information for changing resource information; The first node is used to receive operation information for changing resource information and coordinate the consensus process of the operation information for changing resource information; a second message sending module, configured to verify the first message and send a second message to the third node based on the verification result; the second message is used to instruct the verification of the third node status and to feed back the third message to the second node; The second node is a node for communication selected according to a preset energy threshold and a preset evaluation mechanism; the preset energy threshold is a threshold for node energy consumption; The preset evaluation mechanism is to evaluate whether a node can be used as a second node based on the node's attribute information, performance information, and historical transmission status; the node is a device within the transaction system; a third message receiving module, configured to receive a third message and determine the number of third messages; the third message being a feedback message sent by the third node to the second message; An information sending instruction generating module, configured to generate an information sending instruction according to the third message quantity and the first preset message quantity; The message transmission module is used to transmit a fourth message to the fourth node according to the information sending instruction; the fourth message includes operation information for changing resource information.

8. The device according to claim 7, characterized in that The first message receiving module includes: an energy consumption determining unit, configured to determine a first energy consumption of a fifth node; the fifth node being a node to be screened by the second node; the first energy consumption being the total energy consumed by the fifth node for message transmission and operation within a preset time period; an information determining unit, configured to determine attribute information and performance information of the fifth node; the performance information being used to characterize a message transmission capability of the fifth node; a state evaluation unit, configured to determine a fifth node state based on the attribute information, the performance information, and a preset evaluation requirement; the fifth node state being used to indicate whether the fifth node is usable; The second node determining unit is configured to screen the fifth node according to the fifth node state and the first energy consumption to obtain a second node.

9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the message consensus method according to any one of claims 1 to 6.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the message consensus method according to any one of claims 1 to 6 when executed.