Transaction security protection method and device based on double-layer block chain structure

By adopting a two-layer blockchain structure in the smart grid and using aggregation chain to centrally manage and verify transaction data of shard chains, the problems of low management efficiency and insufficient security protection in the smart grid are solved, and efficient management and secure transactions are achieved.

CN119603319AActive Publication Date: 2025-03-11SHANTOU UNIV
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202411456228.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-18
Publication Date
2025-03-11
Estimated Expiration
2044-10-18

AI Technical Summary

Technical Problem

In smart grids, due to the increase in the number of terminal devices, management efficiency is low; at the same time, the centralized management method of blockchain's central nodes is insufficient in data transactions, which hinders the stable and efficient development of smart grids.

Method used

The two-layer blockchain structure is adopted, including an aggregation chain and multiple shard chains that operate independently of each other. The shard chain is centrally managed through the aggregation chain, improving the scalability of the blockchain, and ensuring the correctness and security of transaction data through correctness checksum security verification.

Benefits of technology

It improves the management efficiency of the smart grid and the security of transaction data, reduces the configuration requirements of terminal equipment, and improves the scalability and overall operation of the blockchain.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119603319A_ABST
    Figure CN119603319A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of smart power grids, in particular to a transaction security protection method and device based on a double-layer block chain structure. The method comprises the following steps: receiving a first consensus result sent by a first target fragment chain; performing correctness verification on the block based on the identification information to obtain a first verification result of the block; performing security verification on the block based on the account transaction data and the account book data to obtain a second verification result of the block; when both the first verification result and the second verification result are correct, generating a second consensus result corresponding to the first consensus result; and sending the second consensus result to the second target fragment chain, so that the second target fragment chain executes the target transaction operation according to the second consensus result. According to the method and the device, the technical effects of correctness, integrity and security of data transaction between the fragment chains can be ensured on the basis of a double-layer block chain structure.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of smart grid technology, and in particular to a transaction security protection method and device based on a double-layer blockchain structure. Background Art

[0002] Smart grid is the development direction of the transformation of traditional power grid. This concept involves communication technology, new power systems and various advanced metering, control and management systems, which can be used to improve the utilization rate and efficiency of renewable energy. However, with the increasing number of terminal devices connected to the power grid, it is difficult for power companies to manage a large number of nodes, resulting in low management efficiency. At the same time, power companies rely on the centralized management of the central node of the blockchain, which is prone to insufficient security protection during data transactions, hindering the stable and efficient development of smart grids. Summary of the invention

[0003] The present application provides a transaction security protection method and device based on a double-layer blockchain structure to solve one or more technical problems existing in the prior art and at least provide a beneficial choice or create conditions.

[0004] Other features and advantages of the present application will become apparent from the following detailed description, or may be learned in part by the practice of the present application.

[0005] According to one aspect of an embodiment of the present application, a transaction security protection method based on a double-layer blockchain structure is provided, wherein the double-layer blockchain structure includes an aggregate chain and a plurality of shard chains that operate independently of each other, wherein the aggregate chain stores the ledger data of each shard chain; the method is executed on the aggregate chain, and the method includes: Receive a first consensus result sent from a first target shard chain, where the first consensus result includes a block and account transaction data bound to the block, and the block carries identification information for verification; Performing a correctness check on the block based on the identification information to obtain a first verification result of the block; Performing security verification on the block based on the account transaction data and the ledger data to obtain a second verification result of the block; When both the first verification result and the second verification result are correct, generating a second consensus result corresponding to the first consensus result, wherein the second consensus result includes the verified block and the account transaction data; The second consensus result is sent to the second target shard chain so that the second target shard chain executes the target transaction operation according to the second consensus result.

[0006] In one embodiment of the present application, based on the above-mentioned solution, the identification information is a transaction root for identification, and the correctness verification of the block based on the identification information to obtain the first verification result of the block includes: Comparing the hash value of the transaction root with a preset reference hash value; If the hash value of the transaction root is consistent with the reference hash value, determining that the first verification result is correct; If the hash value of the transaction root is inconsistent with the reference hash value, the first verification result is determined to be wrong.

[0007] In one embodiment of the present application, based on the above scheme, the account transaction data includes the account transaction deduction amount and the account balance of the target node associated with the block in the first target shard chain, and the ledger data includes the account balance data of each node in each of the shard chains; the security verification of the block based on the account transaction data and the ledger data to obtain the second verification result of the block includes: Determine the total account balance of the target node before the transaction based on the sum of the account transaction deduction amount and the account balance; Comparing the total account balance with the target account balance data corresponding to the target node in the ledger data, and if the comparison is consistent, determining that the second verification result is correct; If the comparison is inconsistent, the second verification result is determined to be wrong.

[0008] In one embodiment of the present application, based on the above solution, the method further includes: Obtaining the historical reputation value of the target node corresponding to the block; Calculating the reputation value of the target node after the correctness check and the security verification based on a preset reputation value calculation formula, a positive evaluation index, and a negative evaluation index; The positive evaluation index and the negative evaluation index are both related to the first verification result and the second verification result.

