Practical Byzantine fault-tolerant consensus method, device and equipment for commodity transaction in block chain, medium and product

By adopting a two-layer network structure and reputation scoring mechanism in the blockchain, grouping and selecting high-reputation nodes for local consensus, the problem of PBFT algorithm being inefficient in large-scale transactions is solved, and transaction efficiency and stability are improved.

CN119273369APending Publication Date: 2025-01-07BEIJING INFORMATION SCI & TECH UNIV
View PDF 0 Cites 5 Cited by

Patent Information

Application Number
CN202411383885.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-30
Publication Date
2025-01-07

AI Technical Summary

Technical Problem

In large-scale commodity trading scenarios, the PBFT algorithm requires pairs of communication between all nodes, resulting in inefficient consensus processes, affecting transaction efficiency.

Method used

Using a two-layer network structure, nodes are divided into primary network layer and secondary network layer. At the secondary network layer, group them according to the communication delay of the nearest neighbor of the node, and calculate the reputation score based on the attribute score and dynamic behavior of the node's organization to which it belongs. High The reputation node serves as the master node to conduct local consensus, and finally joins the master node to participate in the global consensus.

Benefits of technology

It improves the overall consensus efficiency and stability of the network, reduces the risk of Byzantine nodes being elected as master nodes, takes into account the efficiency and stability of consensus algorithms, and ensures stable and efficient transactions of commodities on the blockchain.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119273369A_ABST
    Figure CN119273369A_ABST
Patent Text Reader

Abstract

The invention discloses a practical Byzantine fault-tolerant consensus method, device and equipment for commodity transaction in a block chain, a medium and a product, and relates to the field of block chains. The method comprises the following steps: initializing alliance chain network nodes, and dividing the alliance chain network nodes into a double-layer network structure comprising a main network layer and a secondary network layer; grouping in a secondary network layer according to the nearest neighbor communication time delay of the nodes; after each round of consensus is finished, reputation score calculation is carried out on the nodes based on attribute scores of mechanisms to which the nodes belong and dynamic behaviors of the nodes in the commodity transaction process, the node with the highest reputation score is periodically selected from each group to serve as a main node in the group, and other nodes in the group serve as common nodes; local consensus is carried out on the main node and the common node in each group in the respective group; and adding the main nodes in each group to a main network layer to participate in global consensus. According to the invention, the overall consensus efficiency and stability of the network can be improved, and stable and efficient transaction of commodities on the block chain is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of blockchain technology, and in particular to a practical Byzantine fault-tolerant consensus method, device, equipment, medium and product for commodity transactions in blockchain. Background Art

[0002] The commodity trading model based on blockchain can solve the problems of information opacity and asymmetry, lack of integrity in authenticity identification, difficulty in copyright identification, and difficulty in tracing the source of historical archive information and easy tampering in traditional commodity trading from the source, thanks to the characteristics of blockchain decentralization, immutability, and open and transparent ledger. The PBFT (Practical Byzantine Fault Tolerance) consensus algorithm of blockchain is the basis for realizing reliable commodity transactions. It is a key mechanism to ensure that each node in a decentralized environment reaches a consensus on the order and content of transactions. The consensus protocol prevents malicious tampering or falsification of data through mutual verification and coordination between nodes, eliminates the single point of failure and trust problems of traditional centralized institutions, and thus ensures reliable commodity transactions. However, with the gradual expansion of the scale of commodity transactions, in the large-scale transaction scenarios of various commodities, the PBFT algorithm needs to communicate between all nodes in the consensus process, resulting in a sharp decline in performance, making the consensus process inefficient and affecting transaction efficiency. Summary of the invention

[0003] The purpose of this application is to provide a practical Byzantine fault-tolerant consensus method, device, equipment, medium and product for commodity transactions in blockchain, which can improve the overall consensus efficiency and stability of the network and ensure stable and efficient transactions of commodities on the blockchain.

[0004] To achieve the above objectives, this application provides the following solutions.

[0005] In a first aspect, the present application provides a practical Byzantine fault-tolerant consensus method for commodity transactions in a blockchain, comprising:

[0006] Initialize the alliance chain network nodes and divide them into a two-layer network structure including the main network layer and the secondary network layer;

[0007] Based on the two-layer network structure, nodes are grouped according to their nearest neighbor communication delays at the secondary network layer;

[0008] After each round of consensus, the reputation score of the node is calculated based on the attribute score of the organization to which the node belongs and the dynamic behavior of the node in the commodity trading process. The node with the highest reputation score is periodically selected in each group as the master node in the group, and the other nodes in the group are treated as ordinary nodes.

