Consensus method, device and server suitable for power equipment data chaining
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- GUIZHOU POWER GRID CO LTD
- Filing Date
- 2022-09-20
- Publication Date
- 2026-08-07
AI Technical Summary
[0006]有鉴于此,本申请实施例中提供了一种适用于电力设备数据上链的共识方法、装置、服务器和计算机可读存储介质,以克服现有技术上链效率低的问题
[0021]本申请实施例提供的适用于电力设备数据上链的共识方法、装置、服务器和计算机可读存储介质,接收区块链中领导节点广播的交易集的摘要;根据交易集的摘要确定是否缺少交易;在缺少交易时,从领导节点索取缺少的交易,以形成完整交易集;将完整交易集的摘要广播至区块链中的各普通节点,以供各普通节点进行交易集共识;收集各普通节点广播的交易集投票,在达到法定人数条件时,完成出块。
Smart Images

Figure CN115827772B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, specifically to a consensus method, apparatus, server, and computer-readable storage medium suitable for uploading data from power equipment to the blockchain. Background Technology
[0002] Metering and certification of energy data is a crucial foundation for the openness and fairness of the energy internet. A key step in traditional electricity data metering and certification schemes is uploading data from power equipment to centralized facilities for collection, statistics, and calculation. This traditional approach lacks a transparent and traceable technological means, failing to guarantee that the data will not be tampered with. Therefore, providing certification and assurance services for electricity energy metering data, ensuring both data security and reliability, and guaranteeing its credibility and authority, is of paramount importance.
[0003] Blockchain's decentralized data storage architecture and technology inherently possess transparency and traceability, making it highly suitable for applications requiring centralized third-party organizations and guarantees, such as the metering, authentication, and exchange of electricity data. Blockchain's mechanism enables trust and self-organization, which is of great significance for the development of multi-party collaboration in future energy systems. Consensus is the core issue of blockchain's distributed computing. In a blockchain system, consensus is the process by which nodes agree on the results and order of transaction execution. Blockchain consensus algorithms can be broadly categorized into two types: consensus algorithms between trustless nodes and consensus algorithms between trusted nodes.
[0004] The commonly used consensus algorithm is PBET, and PBFT can achieve consensus even in scenarios where a few nodes act maliciously. It uses cryptographic algorithms such as signature verification and hashing to ensure tamper-proof, forgery-proof, and non-repudiation during message transmission. PBFT is a deterministic consensus algorithm that does not produce forks. All nodes operate under the same configuration, with one leader node and other nodes acting as ordinary nodes. The leader node is responsible for ordering client requests and sending them to the ordinary nodes in sequence.
[0005] However, for power equipment data to be uploaded to the blockchain, it is characterized by a large amount of data, a short data upload cycle, and a high upload frequency. The traditional PBFT consensus algorithm can no longer meet the performance requirements and needs to be further improved to enhance consensus efficiency. Summary of the Invention
[0006] In view of this, this application provides a consensus method, apparatus, server, and computer-readable storage medium suitable for uploading power equipment data to the blockchain, so as to overcome the problem of low uploading efficiency in the prior art.
[0007] In a first aspect, embodiments of this application provide a consensus method suitable for uploading data from power equipment to the blockchain, the method comprising:
[0008] Receive a summary of the transaction set broadcast by the leader node in the blockchain;
[0009] Determine whether a transaction is missing based on the summary of the transaction set;
[0010] When a transaction is missing, the missing transaction is retrieved from the leader node to form a complete transaction set;
[0011] The summary of the complete transaction set is broadcast to each ordinary node in the blockchain so that the ordinary nodes can reach a consensus on the transaction set.
[0012] Collect the transaction set votes broadcast by each of the aforementioned ordinary nodes, and complete the block production when the quorum requirement is met.
[0013] Secondly, embodiments of this application provide a consensus device suitable for uploading data from power equipment to the blockchain, the device comprising:
[0014] The digest receiving module is used to receive the digest of the transaction set broadcast by the leader node in the blockchain;
[0015] A missing transaction determination module is used to determine whether a transaction is missing based on a summary of the transaction set;
[0016] The transaction retrieval module is used to retrieve missing transactions from the leader node when transactions are missing, in order to form a complete transaction set;
[0017] The broadcast module is used to broadcast a summary of the complete transaction set to each ordinary node in the blockchain, so that the ordinary nodes can reach a consensus on the transaction set.
[0018] The transaction voting module is used to collect transaction votes broadcast by each of the ordinary nodes, and complete block production when the quorum requirement is met.
[0019] Thirdly, embodiments of this application provide a server, including: a memory; one or more processors coupled to the memory; and one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, and the one or more applications are configured to execute the consensus method for on-chain data of power equipment provided in the first aspect above.
[0020] Fourthly, embodiments of this application provide a computer-readable storage medium storing program code, which can be called by a processor to execute the consensus method for on-chain data of power equipment provided in the first aspect.
[0021] The consensus method, apparatus, server, and computer-readable storage medium provided in this application embodiment for on-chain data of power equipment receive a summary of a transaction set broadcast by a leader node in the blockchain; determine whether a transaction is missing based on the summary of the transaction set; if a transaction is missing, retrieve the missing transaction from the leader node to form a complete transaction set; broadcast the summary of the complete transaction set to each ordinary node in the blockchain for each ordinary node to reach a consensus on the transaction set; collect votes on the transaction set broadcast by each ordinary node, and complete the block production when the quorum condition is met.
[0022] The consensus method for on-chain data of power equipment provided in this application embodiment only sends a summary of the transaction set during consensus, and does not send the actual content of the transaction, which greatly reduces the amount of data transmission and transmission time, and improves the efficiency of consensus. Attached Figure Description
[0023] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0024] Figure 1 A schematic diagram illustrating an application scenario for the consensus method for uploading power equipment data to the blockchain, as provided in the embodiments of this application;
[0025] Figure 2 A flowchart illustrating a consensus method for uploading data from power equipment to the blockchain, provided as an embodiment of this application;
[0026] Figure 3 This is a schematic diagram of a SHA-MAP tree structure provided in one embodiment of this application;
[0027] Figure 4 This is a schematic diagram of the structure of a consensus device for uploading data from power equipment to the blockchain, provided in one embodiment of this application.
[0028] Figure 5 This is a schematic diagram of the structure of a server provided in one embodiment of this application;
[0029] Figure 6 This is a schematic diagram of the structure of a computer-readable storage medium provided in one embodiment of this application. Detailed Implementation
[0030] The technical solutions in the embodiments of this application will be clearly and completely described below. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0031] To provide a more detailed description of this application, the following description, in conjunction with the accompanying drawings, details a consensus method, apparatus, server, and computer-readable storage medium applicable to on-chain data from power equipment.
[0032] Please refer to Figure 1 , Figure 1 This diagram illustrates an application scenario (i.e., a blockchain system architecture) for the consensus method for on-chain data storage of power equipment provided in this application embodiment. This application scenario includes the blockchain system provided in this application embodiment, which comprises multiple nodes 102. Each node 102 can be implemented as a server, server group, or terminal device with blockchain software installed, or as a distributed processing system composed of various such devices. Nodes 102 communicate with each other via a peer-to-peer network to send and receive information. A peer-to-peer (P2P) network, also known as a peer-to-peer network, is an internet system without a central server, relying on a group of users (peers) to exchange information. Its purpose is to reduce the number of nodes in traditional network transmission, thereby reducing the risk of data loss. Unlike centralized network systems with a central server, each user in a peer-to-peer network is both a node and can also function as a server.
[0033] The terminal device can be any electronic device with a display screen, including but not limited to smartphones and computer devices. The computer device can be at least one of desktop computers, portable computers, laptop computers, tablet computers, personal computers, etc. Those skilled in the art will understand that the number of terminal devices can be more or less. For example, there may be only a few, or dozens or hundreds, or even more terminal devices. This application does not limit the number or type of terminal devices.
[0034] It should be noted that although the node 102 shown in the above example appears as a physical device such as a server or terminal device, these physical devices are actually just carriers. They mainly realize the functions of node 102 by installing and running blockchain software programs, such as implementing the consensus mechanism between nodes 102. Therefore, there is no need to restrict the type of physical device.
[0035] Furthermore, nodes can be multi-core terminal devices. The blockchain system includes one leader node and multiple ordinary nodes, where the leader node can broadcast transaction sets to the ordinary nodes. Ordinary nodes can execute a consensus method for on-chaining power equipment data provided in this application embodiment.
[0036] Based on this, this application provides a consensus method suitable for uploading power equipment data to the blockchain. Please refer to... Figure 2 , Figure 2 This illustration shows a flowchart of a consensus method for uploading data from power equipment to the blockchain, as provided in an embodiment of this application. Figure 1 Taking a server (i.e., a regular node) as an example, the explanation includes the following steps:
[0037] Step S110: Receive a summary of the transaction set broadcast by the leader node in the blockchain.
[0038] Specifically, a blockchain contains leader nodes and ordinary nodes. Leader nodes are mainly used to continuously extract transactions from the transaction pool; and after determining that the transaction set has met the broadcasting conditions, they start to propose their own transaction set and broadcast the summary of the transaction set to other ordinary nodes.
[0039] In one embodiment, before receiving a summary of the transaction set broadcast by the leader node in the blockchain, the process includes: collecting transactions from each client and placing the collected transactions in a transaction pool for the leader node to extract the transaction set from the transaction pool, and broadcasting a summary of the transaction set after the broadcast conditions are met.
[0040] The client can be a channel through which users, equipment manufacturers, power supply bureaus, and other users submit transactions.
[0041] The transaction mainly includes relevant data such as the equipment's asset code, inspection time, and operating time.
[0042] Specifically, each ordinary node in the blockchain collects transactions from the client and places the collected transactions in the transaction pool; the leader node continuously extracts transactions from the transaction pool; after the leader node determines that the transaction set has met the broadcasting conditions, it starts to propose its own transaction set and broadcasts the summary of the transaction set to other nodes.
[0043] Step S120: Determine whether any transactions are missing based on the summary of the transaction set.
[0044] In one embodiment, the summary of the transaction set includes the root summary of a SHA-MAP tree, which is a tree formed by fusing a radix tree and a Merkle tree; determining whether a transaction is missing based on the summary of the transaction set includes: determining whether a transaction is missing based on the root summary of the SHA-MAP tree.
[0045] In one embodiment, the SHA-MAP tree includes a multi-level structure, where nodes in each level are called subtree nodes. Determining whether a transaction is missing based on the root digest of the SHA-MAP tree includes: searching a pre-configured database for the existence of a root entity of the SHA-MAP tree based on the root digest; if the root entity is not found, requesting to obtain the root entity from ordinary nodes; based on the root entity, detecting each subtree node separately and recording the digest of each subtree node; and determining whether a transaction is missing based on the digest of each subtree node.
[0046] In one embodiment, each layer of the structure includes a tree node and several leaf nodes, or several leaf nodes; the tree node and several leaf nodes in the next layer of the structure are respectively connected to the tree node in the previous layer, and the tree node and leaf node in each layer of the structure are called child tree nodes; the tree node in each layer of the structure is the parent tree node of the tree node in the next layer of the structure, and is also the child tree node of the tree node in the previous layer of the structure; wherein, the summary of the transaction set is the index of each leaf node, the summary of a transaction is the index of a leaf node, and the collection of summaries of all child tree nodes is the index of the parent tree node.
[0047] In one embodiment, based on the root entity, each subtree node is detected and a summary of each subtree node is recorded, including: when the subtree node is a leaf node, the existence of the node entity is confirmed from a pre-configured database; when the subtree node is a tree node, the search for the subtree nodes of the tree node continues until the tree node cannot be found in the pre-configured database, and the summary value of the tree node that cannot be found is recorded.
[0048] Please refer to Figure 3As shown, each ordinary node constructs a SHA-MAP tree from transactions. The SHA-MAP tree combines the characteristics of radix trees and Merkle trees, with a total of multiple levels (e.g., 64 levels). It contains two types of tree nodes: tree nodes (also called internal tree nodes) and leaf nodes. A tree node can contain a maximum of several (e.g., 16) child tree nodes, while a leaf tree node cannot contain child tree nodes. Each level includes one tree node and several leaf nodes, or several leaf nodes. The tree nodes and leaf nodes in the next level are connected to the tree nodes in the previous level. The tree nodes and leaf nodes in each level are called subtree nodes. The tree node in each level is the parent tree node of the tree node in the next level and is also a child tree node of the tree node in the previous level. The transaction set digest is the index of each leaf node, the digest of a transaction is the index of a leaf node, and the summation of the digests of all child tree nodes is the index of the parent tree node. The characteristic of the SHA-MAP tree is that it can quickly locate the position of a tree node in the tree based on the index, thereby speeding up the query and modification process. When broadcasting a transaction set, the leader node only broadcasts the root digest of the SHA-MAP tree. Each consensus node then forwards, verifies, and reaches consensus on the transaction set based on this root digest.
[0049] When a node receives the root digest of the SHA-MAP tree broadcast by the leader node, the node will check its local database to see if the root entity has been stored. If it does not exist, the node will request the root entity from other nodes to form the basis of the SHA-MAP tree.
[0050] Based on the SHA-MAP tree entity, check its 16 subtree nodes one by one. If the subtree node is a leaf node, directly confirm the existence of the node entity in the pre-configured database. If the subtree node is a tree node (i.e., an internal node), continue to check the subtree nodes of this internal node, and so on, to confirm all tree nodes that cannot be found in the local database and record the digest value corresponding to the node.
[0051] Step S130: When transactions are missing, retrieve the missing transactions from the leader node to form a complete transaction set.
[0052] For tree nodes that are missing from ordinary nodes, they can be requested in batches from the leader node.
[0053] Step S140: Broadcast the summary of the complete transaction set to each ordinary node in the blockchain so that the ordinary nodes can reach a consensus on the transaction set.
[0054] In one alternative implementation, during the initial consensus phase, when ordinary nodes receive transactions, they can perform only simple verification on the transactions in the order they were received before forwarding them to all nodes connected to them on the network. For example, node A receives four transactions, Tx1-Tx4, submitted by a client in sequence. After collecting Tx1, node A performs a simple verification on it and immediately forwards it to node B. The subsequent transactions Tx2-Tx4 are processed similarly. The verification and forwarding processes for the four transactions can be parallel and independent of each other.
[0055] Step S150: Collect transaction set votes broadcast by each ordinary node, and complete block production when the quorum requirement is met.
[0056] Upon completion of block production, each ordinary node generates a verified block based on the transaction set and broadcasts it, simultaneously initiating the transaction set consensus phase for the next block. Once each ordinary node collects a quorum of verifications, the block reaches consensus.
[0057] The consensus method for on-chain data storage of power equipment provided in this application embodiment only sends a summary of the transaction set during consensus, without sending the actual transaction content, which greatly reduces the data transmission rate and improves the efficiency of consensus. Furthermore, the improved consensus algorithm involved in this application embodiment significantly reduces redundant data packets in the network compared to traditional consensus algorithms, improving network efficiency while ensuring that transaction messages reach as many nodes as possible.
[0058] In one embodiment, after retrieving missing transactions from the leader node to form a complete transaction set, the method further includes updating a pre-configured database based on the retrieved new root digest.
[0059] Specifically, when a new tree node is reached, the local database is updated, and the tree is checked again for any missing tree nodes. This process is repeated until there are no missing tree nodes in the local database.
[0060] It should be understood that, although Figure 2 The steps in the flowchart are shown sequentially as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise explicitly stated in this document, there is no strict order in which these steps are executed; they can be performed in other orders. Figure 2 At least some of the steps in the process may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least some of the sub-steps or stages of other steps.
[0061] The embodiments disclosed in this application describe in detail a consensus method suitable for uploading power equipment data to the blockchain. The above-disclosed method can be implemented using various types of devices. Therefore, this application also discloses a consensus device suitable for uploading power equipment data to the blockchain corresponding to the above method. Specific embodiments are given below for detailed description.
[0062] Please see Figure 4 This application discloses a consensus device for uploading data from power equipment to the blockchain, which mainly includes:
[0063] The digest receiving module 410 is used to receive the digest of the transaction set broadcast by the leader node in the blockchain;
[0064] The missing transaction determination module 420 is used to determine whether a transaction is missing based on a summary of the transaction set;
[0065] The transaction retrieval module 430 is used to retrieve missing transactions from the leader node to form a complete transaction set when transactions are missing.
[0066] Broadcast module 440 is used to broadcast a summary of the complete transaction set to each ordinary node in the blockchain so that the ordinary nodes can reach a consensus on the transaction set.
[0067] The transaction voting module 450 is used to collect transaction votes broadcast by each ordinary node, and complete block production when the quorum requirement is met.
[0068] In one embodiment, the transaction set summary includes the root summary of a SHA-MAP tree, which is a tree formed by fusing a radix tree and a Merkle tree; the missing transaction determination module 420 is used to determine whether a transaction is missing based on the root summary of the SHA-MAP tree.
[0069] In one embodiment, the SHA-MAP tree includes a multi-layer structure, and the nodes in each layer are called subtree nodes. The missing transaction determination module 420 is used to search in a pre-configured database for the existence of the root entity of the SHA-MAP tree based on the root digest of the SHA-MAP tree; if the root entity does not exist, it requests to obtain the root entity from ordinary nodes; based on the root entity, it detects each subtree node and records the digest of each subtree node; and determines whether a transaction is missing based on the digest of each subtree node.
[0070] In one embodiment, each layer of the structure includes a tree node and several leaf nodes, or several leaf nodes; the tree node and several leaf nodes in the next layer of the structure are respectively connected to the tree node in the previous layer, and the tree node and leaf node in each layer of the structure are called child tree nodes; the tree node in each layer of the structure is the parent tree node of the tree node in the next layer of the structure, and is also the child tree node of the tree node in the previous layer of the structure; wherein, the summary of the transaction set is the index of each leaf node, the summary of a transaction is the index of a leaf node, and the collection of summaries of all child tree nodes is the index of the parent tree node.
[0071] In one embodiment, a transaction determination module 420 is missing, which is used to confirm the existence of a node entity from a pre-configured database when the subtree node is a leaf node; and to continue searching for the subtree nodes of the tree node when the subtree node is a tree node, until the tree node cannot be found in the pre-configured database, and to record the summary value of the tree node that cannot be found.
[0072] In one embodiment, the apparatus further includes: a refinement module for retrieving missing transactions from the leader node to form a complete transaction set, and then further includes: updating a pre-configured database based on the retrieved new root digest.
[0073] In one embodiment, the apparatus further includes a transaction collection module for collecting transactions from each client and placing the collected transactions in a transaction pool for the leader node to extract a transaction set from the transaction pool and broadcast a summary of the transaction set after a broadcast condition is met.
[0074] Specific limitations regarding the consensus device applicable to on-chain data from power equipment can be found in the method limitations section above, and will not be repeated here. Each module in the aforementioned device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the server's processor in hardware form, or stored in the server's memory in software form, so that the processor can invoke and execute the corresponding operations of each module.
[0075] Please refer to Figure 5 , Figure 5 This illustration shows a structural block diagram of a server provided in an embodiment of this application. The server 50 in this application may include one or more of the following components: a processor 52, a memory 54, and one or more applications, wherein the one or more applications may be stored in the memory 54 and configured to be executed by the one or more processors 52, and the one or more applications are configured to perform the methods described in the above embodiments of the consensus method applicable to on-chain data of power equipment.
[0076] Processor 52 may include one or more processing cores. Processor 52 connects to various parts of the server 50 using various interfaces and lines, and performs various functions and processes data of the server 50 by running or executing instructions, programs, code sets, or instruction sets stored in memory 54, and by calling data stored in memory 54. Optionally, processor 52 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). Processor 52 may integrate one or a combination of several of the following: Central Processing Unit (CPU), Graphics Processing Unit (GPU), and modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the displayed content; and the modem handles wireless communication. It is understood that the modem may also not be integrated into processor 52 and may be implemented separately using a communication chip.
[0077] The memory 54 may include random access memory (RAM) or read-only memory (ROM). The memory 54 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 54 may include a program storage area and a data storage area. The program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as touch functionality, sound playback functionality, image playback functionality, etc.), and instructions for implementing the various method embodiments described below. The data storage area may also store data created by the server 50 during use.
[0078] Those skilled in the art will understand that Figure 5 The structure shown is merely a block diagram of a portion of the structure related to the solution of this application and does not constitute a limitation on the server to which the solution of this application is applied. A specific server may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0079] In summary, the server provided in this application embodiment is used to implement the corresponding consensus method for power equipment data on-chain in the foregoing method embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0080] Please see Figure 6This diagram illustrates a structural block diagram of a computer-readable storage medium provided in an embodiment of this application. The computer-readable storage medium 60 stores program code, which can be called by a processor to execute the methods described in the above embodiments of the consensus method applicable to on-chain data from power equipment.
[0081] The computer-readable storage medium 60 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read-Only Memory), EPROM, hard disk, or ROM. Optionally, the computer-readable storage medium 60 includes a non-transitory computer-readable storage medium. The computer-readable storage medium 60 has storage space for program code 62 that performs any of the method steps described above. This program code can be read from or written to one or more computer program products. The program code 62 may be compressed, for example, in a suitable form.
[0082] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.
[0083] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A consensus method suitable for on-chain data from power equipment, characterized in that, The method includes: Receive a summary of the transaction set broadcast by the leader node in the blockchain; Determine whether a transaction is missing based on the summary of the transaction set; When a transaction is missing, the missing transaction is retrieved from the leader node to form a complete transaction set; The summary of the complete transaction set is broadcast to each ordinary node in the blockchain so that the ordinary nodes can reach a consensus on the transaction set. Collect the transaction set votes broadcast by each of the aforementioned ordinary nodes, and complete the block production when the quorum requirement is met; The transaction set summary includes the root summary of a SHA-MAP tree, which is a tree formed by fusing a radix tree and a Merkle tree; determining whether a transaction is missing based on the transaction set summary includes: Determine whether a transaction is missing based on the root digest of the SHA-MAP tree; The SHA-MAP tree comprises a multi-level structure, where nodes in each level are called subtree nodes; determining whether a transaction is missing based on the root digest of the SHA-MAP tree includes: Based on the root digest of the SHA-MAP tree, search in a pre-configured database for the existence of the root entity of the SHA-MAP tree; If the root entity does not exist, request to obtain the root entity from the ordinary node; Based on the root entity, each subtree node is detected and a summary of each subtree node is recorded; Determine whether a transaction is missing based on the summary of each subtree node.
2. The method according to claim 1, characterized in that, Each layer of the structure includes a tree node and several leaf nodes, or several leaf nodes; the tree node and several leaf nodes in the next layer of the structure are respectively connected to the tree node in the previous layer, and the tree node and leaf node in each layer of the structure are called subtree nodes. The tree node of each layer of structure is the parent tree node of the tree node in the next layer of structure, and is also the child tree node of the tree node in the previous layer of structure. The transaction set's summary is the index of each leaf node, a transaction's summary is the index of a leaf node, and the summation of all child tree nodes' summaries is the index of the parent tree node.
3. The method according to claim 2, characterized in that, Based on the root entity, each subtree node is detected and a summary of each subtree node is recorded, including: When the subtree node is a leaf node, the existence of the node entity is confirmed from the pre-configured database; When the subtree node is a tree node, continue searching for the subtree nodes of the tree node until no tree node can be found in the pre-configured database, and record the summary value of the tree node that cannot be found.
4. The method according to claim 3, characterized in that, After retrieving the missing transactions from the leader node to form a complete transaction set, the process also includes: Update the pre-configured database based on the new root summary obtained.
5. The method according to any one of claims 1-4, characterized in that, Before receiving the summary of the transaction set broadcast by the leader node in the blockchain, the process includes: Transactions are collected from each client and placed in a transaction pool for the leader node to extract transaction sets from the pool and broadcast a summary of the transaction sets upon meeting broadcast conditions.
6. A consensus device suitable for on-chain data upload of power equipment, characterized in that, The device includes: The digest receiving module is used to receive the digest of the transaction set broadcast by the leader node in the blockchain; A missing transaction determination module is used to determine whether a transaction is missing based on a summary of the transaction set; The transaction retrieval module is used to retrieve missing transactions from the leader node when transactions are missing, in order to form a complete transaction set; The broadcast module is used to broadcast a summary of the complete transaction set to each ordinary node in the blockchain, so that the ordinary nodes can reach a consensus on the transaction set. The transaction voting module is used to collect transaction set votes broadcast by each of the ordinary nodes, and complete block production when the quorum requirement is met. The transaction set summary includes the root summary of the SHA-MAP tree, which is a tree formed by fusing a radix tree and a Merkle tree; the missing transaction determination module is used to determine whether there are missing transactions based on the root summary of the SHA-MAP tree; The SHA-MAP tree includes a multi-layer structure, and the nodes in each layer are called subtree nodes. The missing transaction determination module is used to search in a pre-configured database for the existence of a root entity of the SHA-MAP tree based on the root digest of the SHA-MAP tree; if the root entity does not exist, it requests the root entity from the ordinary nodes; based on the root entity, it detects each subtree node and records the digest of each subtree node; and determines whether a transaction is missing based on the digest of each subtree node.
7. A server, characterized in that, include: Memory; One or more processors are coupled to the memory; One or more applications, wherein the one or more applications are stored in memory and configured to be executed by one or more processors, and the one or more applications are configured to perform the method as described in any one of claims 1-5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium contains program code that can be invoked by a processor to execute the method as described in any one of claims 1-5.
Citation Information
Patent Citations
Byzantine fault-tolerant alliance chain consensus method and system for power consumption information protection and storage medium
CN111612455A
Transaction broadcasting method and system
CN113438092A