[0009] In one embodiment of the present application, based on the above solution, after calculating the reputation value of the target node after the correctness check and the security verification, the method further includes: If the reputation value is lower than the preset reputation reference value, the target node is determined to be a risky node, and risk warning information corresponding to the risky node is sent to the first target shard chain, so that the master node in the first target shard chain can isolate the risky node according to the risk warning information.

[0010] According to one aspect of an embodiment of the present application, a transaction security protection device based on a double-layer blockchain structure is also provided, wherein the double-layer blockchain structure includes an aggregate chain and a plurality of shard chains that operate independently of each other, wherein the aggregate chain stores the ledger data of each shard chain; the device is applied to the aggregate chain, and the device includes: A receiving unit, configured to receive a first consensus result sent from a first target shard chain, wherein the first consensus result includes a block and account transaction data bound to the block, and the block carries identification information for verification; A verification unit, configured to perform a correctness verification on the block based on the identification information to obtain a first verification result of the block; A verification unit, configured to perform security verification on the block based on the account transaction data and the ledger data to obtain a second verification result of the block; A consensus unit, configured to generate a second consensus result corresponding to the first consensus result when both the first verification result and the second verification result are correct, wherein the second consensus result includes the verified block and the account transaction data; A sending unit is used to send the second consensus result to the second target shard chain, so that the second target shard chain performs the target transaction operation according to the second consensus result.

[0011] According to one aspect of an embodiment of the present application, a transaction security protection method based on a double-layer blockchain structure is also provided, wherein the double-layer blockchain structure includes an aggregate chain and a plurality of independently running shard chains, wherein the aggregate chain stores the ledger data of each shard chain; the method is executed on a first target shard chain, and the method includes: If the transaction operation information sent by the target node is received, a corresponding block and account transaction data of the target node bound to the block are generated based on the transaction operation information; If the first consensus result generated by the master node in the first target shard chain is obtained, the first consensus result is sent to the aggregation chain, so that the aggregation chain performs correctness verification and security verification on the block and the account transaction data in the first consensus result according to the ledger data; Among them, when the verification results of correctness verification and security verification are both correct, the aggregation chain can generate a second consensus result and send the second consensus result to the second target shard chain, so that the second target shard chain executes the target transaction operation corresponding to the transaction operation information according to the second consensus result.

[0012] In one embodiment of the present application, based on the above solution, the first consensus result is generated by the following steps: Obtain the consensus verification results of each node in the first target shard chain. If more than two-thirds of the consensus verification results are correct, the master node generates a first consensus result carrying the block and the account transaction data; The consensus verification result is generated by the node verifying the legitimacy of the block and the account transaction data.

[0013] In one embodiment of the present application, based on the above solution, the method further includes: Obtain node status data of each node in the first target shard chain, and determine the reputation value of each node according to each node status data, wherein the reputation value is used to characterize whether the node has a malicious behavior risk; Determine the node to be determined that has a risk of malicious behavior according to the reputation value; If the risk warning information sent by the aggregation chain is received, the corresponding risk node is determined according to the risk warning information; A target risk node belonging to the risk node is found in each of the nodes to be determined, and the target risk node is isolated.

[0014] According to one aspect of an embodiment of the present application, a transaction security protection device based on a double-layer blockchain structure is provided, wherein the double-layer blockchain structure includes an aggregate chain and a plurality of shard chains that operate independently of each other, wherein the aggregate chain stores the ledger data of each shard chain; the device is applied to a first target shard chain, and the device includes: A generating unit, configured to generate a corresponding block and account transaction data of the target node bound to the block based on the transaction operation information if the transaction operation information sent by the target node is received; A transmission unit, configured to send the first consensus result generated by the master node in the first target shard chain to the aggregation chain if the first consensus result is obtained, so that the aggregation chain can perform correctness verification and security verification on the block and the account transaction data in the first consensus result according to the ledger data; Among them, when the verification results of correctness verification and security verification are both correct, the aggregation chain can generate a second consensus result and send the second consensus result to the second target shard chain, so that the second target shard chain executes the target transaction operation corresponding to the transaction operation information according to the second consensus result.

[0015] The beneficial effects of the present application are as follows: the present application proposes a two-layer blockchain structure, wherein the two-layer blockchain structure includes an aggregate chain and multiple independently running shard chains. Through the overall management of the aggregate chain, the aggregate chain centrally manages each independently running shard chain, and the shard chain can be used to improve the scalability of the blockchain, reducing the configuration requirements of terminal equipment in the smart grid; the aggregate chain can also be used to manage global power data, grasp the overall operation of the smart grid, and improve management efficiency.

[0016] Furthermore, based on the double-layer blockchain structure, a transaction security protection method is proposed. First, the first consensus result sent by the first target shard chain is checked for correctness and security, wherein the correctness check is used to check the integrity and correctness of the block in the first consensus result, and the account transaction data corresponding to the block is compared with the account data stored in the aggregation chain, that is, security verification, to check whether there are data errors in the account transaction data. After the correctness check and security verification are passed, the second consensus result generated by the aggregation chain can be sent to the second target shard chain, so that the second target shard chain executes the target transaction operation according to the second consensus result. In this way, the data transaction between the shard chains is completed. This transaction security protection method can ensure the correctness, integrity and security of the data transaction between the shard chains. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following is a brief description of the drawings required for use in the description of the embodiments. Obviously, the drawings described are only part of the embodiments of the present application, not all of the embodiments, and those skilled in the art can also obtain other design solutions and drawings based on these drawings without creative work.