[0009] The master nodes and ordinary nodes in each group reach local consensus within their respective groups;

[0010] Add the master nodes in each group to the main network layer to participate in the global consensus.

[0011] Optionally, the alliance chain is jointly constructed by several commodity trading related institutions, and each institution has multiple nodes.

[0012] Optionally, grouping at the secondary network layer according to the nearest neighbor communication delay of the nodes specifically includes:

[0013] The DBSCAN clustering algorithm is introduced to group all nodes in the commodity trading process according to the nearest neighbor communication delay.

[0014] Optionally, the calculation of the reputation score of the node based on the attribute score of the organization to which the node belongs and the dynamic behavior of the node in the commodity trading process specifically includes:

[0015] Construct an expert matrix to perform parameterized design and modeling of node attributes, and calculate the social reputation value of the node's institution based on the attribute score of the node's institution;

[0016] Calculate the node's delay index based on the node's delay in the commodity trading process;

[0017] The transaction completion rate of the node is calculated based on the number of transactions completed by the node during the commodity trading process;

[0018] The node's reputation score is calculated based on the node's latency index, transaction completion rate, and the social reputation value of the organization to which the node belongs.

[0019] Optionally, the master nodes and common nodes in each group perform local consensus in their respective groups, specifically including:

[0020] Each common node in the secondary network layer submits a request and timestamp to the corresponding master node in its group, and sends a summary message to other common nodes in the group;

[0021] The master node packages the messages submitted by the ordinary nodes in the group received within a period of time and sends a response message to each ordinary node;

[0022] After verification by each ordinary node, the master node and each ordinary node reach a PBFT consensus within the group. Each ordinary node submits the message to the master node and agrees that the master node will submit the message set at the main network layer.

[0023] When the master node in a group receives a commit message from f+1 ordinary nodes, it proves that the message has reached a local consensus within the group. The master node in the group then submits the message set to the master node of the main network layer; where f represents the maximum number of erroneous nodes allowed.

[0024] Optionally, adding the master nodes in each group to the main network layer to participate in the global consensus specifically includes:

[0025] The master node in each group broadcasts the packaged message set to the master node of the main network layer;

[0026] After receiving the message, the master node of the main network layer merges and sorts the message sets submitted by the master nodes in all groups according to the timestamp, then packs the final message set into a block and signs the block. Subsequently, the message containing the signed block and the block itself is broadcast to the master nodes in all groups to reach a consensus in the main network layer.

[0027] In a second aspect, the present application provides a practical Byzantine fault-tolerant consensus device for commodity transactions in a blockchain, comprising:

[0028] The two-layer network structure division module is used to initialize the alliance chain network nodes and divide them into a two-layer network structure including the main network layer and the secondary network layer;

[0029] The communication delay grouping module is used to group nodes according to the nearest neighbor communication delay at the secondary network layer based on the double-layer network structure;

[0030] The reputation score calculation module is used to calculate the reputation score of the node based on the attribute score of the organization to which the node belongs and the dynamic behavior of the node in the commodity trading process after each round of consensus. The node with the highest reputation score in each group is periodically selected as the master node in the group, and the other nodes in the group are treated as ordinary nodes;

[0031] The local consensus module is used for the master nodes and ordinary nodes in each group to reach local consensus within their respective groups;

[0032] The entire consensus module is used to add the master nodes in each group to the main network layer to participate in the global consensus.

[0033] In a third aspect, the present application provides a computer device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the practical Byzantine fault-tolerant consensus method for commodity transactions in a blockchain.

[0034] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the practical Byzantine fault-tolerant consensus method for commodity transactions in a blockchain.

[0035] In a fifth aspect, the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the practical Byzantine fault-tolerant consensus method for commodity transactions in a blockchain.

[0036] According to the specific embodiments provided in this application, this application discloses the following technical effects:

[0037] The present application provides a practical Byzantine fault-tolerant consensus method, device, equipment, medium and product for commodity trading in blockchain. On the basis of a two-layer network structure, the nodes are grouped according to the nearest neighbor communication delay of the nodes in the secondary network layer, and local consensus is performed in each group; then the reputation score of the nodes is calculated based on the attribute score of the organization to which the nodes belong and the dynamic behavior of the nodes in the commodity trading process, and the high-reputation nodes in each group are added to the main network layer as the main nodes in each group to participate in the global consensus. On the one hand, the present application improves the consensus efficiency through grouping and layering, and on the other hand, reduces the risk of Byzantine nodes being elected as the main nodes through the reputation scoring mechanism, thereby taking into account the efficiency and stability of the consensus algorithm, and can ensure stable and efficient transactions of commodities on the blockchain. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0039] Figure 1 A flowchart of a practical Byzantine fault-tolerant consensus method for commodity transactions in blockchain is provided for this application;