[0018] Figure 1 It is a flow chart of a transaction security protection method based on a double-layer blockchain structure according to an embodiment of the present application; Figure 2 It is an overall block diagram of a double-layer blockchain structure according to an embodiment of the present application; Figure 3 A logical block diagram of hash value verification according to an embodiment of the present application; Figure 4 It is a structural block diagram of a transaction security protection device based on a double-layer blockchain structure according to an embodiment of the present application; Figure 5 Another flow chart of a transaction security protection method based on a double-layer blockchain structure according to an embodiment of the present application; Figure 6 A schematic diagram of verification and information interaction between a shard chain and an aggregation chain according to an embodiment of the present application; Figure 7 A logical schematic diagram of balancing terminal loads according to an embodiment of the present application; Figure 8 This is another structural block diagram of a transaction security protection device based on a double-layer blockchain structure according to an embodiment of the present application. DETAILED DESCRIPTION

[0019] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this application will be more comprehensive and complete and fully convey the concept of the example embodiments to those skilled in the art.

[0020] In addition, described feature, structure or characteristic can be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present application. However, those skilled in the art will appreciate that the technical scheme of the present application can be put into practice without one or more of the specific details, or other methods, components, devices, steps, etc. can be adopted. In other cases, known methods, devices, realizations or operations are not shown or described in detail to avoid blurring the various aspects of the application.

[0021] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or micro-control node devices.

[0022] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.

[0023] It should be noted that the "multiple" mentioned in this article refers to two or more. "And / or" describes the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects before and after are in an "or" relationship.

[0024] The implementation details of the technical solution of the embodiment of the present application are described in detail below: First of all, it should be noted that the purpose of this application is to propose a transaction security protection method based on a double-layer blockchain, and propose an edge-end combined double-layer blockchain architecture, which can be Figure 2 As shown in the figure, the shard chain consists of multiple terminal nodes, which are power terminal devices with limited performance, such as smart meters, power load terminals, etc. The aggregation chain consists of multiple edge nodes, which can be base stations and authorized edge computing devices, etc. In the shard chain, the blockchain sharding technology is used to divide the terminal devices (terminal nodes) in different areas into different shards, solving the scalability problem of blockchain in smart grids.

[0025] Next, this application proposes another type of blockchain in the edge layer (aggregation chain), called aggregation chain. By collecting the consensus results of the blockchain in the shard chain (the first consensus result in this application), the aggregation chain can achieve more reliable cross-shard power transaction data processing and detect malicious nodes in the shard chain (block correctness verification fails and / or account transaction data security verification fails), solving the problem of low shard security and ensuring the security of data in the smart grid.

[0026] The consensus results in this application, whether the first consensus result or the second consensus result, are achieved by using the Practical Byzantine Fault Tolerance (PBFT) algorithm.

[0027] According to one aspect of an embodiment of the present application, a transaction security protection method based on a double-layer blockchain structure is provided. Figure 1 The flowchart of the transaction security protection method based on the double-layer blockchain structure according to the embodiment of the present application is shown. The method is executed on the aggregation chain. The method includes at least steps 110 to 150, which are described in detail as follows: In step 110, a first consensus result sent from a first target shard chain is received, where the first consensus result includes a block and account transaction data bound to the block, and the block carries identification information for verification.

[0028] Specifically, the first target shard chain is the shard chain where the transaction initiation operation is located, in which a terminal node performs the transaction initiation operation, and then the consensus of all nodes in the first target shard chain is performed according to the transaction initiation operation, and the generated first consensus result is sent to the aggregation chain. Among them, the first consensus result includes blocks and account transaction data bound to the blocks. The first consensus result can also be defined as <<Type1, {B, ASlist, Sid}> , S>; Type1 indicates the message type; B is a block, which contains the transaction content; ASlist is a list of changed account status (i.e., account transaction data in this application), which records the status of the account in a certain changed node at this moment, including the account balance, the number of executed transactions Nonce, and the account address; Sid is the name of the first target shard chain, which is used to mark the shard to which the block belongs; S is the signature of the shard chain master node.

[0029] In step 120, the block is verified for correctness based on the identification information to obtain a first verification result of the block.

[0030] Specifically, the block contains transaction content and identification information for verification, that is, the transaction root. The aggregation chain can verify the correctness of the transaction root. The transaction root is in the form of a hash value string. By verifying the correctness of the hash value string, it can be determined whether the received block is complete and correct.

[0031] In one embodiment of the present application, the identification information is a transaction root for identification, and the correctness verification of the block based on the identification information to obtain a first verification result of the block includes: Comparing the hash value of the transaction root with a preset reference hash value; If the hash value of the transaction root is consistent with the reference hash value, determining that the first verification result is correct; If the hash value of the transaction root is inconsistent with the reference hash value, the first verification result is determined to be wrong.