[0040] Figure 2 This is the network structure diagram of the DS-PBFT algorithm for this application;

[0041] Figure 3 This is the consensus flow chart of the DS-PBFT algorithm for this application;

[0042] Figure 4 This is a comparison chart of the consensus delay between the DS-PBFT algorithm and the traditional algorithm for this application.

[0043] Figure 5 This is a throughput comparison chart of the DS-PBFT algorithm and traditional algorithms for this application.

[0044] Figure 6 This is a stability comparison chart of the DS-PBFT algorithm in this application and the control group. DETAILED DESCRIPTION

[0045] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0046] In response to the low efficiency of the PBFT consensus algorithm in large-scale actual application scenarios of commodity transactions, this application designs a practical Byzantine fault-tolerant consensus method for commodity transactions in blockchain that can take into account both consensus efficiency and stability. Through the design of hierarchical grouping and combined with the nearest neighbor communication delay grouping strategy, the overall consensus efficiency of the network is improved; by combining the characteristics of commodity transactions and the dynamic behavior of nodes, a credit scoring mechanism is designed to improve the stability of consensus while ensuring efficiency.

[0047] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0048] In an exemplary embodiment, Figure 1 As shown, a practical Byzantine fault-tolerant consensus method for commodity transactions in blockchain is provided, including the following steps 1 to 5.

[0049] Step 1: Initialize the alliance chain network nodes and divide them into a two-layer network structure including the main network layer and the secondary network layer.

[0050] The blockchain for commodity trading is jointly built by several commodity trading related institutions, and each institution has multiple nodes. Consortium chain is the abbreviation of consortium blockchain (also known as industry blockchain or community blockchain). Consortium chain refers to a blockchain whose consensus process is controlled by pre-selected nodes. Consortium chain is a blockchain that requires registration and permission. The consortium chain is limited to the participation of consortium members. The read and write permissions and the permission to participate in accounting on the blockchain are formulated according to the consortium rules. The entire blockchain network is jointly maintained by member institutions. Network access is generally accessed through the gateway nodes of member institutions, and the consensus process is controlled by pre-selected nodes. Consortium chains mostly use consensus algorithms such as proof of stake (PoS) or PBFT and RAFT.

[0051] Too many nodes in the alliance chain will increase the communication complexity of the PBFT algorithm, thereby reducing the consensus efficiency of the entire system. Therefore, this application proposes a practical Byzantine fault-tolerant consensus algorithm with a two-layer network structure (DS-PBFT algorithm for short). Figure 2 As shown. The DS-PBFT algorithm divides the entire network into the main network layer (short for the main network layer) and the secondary network layer (short for the secondary network layer). The main network layer is mainly composed of the master nodes inside the ellipse, that is, the master nodes elected by the reputation scoring mechanism in the secondary network layer. The secondary network layer is divided into multiple groups according to the nearest neighbor delay according to the DBSCAN clustering algorithm. Figure 2 Only three groups are shown, namely group 1, group 2 and group 3. The overall concept of the DS-PBFT algorithm is to first split these nodes in the secondary network layer to improve efficiency. All nodes are grouped by the nearest neighbor communication delay, and then high-reputation nodes are selected from each group to join the main network layer through the reputation scoring mechanism, and the remaining nodes are used as ordinary nodes in the secondary network layer. Then the main network layer nodes are first responsible for the consensus process within their respective groups. When consensus is reached within the group, the consensus results can be uploaded to the main network layer, and finally the global consensus of the entire network is achieved.

[0052] Step 2: Based on the two-layer network structure, nodes are grouped according to their nearest neighbor communication delays at the secondary network layer.

[0053] This application introduces the DBSCAN (Density-Based Spatial Clustering of Applications with Noise) clustering algorithm to group all nodes in the commodity trading process according to the nearest neighbor communication delay, so as to achieve the purpose of lowering the network communication delay of nodes in a single group.

[0054] The implementation process of the DBSCAN clustering algorithm is described as follows. First, initialize two parameters: the neighborhood size epsilon and the minimum neighborhood size MinPts to become a core point. The neighborhood size epsilon defines the neighborhood range of a node, that is, the nodes within this range are considered to be neighbors of the node. The minimum neighborhood size MinPts is used to determine whether a node is a core point. If a node is considered a core point, there must be at least MinPts data points in its neighborhood. Next, obtain the communication delay between each node and other nodes during the consensus process and store it in the distances list. Then, traverse the distances list to find the core point. For each node, check whether the number of nodes in its neighborhood is greater than or equal to MinPts. If so, mark the node as a core point. After finding all the core points, start expanding the clustering for grouping until all nodes are assigned to groups, that is, the grouping of the sub-network layer is completed.

[0055] After clustering and grouping according to the nearest neighbor communication delay in the sub-network layer, local group consensus can be achieved within each group.

[0056] Step 3: After each round of consensus, the reputation score of the node is calculated based on the attribute score of the organization to which the node belongs and the dynamic behavior of the node in the commodity trading process. The node with the highest reputation score in each group is periodically selected as the main node in the group, and the other nodes in the group are treated as ordinary nodes.

[0057] On the one hand, this application improves the efficiency of consensus through grouping and stratification, and on the other hand, reduces the risk of Byzantine nodes being elected as master nodes through a reputation scoring mechanism, thereby taking into account the efficiency and stability of the consensus algorithm. The reputation scoring mechanism proposed in this application comprehensively considers the social reputation of the commodity organization to which the network node belongs and the dynamic behavior of the node at runtime as a reputation scoring indicator.

[0058] The node reputation score calculation based on the attribute score of the organization to which the node belongs and the dynamic behavior of the node in the commodity trading process specifically includes:

[0059] Step 3.1: Construct an expert matrix to perform parameterized design and modeling of the node's attributes, and calculate the social reputation value of the node's institution based on the attribute score of the node's institution.

[0060] This application scores the social reputation of nodes by constructing an expert matrix. The social reputation of the institution to which the node belongs is selected as an indicator of the reputation scoring mechanism, mainly considering that in the commodity trading scenario, the better the reputation of the institution, the stronger its comprehensive strength, and the more stable the service.

[0061] Specifically, the attributes of the nodes are parametrically designed and modeled by constructing an expert matrix. According to the relevant characteristics of commodity trading institutions, the following five attributes are collected for parametric modeling: p1 = {reputation}, p2 = {professional qualifications}, p3 = {commodity trading success cases}, p4 = {commodity source guarantee}, p5 = {user scale}. For each node i, the node attribute scoring matrix of the expert matrix is ​​constructed: N i =[p1 i p2 i p3 i p4 i p5 i ], where p1 i 、p2 i 、p3 i 、p4 i 、p5 iIt represents the reputation score, professional qualification score, commodity transaction success case score, commodity source score and user scale score of the institution to which node i belongs.

[0062] Construct attribute weight matrix based on expert matrix: C i =[C1C2C3C4C5], where C1, C2, C3, C4, and C5 correspond to the attribute weights of attributes p1, p2, p3, p4, and p5 respectively.

[0063] Then construct an expert matrix to score each node according to the node attribute matrix N i *Attribute weight matrix C i Obtain the weight score of each node and add up the weight scores of all nodes under an organization to obtain the social reputation value A(i) of the organization, that is:

[0064] A(i)=∑C i *N i (1)

[0065] Since node i belongs to the organization, A(i) is the social reputation value of the organization to which node i belongs, also known as the social reputation score.

[0066] In addition to the social reputation scoring of the nodes, this application also performs dynamic reputation scoring of the nodes. Based on some behaviors of the nodes during the consensus process, the dynamic reputation value (also called dynamic reputation score) is calculated in real time. The dynamic reputation scoring mechanism uses data such as node response performance, historical reputation value, and completion rate of reaching transaction consensus as measurement indicators.

[0067] Step 3.2: Calculate the node's delay index based on the node's delay during the commodity transaction process.

[0068] The dynamic reputation scoring mechanism includes calculating the node’s delay index and transaction completion rate. The delay index refers to the delay in node i’s response to various messages during the commodity transaction process, expressed as:

[0069]

[0070] Among them, d ij represents the delay of the jth transaction of node i; d max It indicates the maximum delay allowed by the exchange. If the maximum delay is exceeded, it means that the node fails to execute the transaction. D(i) is the delay index of node i.

[0071] Step 3.3: Calculate the transaction completion rate of the node based on the number of transactions completed by the node during the commodity trading process.