[0032] Furthermore, Figure 3 As shown, Figure 3The overall logic diagram of hash value verification is shown. The preset reference hash value can be the correct transaction root for comparison corresponding to the block pre-stored in the aggregation chain, that is, the correct hash value. Then, by comparing the hash value corresponding to the transaction root with the reference hash value, if they are consistent, the first verification result is determined to be correct, that is, the correctness and integrity of the block have passed. Otherwise, the first verification result is determined to be wrong. At this time, an erroneous block and the account transaction data corresponding to the block may be sent. The first verification result needs to be fed back to the first target shard chain so that the first target shard chain can analyze the cause of the error. If the block is generated by the first consensus result sent by the malicious node or the transaction initiated by the malicious node, the reputation value of the malicious node will be updated at this time. If the cumulative reputation value is lower than a certain threshold, the malicious node will be isolated. The isolation operation means that the malicious node in the shard chain cannot participate in or execute the transaction initiation operation. Even if the transaction initiation operation is initiated, no other node will respond to the transaction initiation operation.

[0033] In step 130, security verification is performed on the block based on the account transaction data and the ledger data to obtain a second verification result of the block.

[0034] Specifically, the embodiment of the present application stores the ledger data of all terminal nodes of each shard chain in the aggregation chain, that is, the account balance of each terminal node before the transaction. If the sum of the account transaction amount and the account balance after the transaction in the first consensus result is inconsistent with the account balance before the transaction stored in the aggregation chain, then it means that an error has occurred in the account transaction data in the first consensus result. At this time, it is necessary to feedback to the first target shard chain, and based on this, update the reputation value of the terminal node corresponding to the account transaction data to prevent malicious behavior of malicious nodes or collusion nodes from happening again.

[0035] In one embodiment of the present application, the account transaction data includes the account transaction deduction amount and the account balance of the target node associated with the block in the first target shard chain, and the ledger data includes the account balance data of each node in each of the shard chains; the security verification of the block based on the account transaction data and the ledger data to obtain the second verification result of the block includes: Determine the total account balance of the target node before the transaction based on the sum of the account transaction deduction amount and the account balance; Comparing the total account balance with the target account balance data corresponding to the target node in the ledger data, and if the comparison is consistent, determining that the second verification result is correct; If the comparison is inconsistent, the second verification result is determined to be wrong.

[0036] Specifically, the account transaction data includes the account transaction deduction amount and the account balance corresponding to the block, and the block is associated with the target node, which is the transaction initiating node. Then, the total account balance of the target node before the transaction can be determined based on the sum of the account transaction deduction amount and the account balance. By comparing the total account balance before the transaction with the target account balance data of the target node stored in the ledger data, if they are consistent, it means that the account transaction data this time is correct, and the second verification result can be determined to be correct.

[0037] In step 140, when both the first verification result and the second verification result are correct, a second consensus result corresponding to the first consensus result is generated, and the second consensus result includes the verified block and the account transaction data.

[0038] If both the first verification result and the second verification result are correct, then the second consensus result corresponding to the first consensus result is generated by the PBFT algorithm, where the consensus result C2 can be defined as <<Type2, {CTxList, Rid, Sid}> , S>. Type2 indicates the message type; CTxlist is the cross-shard transaction list of the first target shard chain, and the block and account transaction data therein are marked as verified; Rid is the name of the second target shard chain; Sid is the name of the aggregate chain; S is the signature of the aggregate chain master node.

[0039] In step 150, the second consensus result is sent to the second target shard chain so that the second target shard chain executes the target transaction operation according to the second consensus result.

[0040] Specifically, by sending the second consensus result to the second target shard chain, so that the second target shard chain executes the target transaction operation according to the second consensus result, the second target shard chain quickly executes the transaction operation corresponding to the consensus result according to the second consensus result, thereby completing the data transaction between cross-shard chains.

[0041] In general, the above steps 110-150 only propose the verification and subsequent processing of a single first consensus result. In the entire two-layer blockchain structure, multiple first consensus results can be uniformly identified at the same time, that is, there can be multiple first target shard chains, and each of them sends its own first consensus result to the aggregation chain at the same time. The aggregation chain can verify the multiple first consensus results received at the same time and perform subsequent operations according to the verification results (i.e., the first verification result and the second verification result).

[0042] Therefore, the aggregation chain verifies each block in these first consensus results and the associated account transaction data one by one, and finally obtains the verification result of each block.<B1.v:false, B2.v:true, ..., Bj.v:true> Bi represents a block, where the one marked as true indicates successful verification, and the one marked as false indicates failed verification, indicating that there is a problem with the execution of the block or the account transaction in it. However, no matter what the verification result is, the master node in the aggregation chain should generate these blocks for consensus in the aggregation chain and broadcast them to other nodes for consensus.

[0043] In one embodiment of the present application, the method further includes: Obtaining the historical reputation value of the target node corresponding to the block; Calculating the reputation value of the target node after the correctness check and the security verification based on a preset reputation value calculation formula, a positive evaluation index, and a negative evaluation index; The positive evaluation index and the negative evaluation index are both related to the first verification result and the second verification result.