[0072] The transaction completion rate with penalty mechanism in the node dynamic reputation scoring mechanism refers to the proportion of nodes that successfully participate in each transaction after entering the network. The expression is:

[0073]

[0074] Among them, n is the total number of transactions in the system, m is the number of transactions completed by node i. μ is the identifier of whether the transaction is successful, 1 for successful transaction and -1 for failed transaction; that is, if the jth transaction of node i is successful, then μ ij =1, if the jth transaction of node i fails, then μ ij = -1. T(i) is the transaction completion rate of node i. It can be seen that when calculating the transaction completion rate, this application not only takes into account the promotion effect of successfully completing the transaction on the node, but also takes into account the adverse effects of affecting the normal progress of the transaction on the node, which can better distinguish the reputation value of the node.

[0075] Step 3.4: Calculate the node's reputation score based on the node's latency index, transaction completion rate, and the social reputation value of the organization to which the node belongs.

[0076] The reputation score (also called reputation value) of a node is composed of the social reputation value of the organization to which the node belongs and the dynamic reputation score of the node. The calculation formula is as follows:

[0077]

[0078] Among them, C(i) is the reputation score of the node, that is, the reputation value. x is the weight of the node transaction delay, y is the weight of the node's own transaction completion, z represents the degree of influence of the historical reputation value, and k represents the weight of the node's social reputation value, where x+y+z+k=1. The node reputation scoring mechanism comprehensively considers the performance and social reputation of the node in the consensus. If the node delay is smaller, the transaction completion rate is higher, the historical reputation value is better, and the social reputation evaluation is higher, then the reputation value of the node is higher; conversely, the greater the node delay, the lower the transaction completion rate, the worse the historical reputation value, and the lower the social reputation evaluation, then the reputation value of the node is lower.

[0079] In each group, a node with the highest reputation value is elected as the master node to join the main network layer. Because the master node is a high-reputation node obtained through a series of reputation calculations, the stability of the consensus can be guaranteed.

[0080] Step 4: The master nodes and ordinary nodes in each group reach local consensus within their respective groups.

[0081] Figure 3 The figure shows the consensus process of the entire DS-PBFT algorithm. The entire consensus process is mainly divided into two stages: the first stage is to reach a local consensus at the secondary network layer; the second stage is to reach a global consensus at the main network layer.

[0082] See also Figure 2 and Figure 3 , firstly, the master node of the group in the sub-network layer is selected. After each round of consensus, the node with the highest reputation value calculated by the reputation scoring mechanism is selected as the master node, and the other nodes in the group are ordinary nodes. Then each ordinary node in the sub-network layer submits a message confirmation request and timestamp to the corresponding master node in its group, and sends a summary message to other ordinary nodes in the group. The master node of each group packages the messages submitted by the ordinary nodes in the group received within a period of time and sends a response message to each ordinary node. After verification by each ordinary node, the master node and each ordinary node reach a PBFT consensus in the group, and each ordinary node feeds back the submission message to the master node, agreeing that the master node submits the message set in the main network layer. When the master node in the group receives the submission message from f+1 ordinary nodes, it proves that the message has reached a local consensus in this group, and then the master node in this group submits the message set to the master node of the main network layer. Where f represents the maximum number of error nodes allowed; if the number of error nodes in the system does not exceed f, the system can reach a consistent consensus. Therefore, the consent of f+1 nodes can be considered as the minimum number required to reach a consensus.

[0083] Step 5: Add the master nodes in each group to the main network layer to participate in the global consensus.

[0084] See also Figure 3 , the master node in each group broadcasts the packaged message set to the master node of the main network layer. After receiving the message, the master node of the main network layer merges and sorts the message sets submitted by the master nodes in all groups according to the timestamp, and then packs the final message set into a block and signs the block. Then, the message containing the signed block and the block itself is broadcast to the master nodes in all groups to reach a consensus in the main network layer.

[0085] The present application discloses a practical Byzantine fault-tolerant consensus method for commodity transactions in blockchain. On the basis of a two-layer network structure, the nodes are grouped according to the nearest neighbor communication delay in the secondary network layer, and local consensus is performed in each group; then the reputation score of the node is calculated based on the attribute score and dynamic behavior of the organization to which the node belongs, and the high-reputation nodes in each group are added to the main network layer as the master node in each group after voting to participate in the global consensus. On the one hand, the present application improves the efficiency of consensus through grouping and stratification, and on the other hand, reduces the risk of Byzantine nodes being elected as master nodes through the reputation scoring mechanism, thereby taking into account the efficiency and stability of the consensus algorithm.