[0044] Specifically, the target node corresponding to each block has a reputation value, because the target node will be given an initial reputation value when it is included in the shard chain, and then it will be verified according to the generated blocks and the corresponding account transaction data during continuous data transactions, and the reputation value will be continuously updated, that is, the first verification result and the second verification result will affect the reputation value update of the target node. Then, the historical reputation value of the target node corresponding to the block is obtained, that is, the reputation value of the target node corresponding to the block before the update is obtained, and the reputation value of the target node after the correctness check and the security verification is calculated through the preset reputation value calculation formula, positive evaluation index and negative evaluation index.

[0045] The preset reputation value calculation formula can be as follows: (1) (2) Among them, formula (1) is the Beta probability formula, that is, the probability density function of the Beta distribution, where α is a positive evaluation indicator for evaluating the positive behavior of the node, which is determined by the behavior taken by the target node in the operation of the blockchain. When the block verification of the shard where the target node is located is correct, the α value increases by 1, and when the account transaction data verification is passed, the α value increases by 1; and β is a negative evaluation indicator for evaluating the negative behavior of the node. When the block verification of the shard where the node is located is wrong, the β value increases by 1, and the account transaction data verification fails, the β value increases by 1, and the β value of the master node of this round and the node that agrees with the proposal increases by 1 additionally, because they are malicious nodes or collusion nodes. Note that when the target node is first connected to the network, since there is no historical behavior, the reputation value cannot be calculated at this time, and an initial value should be uniformly assigned; after the target node joins the blockchain, we record its behavior in each round, and its reputation value can be calculated based on these behavior data.

[0046] In one embodiment of the present application, after calculating the reputation value of the target node after the correctness check and the security verification, the method further includes: If the reputation value is lower than the preset reputation reference value, the target node is determined to be a risky node, and risk warning information corresponding to the risky node is sent to the first target shard chain, so that the master node in the first target shard chain can isolate the risky node according to the risk warning information.

[0047] Formula (2) calculates the final reputation value, and compares it with the preset reputation benchmark value. If it is lower than the preset reputation benchmark value, it means that the target node is a risk node. The preset reputation benchmark value can be set according to actual needs, and no limitation or specific numerical examples are given here.

[0048] By sending the risk warning information corresponding to the risk node to the first target shard chain, the master node in the first target shard chain can isolate the risk node according to the risk warning information. It should be noted that after receiving the risk warning information, the master node in the first target shard chain needs to further verify the risk node in the risk warning information, and the malicious node can be isolated after verification.

[0049] Figure 4This is a block diagram of a transaction security protection device 400 based on a double-layer blockchain structure according to an embodiment of the present application. According to a transaction security protection device 400 based on a double-layer blockchain structure according to an embodiment of the present application, the double-layer blockchain structure includes a polymer chain and multiple shard chains that operate independently of each other, and the polymer chain stores the ledger data of each shard chain; the device is applied to the polymer chain, and the device 400 includes: a receiving unit 401, a verification unit 402, a verification unit 403, a consensus unit 404, and a sending unit 405.

[0050] The receiving unit 401 is used to receive a first consensus result sent from a first target shard chain, where the first consensus result includes a block and account transaction data bound to the block, and the block carries identification information for verification.

[0051] The verification unit 402 is used to perform a correctness verification on the block based on the identification information to obtain a first verification result of the block.

[0052] The verification unit 403 is used to perform security verification on the block based on the account transaction data and the ledger data to obtain a second verification result of the block.

[0053] The consensus unit 404 is used to generate a second consensus result corresponding to the first consensus result when both the first verification result and the second verification result are correct, wherein the second consensus result includes the verified block and the account transaction data.

[0054] The sending unit 405 is used to send the second consensus result to the second target shard chain so that the second target shard chain executes the target transaction operation according to the second consensus result.

[0055] According to one aspect of an embodiment of the present application, a transaction security protection method based on a double-layer blockchain structure is provided. Figure 5 The flowchart of the transaction security protection method based on the double-layer blockchain structure according to the embodiment of the present application is shown, wherein the double-layer blockchain structure includes an aggregate chain and a plurality of shard chains running independently of each other, wherein the aggregate chain stores the ledger data of each shard chain; the method is executed on the first target shard chain, and the method includes at least steps 510 to 520, which are described in detail as follows: In step 510, if the transaction operation information sent by the target node is received, a corresponding block and the account transaction data of the target node bound to the block are generated based on the transaction operation information.

[0056] Specifically, the target node is the terminal node where the transaction initiator is located. The corresponding block and the account transaction data of the target node bound to the block can be generated through the transaction operation information. The specific transaction verification and execution process can be as follows: Figure 6 As shown, the first target shard chain executes the transaction initiator's deduction operation and sends the consensus result C1 to the aggregation chain, which verifies the block and the account transaction data contained therein; the aggregation chain reaches a consensus on the verification result and sends the consensus result C2 to the second target shard chain, which receives the cross-shard transaction information (second consensus result) from the aggregation chain, thereby enabling the transaction recipient to execute the target transaction operation corresponding to the transaction operation information.

[0057] In one embodiment of the present application, the first consensus result is generated by the following steps: Obtain the consensus verification results of each node in the first target shard chain. If more than two-thirds of the consensus verification results are correct, the master node generates a first consensus result carrying the block and the account transaction data; The consensus verification result is generated by the node verifying the legitimacy of the block and the account transaction data.

[0058] Specifically, the first consensus result is obtained according to the Practical Byzantine Fault Tolerance (PBFT) algorithm, which is also verified by verifying the hash value corresponding to the transaction root of the block in the consensus result. If the transaction operation is initiated by a malicious node, and the majority of nodes pass the proposal (block) as collusion nodes, then the aggregation chain can verify and identify the first consensus result corresponding to the proposal to prevent the malicious node from maliciously deducting funds, reporting false data, etc., and update its reputation value, so that the master node of the first target shard chain can isolate these malicious nodes and collusion nodes.

[0059] The correctness of the global ledger data is ensured by eliminating errors that occur during transmission and verifying whether the transaction execution in the shard chain is correct. The second step is to verify whether the physical status of the relevant nodes in the shard chain is normal. Some indicators of the terminal nodes in normal operation float within a range. If an indicator value is abnormal, it may be invaded. We need to find these potential malicious nodes, and then use the Beta formula to calculate its reputation value and determine whether it is a malicious node.

[0060] The reputation value update process may involve two reputation value updates. The first update is based on the consensus result within the shard, that is, the reputation value is updated based on the node status data of each node in the first target shard chain. If the node status data (physical status, such as whether the voltage, current, power and other values ​​in the power grid are within the normal range) of a node is abnormal, then the reputation value of the node will be updated at this time.

[0061] The second time, the aggregation chain will make the judgment. When the aggregation chain verifies that the transaction data is wrong or there is a malicious node, it needs to return the verification failure result and recalculate the terminal's reputation value. The verification failure result Vf is defined as <<Tpye3,{B,AcList, Sid},V, Txlist,blackList> , S>. Type3 indicates the message type; B is the block that failed verification; ASlist is the list of related account status; Sid is the received shard ID; V value represents the verification failure type. If the received block is wrong, the correct block needs to be resent. If the transaction execution is wrong, the account status needs to be rolled back to the correct time. If there is a malicious node, isolation measures need to be implemented; Txlist indicates the transaction list with verification errors; blackList represents the existence of malicious nodes in this shard; S is the signature of the aggregation chain master node.

[0062] In one embodiment of the present application, the method further includes: Obtain node status data of each node in the first target shard chain, and determine the reputation value of each node according to each node status data, wherein the reputation value is used to characterize whether the node has a malicious behavior risk; Determine the node to be determined that has a risk of malicious behavior according to the reputation value; If the risk warning information sent by the aggregation chain is received, the corresponding risk node is determined according to the risk warning information; A target risk node belonging to the risk node is found in each of the nodes to be determined, and the target risk node is isolated.

[0063] Specifically, the node status data can be the physical status of the terminal node, such as the voltage data, current data, power data, etc. of a smart meter. If these data are not within the normal threshold range, it means that the terminal node has an abnormality, and its reputation value is updated. At the same time, it is necessary to determine whether the node has a risk of malicious behavior. If abnormal data appears for a long time, it can be determined that the current node is a node to be determined with a risk of malicious behavior.

[0064] Furthermore, after knowing the nodes to be determined, it is not possible to directly determine them as malicious nodes. It is necessary to compare them with the risk nodes in the risk warning information sent by the aggregation chain. If a node is identified as a node to be determined and is determined as a risk node, after double determination, it means that the node is a target risk node, that is, a malicious node. By finding out all the malicious nodes and isolating them, the transactions of the double-layer blockchain structure can be effectively protected.

[0065] In step 520, if the first consensus result generated by the master node in the first target shard chain is obtained, the first consensus result is sent to the aggregation chain, so that the aggregation chain performs correctness verification and security verification on the block and the account transaction data in the first consensus result according to the ledger data; Among them, when the verification results of correctness verification and security verification are both correct, the aggregation chain can generate a second consensus result and send the second consensus result to the second target shard chain, so that the second target shard chain executes the target transaction operation corresponding to the transaction operation information according to the second consensus result.

[0066] Specifically, by sending the first consensus result to the aggregation chain, the aggregation chain can perform correctness verification and security verification on the blocks and the account transaction data in the first consensus result according to the ledger data, and then when the verification results of the correctness verification and the security verification are both correct, the aggregation chain can generate a second consensus result and send the second consensus result to the second target shard chain, so that the second target shard chain executes the target transaction operation corresponding to the transaction operation information according to the second consensus result.

[0067] The embodiments of the present application are subjected to multiple verifications and security protections, and are combined with sharding to manage terminal nodes, which can achieve fast, accurate and secure data processing.