[0086] In order to verify the performance of the DS-PBFT algorithm proposed in this application, see Figure 4 and Figure 5, the PBFT algorithm, DIG-PBFT (Dynamic Integral Grouping PBFT) algorithm and TB-PBFT (Time-based PBFT) algorithm were selected as the control group of the experiment. In addition to the original PBFT algorithm, the other two algorithms all use a similar layered architecture, so they can provide a more comprehensive evaluation to help determine whether the improved method of this application has advantages in specific aspects.

[0087] See also Figure 4 , the consensus delay formula is expressed as follows:

[0088] T d =T c -T r (5)

[0089] Among them, T d represents the consensus delay, T r Indicates the time when the client initiates the request, T c Indicates the time when consensus ends. T d It depends on factors such as the number of nodes in the network, node distribution, network topology, network performance and consensus algorithm, and has an important impact on the performance, security and scalability of the network.

[0090] In order to compare the consensus delays of the four consensus algorithms, the number of nodes was set to increase from 10 to 50 in the experiment, with a step size of 5. To maintain generality, the consensus was repeated 20 times with different numbers of nodes, and the final value of the consensus delay under different numbers of nodes was the average of the 20 consensuses. Figure 4 The results show that the consensus delay gradually increases with the increase of nodes, but the consensus delay of DS-PBFT in this application is significantly lower than that of DIG-RBFT and TB-PBFT algorithms. It can be shown that through the hierarchical grouping strategy of the DS-PBFT algorithm in this application, when the number of nodes participating in the consensus is large, a low delay can still be guaranteed.

[0091] See also Figure 5 Throughput refers to the number of consensus completed in a unit of time, generally expressed as TPS (Transaction Per Second). It is an important indicator in the performance comparison of consensus algorithms. TPS can be expressed as follows:

[0092]

[0093] Δt represents the time from when the consensus information is sent to when the block storage is completed, i.e. the block time; △tIt indicates the number of transactions completed by each block within the time interval of block generation. The throughput of the system is also related to the network environment and block size. The larger the block, the more consensus times it carries, and the corresponding network load will also increase.

[0094] See also Figure 5 In the experiment, the number of nodes was increased from 10 to 50 with a step size of 5. To avoid loss of generality, 20 tests were repeated with different numbers of nodes. The event volume was set to 1200 for each test. Finally, the average value of the 20 repeated tests was taken as the throughput value for each different number of nodes. Figure 5 As shown in the figure, as the number of nodes increases, the throughput of these four algorithms will gradually decrease, and the throughput of PBFT will drop significantly. The throughput of the other three algorithms is relatively stable, but the throughput of the DS-PBFT algorithm of the present application has been higher than the throughput of the TK-PBFT and DIG-PBFT algorithms. This is mainly because the improved algorithm of the present application performs group consensus and increases the reputation calculation, which greatly reduces the probability of malicious nodes becoming master nodes, and the communication overhead of the system is significantly reduced. Therefore, even when the number of nodes in the system is large, the DS-PBFT algorithm still has a high efficiency.

[0095] See also Figure 6 In the experiment, two groups A and B were set up. The nodes in group A were selected according to the node election rules of the DS-PBFT algorithm of this application, and the nodes in group B were randomly selected for comparative experiments. During the experiment, the performance of all nodes was randomly allocated within the same range, and the consensus success rate was calculated by changing the number of nodes and taking the average value of multiple experiments.

[0096] like Figure 6 As shown, the consensus success rate of group A does not change much with the increase of the number of nodes, and has always been at a high level, with an average success rate of about 98.6%; the consensus success rate of group B shows a downward trend with the increase of the number of nodes. The nodes in group A are all selected according to the node election rules of the DS-PBFT algorithm of this application, which can ensure that the selected nodes have better performance and stability; while the nodes in the control group B are all randomly selected, the performance gap between the nodes is large and there may be malicious nodes. Therefore, as the number of nodes continues to increase, the consensus success rate of this group decreases.

[0097] The practical Byzantine fault-tolerant algorithm consensus process of the double-layer network structure proposed in this application first reaches a consensus locally and then achieves a global consensus. The advantage of the hierarchical structure makes it unnecessary for nodes to communicate with all nodes in the network during the consensus process, thereby greatly reducing the communication time of nodes in the network. On this basis, a grouping strategy based on communication delay and a comprehensive credit scoring mechanism are adopted at the same time, taking into account the efficiency and stability in the consensus process. The above experimental results show that the DS-PBFT algorithm of this application has different degrees of improvement compared with the traditional PBFT algorithm in terms of improving data throughput, reducing consensus delay and ensuring node reliability. It can solve the inefficiency of the original PBFT consensus algorithm in commodity trading scenarios due to large-scale blockchain nodes and high throughput. The problem, can achieve rapid consensus between nodes, and achieve the purpose of rapid response of commodities in blockchain-based transactions.

[0098] In an exemplary embodiment, the present application also proposes a practical Byzantine fault-tolerant consensus device for commodity transactions in a blockchain, comprising the following functional modules.

[0099] The two-layer network structure division module is used to initialize the alliance chain network nodes and divide them into a two-layer network structure including the main network layer and the secondary network layer.

[0100] The communication delay grouping module is used to group nodes according to their nearest neighbor communication delays at the secondary network layer based on the double-layer network structure.

[0101] The DBSCAN clustering algorithm is used to group all consensus nodes according to the nearest neighbor communication delay, so as to achieve low network communication delay for nodes in a single group, thereby reducing the overall cost of the entire network communication. After clustering and grouping according to the nearest neighbor communication delay in the secondary network layer, local group consensus is performed within multiple groups.

[0102] The reputation score calculation module is used to calculate the reputation score of the node based on the attribute score of the organization to which the node belongs and the dynamic behavior of the node in the commodity trading process after each round of consensus. The node with the highest reputation score in each group is periodically selected as the main node in the group, and the other nodes in the group are treated as ordinary nodes.

[0103] The social reputation score of the institution to which the node belongs is calculated by constructing an expert matrix. The attribute scoring matrix of the institution to which the node belongs mainly includes five indicators: institutional reputation, professional qualifications, successful commodity trading cases, commodity source guarantee, and user scale. The dynamic reputation score in the node consensus uses data such as node response performance (represented by the delay index), historical reputation value, and transaction completion rate that reaches transaction consensus as measurement indicators.

[0104] Initialize the node reputation value, and then calculate the node reputation value after each round of consensus. The reputation value is calculated comprehensively according to the attribute score of the node's organization and the dynamic reputation score in the node consensus, and all nodes in each group are sorted in descending order by reputation value. After each round of consensus, the node with the highest reputation value in each group is periodically selected as the master node of the group to join the main network layer to participate in the global consensus.

[0105] The local consensus module is used for the master nodes and ordinary nodes in each group to reach local consensus within their respective groups.

[0106] The entire consensus module is used to add the master nodes in each group to the main network layer to participate in the global consensus.

[0107] In an exemplary embodiment, the present application also provides a computer device, which may be a server or a terminal. The computer device includes a processor, a memory, an input / output interface, and a communication interface. The processor, the memory, and the input / output interface are connected via a system bus, and the communication interface is connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, the practical Byzantine fault-tolerant consensus method for commodity trading in the blockchain is implemented.

[0108] In an exemplary embodiment, the present application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the practical Byzantine fault-tolerant consensus method for commodity transactions in a blockchain.

[0109] In an exemplary embodiment, the present application also provides a computer program product, including a computer program, which, when executed by a processor, implements the practical Byzantine fault-tolerant consensus method for commodity transactions in a blockchain.

[0110] It can be understood by a person of ordinary skill in the art that all or part of the processes in the above-mentioned embodiment method can be completed by hardware related to computer program instructions, and the computer program can be stored in a non-volatile computer-readable storage medium, and the computer program can include the process of the embodiment of the above-mentioned method when executed. Among them, any reference to memory or other media in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM may be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).

[0111] It should be noted that the information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.

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

[0113] This article uses specific examples to illustrate the principles and implementation methods of this application. The description of the above embodiments is only used to help understand the method and core ideas of this application. At the same time, for those skilled in the art, according to the ideas of this application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting this application.

Claims

1. A practical Byzantine fault-tolerant consensus method for commodity transactions in blockchain, characterized in that: include: Initialize the alliance chain network nodes and divide them into a two-layer network structure including the main network layer and the secondary network layer; Based on the two-layer network structure, nodes are grouped according to their nearest neighbor communication delays at the secondary network layer; After each round of consensus, the reputation score of the node is calculated based on the attribute score of the organization to which the node belongs and the dynamic behavior of the node in the commodity trading process. The node with the highest reputation score is periodically selected in each group as the master node in the group, and the other nodes in the group are treated as ordinary nodes. The master nodes and ordinary nodes in each group reach local consensus within their respective groups; Add the master nodes in each group to the main network layer to participate in the global consensus.