[0068] In one embodiment of the present application, the method of the present application also includes balancing the load of the shard chain. When the power transaction data processing of the smart grid is completed on the blockchain, the load of the shard chains in different shards may be different. In layman's terms, it is because the users in a certain shard may be more active, resulting in a larger number of transactions in the shard, so it is possible that the shard is already processing transactions at full load at this time, while the other shard is idle. The content of this section can provide a more balanced load performance for the terminal layer (shard chain), and indirectly improve the performance of the shard chain.

[0069] This application also proposes a CLPA algorithm (Constrained Label Propagation Algorithm) to divide the users of the smart grid into different shards according to the operation of the blockchain system. The specific implementation is carried out on the aggregation chain of the edge layer. The process and description are as follows: like Figure 7 As shown in the figure, when the aggregation chain starts running, the configuration information of CLPA needs to be initialized first, including the definition of weight penalty, number of iterations, and number of shards. Then, the aggregation chain continues to listen to the newly generated blocks and calls CLPA to generate a new account graph. That is, when the aggregation link receives the block sent by the shard chain, it takes the transaction initiator and receiver as input to update the vertices and edges of the account graph. After that, the aggregation chain periodically executes CLPA to divide the account according to the predefined epoch time, and sends the division result to the shard chain. When the shard link receives the division information from the aggregation chain, a round of consensus is required. Before this special round of consensus, each shard sends the divided account information and related transactions in the current transaction pool to the divided shard. When the master node collects the division information, it reaches consensus according to the PBFT algorithm. The result of this round of consensus success is that each node of the shard chain adds the divided account information and transaction information, and forms a block chain storage.

[0070] According to one aspect of an embodiment of the present application, a transaction security protection device based on a double-layer blockchain structure is provided, wherein the double-layer blockchain structure includes an aggregate chain and a plurality of independently running shard chains, wherein the aggregate chain stores the ledger data of each shard chain; the device is applied to a first target shard chain, Figure 8 A block diagram of a transaction security protection device 800 based on a double-layer blockchain structure provided in an embodiment of the present application, wherein the device 800 includes a generation unit 801 and a transmission unit 802.

[0071] A generating unit 801 is configured to generate a corresponding block and account transaction data of the target node bound to the block based on the transaction operation information if transaction operation information sent by the target node is received; The transmission unit 802 is used to send the first consensus result generated by the master node in the first target shard chain to the aggregation chain if the first consensus result is obtained, so that the aggregation chain can perform correctness verification and security verification on the block and the account transaction data in the first consensus result according to the ledger data.

[0072] Among them, when the verification results of correctness verification and security verification are both correct, the aggregation chain can generate a second consensus result and send the second consensus result to the second target shard chain, so that the second target shard chain executes the target transaction operation corresponding to the transaction operation information according to the second consensus result.

[0073] As another aspect, the present application further provides a computer-readable storage medium on which a program product capable of implementing the method provided above in this specification is stored. In some possible implementations, various aspects of the present application may also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to cause the terminal device to execute the steps according to various exemplary implementations of the present application described in the above "Embodiment Method" section of this specification.

[0074] According to the program product for implementing the above method in the embodiment of the present application, it can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on a terminal device, such as a personal computer. However, the program product of the present application is not limited thereto. In this document, a readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with an instruction execution system, an apparatus or a device.

[0075] The program product may be any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination thereof. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.

[0076] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0077] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.

[0078] Program code for performing the operations of the present application may be written in any combination of one or more programming languages, including object-oriented programming languages, such as Java, C++, etc., and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., using an Internet service provider to connect through the Internet).

[0079] In addition, the above-mentioned figures are only schematic illustrations of the processes included in the method according to the exemplary embodiments of the present application, and are not intended to be limiting. It is easy to understand that the processes shown in the above-mentioned figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.

[0080] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be performed without departing from the scope thereof. The scope of the present application is limited only by the appended claims.

Claims

1. A transaction security protection method based on a double-layer blockchain structure, characterized in that: The two-layer blockchain structure includes an aggregate chain and multiple shard chains that operate independently of each other, and the aggregate chain stores the ledger data of each shard chain; The method is performed on the polymer chain, and the method comprises: Receive a first consensus result sent from a first target shard chain, where the first consensus result includes a block and account transaction data bound to the block, and the block carries identification information for verification; Performing a correctness check on the block based on the identification information to obtain a first verification result of the block; Performing security verification on the block based on the account transaction data and the ledger data to obtain a second verification result of the block; When both the first verification result and the second verification result are correct, generating a second consensus result corresponding to the first consensus result, wherein the second consensus result includes the verified block and the account transaction data; The second consensus result is sent to the second target shard chain so that the second target shard chain executes the target transaction operation according to the second consensus result.

2. The method according to claim 1, characterized in that The identification information is a transaction root for identification, and the correctness verification of the block based on the identification information to obtain a first verification result of the block includes: Comparing the hash value of the transaction root with a preset reference hash value; If the hash value of the transaction root is consistent with the reference hash value, determining that the first verification result is correct; If the hash value of the transaction root is inconsistent with the reference hash value, the first verification result is determined to be wrong.