2. The practical Byzantine fault-tolerant consensus method for commodity transactions in blockchain according to claim 1, characterized in that: The alliance chain is jointly constructed by several commodity trading related institutions, and each institution has multiple nodes.

3. The practical Byzantine fault-tolerant consensus method for commodity transactions in blockchain according to claim 2 is characterized in that: The grouping at the secondary network layer according to the nearest neighbor communication delay of the node specifically includes: The DBSCAN clustering algorithm is introduced to group all nodes in the commodity trading process according to the nearest neighbor communication delay.

4. The practical Byzantine fault-tolerant consensus method for commodity transactions in blockchain according to claim 3 is characterized in that: The node reputation score calculation based on the attribute score of the organization to which the node belongs and the dynamic behavior of the node in the commodity trading process specifically includes: Construct an expert matrix to perform parameterized design and modeling of node attributes, and calculate the social reputation value of the node's institution based on the attribute score of the node's institution; Calculate the node's delay index based on the node's delay in the commodity trading process; The transaction completion rate of the node is calculated based on the number of transactions completed by the node during the commodity trading process; The node's reputation score is calculated based on the node's latency index, transaction completion rate, and the social reputation value of the organization to which the node belongs.

5. The practical Byzantine fault-tolerant consensus method for commodity transactions in blockchain according to claim 4, characterized in that: The master nodes and ordinary nodes in each group carry out local consensus in their respective groups, specifically including: Each common node in the secondary network layer submits a request and timestamp to the corresponding master node in its group, and sends a summary message to other common nodes in the group; The master node packages the messages submitted by the ordinary nodes in the group received within a period of time and sends a response message to each ordinary node; After verification by each ordinary node, the master node and each ordinary node reach a PBFT consensus within the group. Each ordinary node submits the message to the master node and agrees that the master node will submit the message set at the main network layer. When the master node in a group receives a commit message from f+1 ordinary nodes, it proves that the message has reached a local consensus within the group. The master node in the group then submits the message set to the master node of the main network layer; where f represents the maximum number of erroneous nodes allowed.

6. The practical Byzantine fault-tolerant consensus method for commodity transactions in blockchain according to claim 5, characterized in that: The adding of the master nodes in each group to the main network layer to participate in the global consensus specifically includes: The master node in each group broadcasts the packaged message set to the master node of the main network layer; After receiving the message, the master node of the main network layer merges and sorts the message sets submitted by the master nodes in all groups according to the timestamp, then packs the final message set into a block and signs the block. Subsequently, the message containing the signed block and the block itself is broadcast to the master nodes in all groups to reach a consensus in the main network layer.

7. A practical Byzantine fault-tolerant consensus device for commodity transactions in blockchain, characterized in that: include: The two-layer network structure division module is used to initialize the alliance chain network nodes and divide them into a two-layer network structure including the main network layer and the secondary network layer; The communication delay grouping module is used to group nodes according to the nearest neighbor communication delay at the secondary network layer based on the double-layer network structure; The reputation score calculation module is used to calculate the reputation score of the node based on the attribute score of the organization to which the node belongs and the dynamic behavior of the node in the commodity trading process after each round of consensus. The node with the highest reputation score in each group is periodically selected as the master node in the group, and the other nodes in the group are treated as ordinary nodes; The local consensus module is used for the master nodes and ordinary nodes in each group to reach local consensus within their respective groups; The entire consensus module is used to add the master nodes in each group to the main network layer to participate in the global consensus.

8. A computer device comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement a practical Byzantine fault-tolerant consensus method for commodity transactions in a blockchain as described in any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the practical Byzantine fault-tolerant consensus method for commodity transactions in a blockchain as described in any one of claims 1 to 6 is implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the practical Byzantine fault-tolerant consensus method for commodity transactions in a blockchain as described in any one of claims 1 to 6 is implemented.

Citation Information

Cited By

  • Fragmentation Byzantine fault-tolerant consensus optimization method for cold-chain logistics

    CN120151355A

  • A sharding byzantine fault tolerance consensus optimization method for cold chain logistics

    CN120151355B

  • Supply chain full-process traceability system based on digital twinning and block chain

    CN120338832A

  • Medical instrument data protection method and system based on Byzantine consensus algorithm

    CN121151020A

  • Data management method and device, electronic equipment, storage medium and product

    CN121387891A