3. The method according to claim 2, characterized in that The account transaction data includes the account transaction deduction amount and account balance of the target node associated with the block in the first target shard chain, and the ledger data includes the account balance data of each node in each of the shard chains; The performing security verification on the block based on the account transaction data and the ledger data to obtain a second verification result of the block includes: Determine the total account balance of the target node before the transaction based on the sum of the account transaction deduction amount and the account balance; Comparing the total account balance with the target account balance data corresponding to the target node in the ledger data, and if the comparison is consistent, determining that the second verification result is correct; If the comparison is inconsistent, the second verification result is determined to be wrong.

4. The method according to claim 3, characterized in that The method further comprises: Obtaining the historical reputation value of the target node corresponding to the block; Calculating the reputation value of the target node after the correctness check and the security verification based on a preset reputation value calculation formula, a positive evaluation index, and a negative evaluation index; The positive evaluation index and the negative evaluation index are both related to the first verification result and the second verification result.

5. The method according to claim 4, characterized in that After calculating the reputation value of the target node after the correctness check and the security verification, the method further includes: If the reputation value is lower than the preset reputation reference value, the target node is determined to be a risky node, and risk warning information corresponding to the risky node is sent to the first target shard chain, so that the master node in the first target shard chain can isolate the risky node according to the risk warning information.

6. A transaction security protection device based on a double-layer blockchain structure, characterized in that: The two-layer blockchain structure includes an aggregate chain and multiple shard chains that operate independently of each other, and the aggregate chain stores the ledger data of each shard chain; The device is applied to the polymer chain, and the device comprises: A receiving unit, configured to receive a first consensus result sent from a first target shard chain, wherein the first consensus result includes a block and account transaction data bound to the block, and the block carries identification information for verification; A verification unit, configured to perform a correctness verification on the block based on the identification information to obtain a first verification result of the block; A verification unit, configured to perform security verification on the block based on the account transaction data and the ledger data to obtain a second verification result of the block; A consensus unit, configured to generate a second consensus result corresponding to the first consensus result when both the first verification result and the second verification result are correct, wherein the second consensus result includes the verified block and the account transaction data; A sending unit is used to send the second consensus result to the second target shard chain, so that the second target shard chain performs the target transaction operation according to the second consensus result.

7. A transaction security protection method based on a double-layer blockchain structure, characterized in that: The two-layer blockchain structure includes an aggregate chain and multiple shard chains that operate independently of each other, and the aggregate chain stores the ledger data of each shard chain; The method is executed on a first target shard chain, and the method includes: If the transaction operation information sent by the target node is received, a corresponding block and account transaction data of the target node bound to the block are generated based on the transaction operation information; If the first consensus result generated by the master node in the first target shard chain is obtained, the first consensus result is sent to the aggregation chain, so that the aggregation chain performs correctness verification and security verification on the block and the account transaction data in the first consensus result according to the ledger data; Among them, when the verification results of correctness verification and security verification are both correct, the aggregation chain can generate a second consensus result and send the second consensus result to the second target shard chain, so that the second target shard chain executes the target transaction operation corresponding to the transaction operation information according to the second consensus result.

8. The method according to claim 7, characterized in that The first consensus result is generated through the following steps: Obtain the consensus verification results of each node in the first target shard chain. If more than two-thirds of the consensus verification results are correct, the master node generates a first consensus result carrying the block and the account transaction data; The consensus verification result is generated by the node verifying the legitimacy of the block and the account transaction data.

9. The method according to claim 8, characterized in that The method further comprises: Obtain node status data of each node in the first target shard chain, and determine the reputation value of each node according to each node status data, wherein the reputation value is used to characterize whether the node has a malicious behavior risk; Determine the node to be determined that has a risk of malicious behavior according to the reputation value; If the risk warning information sent by the aggregation chain is received, the corresponding risk node is determined according to the risk warning information; A target risk node belonging to the risk node is found in each of the nodes to be determined, and the target risk node is isolated.

10. A transaction security protection device based on a double-layer blockchain structure, characterized in that: The two-layer blockchain structure includes an aggregate chain and multiple shard chains that operate independently of each other, and the aggregate chain stores the ledger data of each shard chain; The device is applied to a first target shard chain, and the device includes: A generating unit, configured to generate a corresponding block and account transaction data of the target node bound to the block based on the transaction operation information if the transaction operation information sent by the target node is received; A transmission unit, configured to send the first consensus result generated by the master node in the first target shard chain to the aggregation chain if the first consensus result is obtained, so that the aggregation chain can perform correctness verification and security verification on the block and the account transaction data in the first consensus result according to the ledger data; Among them, when the verification results of correctness verification and security verification are both correct, the aggregation chain can generate a second consensus result and send the second consensus result to the second target shard chain, so that the second target shard chain executes the target transaction operation corresponding to the transaction operation information according to the second consensus result.

Citation Information

Patent Citations

  • Consensus verification method, check node and block chain system

    CN110875893A

  • Transaction verification method and device based on block chain, and electronic equipment

    CN114529415A

  • Block chain fragmentation method for spectrum transaction

    CN116963077A

  • Double-layer multi-partition block chain system

    CN117914861A

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

    CN118057796A