1. Introduction
A new type of social ecosystem that can connect the physical and virtual worlds is flourishing as the multiple demands for virtual reality increase. However, with the rapid growth in data volume and data value, the evolving metaverse faces the needs and challenges of privacy, security, high synchronization, and low latency. Fortunately, the evolving blockchain can be used to fulfill the trusted constructs, data interactions, and computational needs of the metaverse [
1]. Since the birth of Bitcoin [
2], blockchain [
3] has been used to build a new model for the establishment and transmission of trust in an environment of distrust with its characteristics of immutability, openness, and transparency. Blockchain applications have reached all aspects of society from the initial field of digital currencies to smart cities, cryptocurrencies, and healthcare [
4,
5,
6]. For instance, the secure storage and sharing of healthcare data is an essential issue, and storing and sharing medical records on the blockchain offers a substitute to the traditional healthcare sector, which relies on wireless wearable devices and medical applications to provide healthcare services [
7].
Blockchain-related technologies are used to facilitate asset trades in order to fulfill the demand for digital asset trading. To ensure the accuracy of transaction results, blockchain networks offer services by choosing nodes, building distributed ledgers, and choosing consensus procedures [
8]. Many scholars have begun to conduct in-depth research on the application of digital asset scenarios.
For example, the present condition of the digital asset copyright market and issues with asset protection were examined in [
9] along with the applicability of blockchain in digital copyright management and protection. Digital asset management, decentralized off-chain storage, and artificial intelligence model design were merged in [
10] to create a more intelligent, GDPR-compliant framework for digital assets. To assist the intellectual property protection of digital content, safeguard the legitimate rights and interests of authors, and lower the cost of copyright protection, [
11] developed a digital asset copyright depository platform using blockchain technology. To deal with the issue of central oversight based on a big platform and a huge database, as well as the challenge of collaborative development, [
12] proposed the construction approach of a specialized disease repository based on a reliable information chain. Incorporating distributed ledgers, smart contracts, and asymmetric cryptography, [
13] introduced a corporate information management system to increase the security and applicability of enterprise data assets.
In summary, scholars have analyzed the feasibility of blockchain technology to solve the problem of the current situation of digital assets. However, as market demands have changed, the performance of digital asset systems based on blockchain technology has become a constraint, such as consensus efficiency, communication complexity, and reliability. Aiming at the relatively little research on the consensus mechanism of digital asset transaction scenarios, a grouped multilayer consensus algorithm GM-PBFT is proposed based on the improvement of the PBFT and Raft algorithm [
14]. The principal work of this paper is as follows.
- (1)
A grouped multilayer-based PBFT consensus algorithm GM-PBFT is proposed to optimize and be improved by node grouping strategy, supervisory strategy, and grouped multilayer consensus process for the PBFT algorithm.
- (2)
The GM-PBFT algorithm is evaluated experimentally and compared with the PBFT algorithm in terms of communication overhead, consensus delay, and throughput.
- (3)
The node grouping strategy of GM-PBFT and the supervision strategy of supervising nodes are discussed to prove the security of the algorithm and to demonstrate the effectiveness of the algorithm.
3. GM-PBFT Algorithm Design
Despite possessing more communication complexity, the PBFT algorithm provides greater Byzantine fault tolerance. The Raft algorithm consensus is efficient and has excellent scaling performance but has no Byzantine fault tolerance. With the combination of the Byzantine fault-tolerant feature of the PBFT algorithm and the efficient consensus of the Raft algorithm, a multi-component layer consensus algorithm GM-PBFT is proposed.
The GM-PBFT algorithm consists of three parts: node grouping policy, supervisory policy, and grouping multilayer consensus. The nodes are accurately classified into different consensus groups by their professional background and application experience attributes. The pheromone concentration of the ant colony optimization algorithm [
28] is employed within the group to find the optimal nodes within the group to ensure the accurate division of the sample.
The node with the highest pheromone concentration acts as a supervisory node to supervise the leader of the consensus of the Raft algorithm at the end layer and guarantees the reliability of the consensus through validation, auditing, and reselection mechanisms. The grouped multilayer consensus is performed by the leader node through the PBFT algorithm for hierarchical recursive consensus to reduce the communication complexity of the system. The overall design of the GM-PBFT algorithm is shown in
Figure 1.
Assuming a digital asset trading scenario as shown in
Figure 2, the merchant publishes relevant information services, and the purchaser queries for information according to their demands. The ledger is created in accordance with the specifics of the transaction when the buyer and seller successfully arrange a trade for e-book rights. For instance, the information such as the price of the item, the age of the item, and the accounts of both parties.
A transaction consensus request is generated through the contract and sent to the blockchain network. The blockchain network will generate a consensus on the transaction and return the result to both parties of the transaction. However, the communication complexity during consensus is too high, which will lead to a higher probability of node error as well as lower consensus efficiency. The administrator node is adopted to supervise the consensus phase to secure the consensus phase.
When the commodity consensus group receives the client request from the main node, it will initiate consensus on the transaction content within the group and send the result to the main node with its consensus success. The main node sorts and packages the transactions with successful consensus to generate blocks and sends the blocks to each transaction consensus group to guarantee the consistency of the block ledger of each node.
3.1. Node Grouping Strategy
The administrator will oversee the consensus process while the merchant and the customer will negotiate the transaction’s terms. A total of three parties are involved in the digital asset transaction process: the administrator, the merchant, and the customer. The node can handle transactions normally, or it can be a master node that manages transaction consensus, or it can be a supervisory node before the consensus stage, where each node can be categorized by transaction type.
Blockchain networks have similarities with the traveler’s problem, so it is feasible to use the ant colony algorithm to solve the node pheromone concentration in digital asset transactions. The ant colony method and node contact range are assessed for integration based on the properties of blockchain theory, as well as the procedure and mechanism of digital asset transactions. The nodes in the group are processed by an ant colony optimization algorithm to find the highest pheromone node in the group to act as the supervisory node. Higher pheromone concentration indicates that the node is more closely connected to other nodes in the group and has a higher trust degree.
The nodes in the group are numbered, the frequency of contact between nodes corresponds to the pheromone concentration, and the probability of no contact between nodes corresponds to the pheromone volatilization coefficient. The search strategy of the ant colony optimization algorithm is modified, and a node within the group is randomly selected as the starting point for matching. In the ant colony algorithm,
denotes that at the moment t, the artificial ant m starts at node i, then the probability of matching with node j is:
In the formula,
is the pheromone concentration between node i and node j, and
is the set of all nodes in the group.
is the heuristic factor affecting the nodes, and the heuristic function expression is as follows:
In the formula,
and
are the difficulty of negotiation between the merchant and the customer; a harder negotiation implies a smaller
. C is the number of valid matches in the current node matching.
is the pheromone increment on
that ant m explores effective matches to stay on
,
is the pheromone volatilization coefficient in the system, and
is the pheromone residual coefficient,
. Then, the amount of pheromone that node i matches with node j at moment
is updated as follows:
All nodes in the group need to be updated with pheromones in order to comply with the requirements of multi-objective transaction matching. The improved ant colony algorithm searches for the optimal solution between the nodes in each group through pheromone concentration. The node corresponding to the optimal solution can provide a supervisory node for the group consensus in the later stage, which improves the efficiency of the transaction matching between the two sides.
3.2. Supervision Strategy
The nodes in the k layer form a committee using the Raft consensus algorithm with three roles: leader, follower, and candidate. The leader decides whether to store new log messages and has the power to send data or not. Raft consensus node roles are able to change between the leader, follower, and candidate as conditions persist.
When a node joins the system, the committee determines whether there is a leader and if so, the node’s role is that of a follower. The system will only ever have one leader at any given time. In the event that there is no communication between the leader and other nodes, the committee elects the leader once more, and the follower becomes a candidate. The candidate will send a voting request to other nodes to apply to become the new leader. This candidate will be elected as the leader if it receives confirmation messages from more than half of the nodes within the time period, and the other nodes will be converted from candidates to followers.
In the log replication stage, all transactions are packaged by the leader to generate blocks and broadcast messages to the followers. The leader in the Raft algorithm is the strong leader; when more than half of the followers’ replies are received, the leader will send an acknowledgment message to all the nodes, and the block will be submitted to the chain. If the leader node is a malevolent node and sends false messages to the followers, it has an impact on the consistency of the consensus process. This paper changes this situation by introducing supervisory nodes.
Supervisory nodes monitor the behavior of leaders in the group; in order to ensure that the supervision is effective, the supervisory nodes do not participate in the election of the leader and only participate in the group as a follower of the Raft consensus. When the supervisory node receives the leader log message, it needs to verify the signature for comparison, and the malice-free node will broadcast the message within the group. Supervisory nodes are regulated in three steps for leaders: validation, vetting, and re-election.
- (1)
Verification: When the leader transmits a log message to a follower during the group Raft consensus phase, it is required that they both sign the message. The supervisor node collects the log messages sent by the leader to the followers and compares and verifies them. When the supervisory node successfully completes the verification, it demonstrates the consistency of the log messages transmitted to the followers. The supervisory node will examine the leader if he or she posts a false message.
- (2)
Auditing: The supervising node sends a verification request message to the follower and the follower sends a log message to the supervising node to review the leader. The supervisory node finds that the follower receives the log message inconsistently by comparison, and then it decides that the leader node is a malicious Byzantine node.
- (3)
Re-election: The supervising node requests the committee to remove the leader’s status and resume the leader election process after concluding that the leader is an evil Byzantine node.
Supervisory nodes can decrease the possibility of leader misbehavior through verification, auditing, and re-election mechanisms. Raft consensus in the group introduces the monitoring method; the supervision node can spot the leader’s sinister behavior in time and start the process of electing a new leader to guarantee the safety of the consensus stage.
3.3. Group Multilayer Consensus
Based on the type of asset transaction, the consensus nodes are divided into various groups, such as the commodities transaction consensus group, the securities transaction consensus group, the artwork transaction consensus group, and the cryptocurrency transaction consensus group. Each transaction consensus group is responsible for validating the relevant transaction affairs and communicating the validation results to the consensus group’s main node. The individual transaction consensus groups sort and package the successfully validated transactions and generate blocks.
To ensure the consistency of the groups’ ledgers, the main node transmits the created block to each transaction consensus group at the end. The GM-PBFT is applied to the upper node PBFT consensus pseudocode, which is designed as follows (Algorithm 1):
Algorithm 1: GM-PBFT upper node consensus pseudocode. |
Input: transaction request v is the view number, n is the sort number, and d is a summary of the client request message m. Output: consensus to k layer 1. the main node sorts the messages received from the client; 2. begin initializing the first layer a = 0; 3. for a = 0 to k do 4. send a request message to the next level node; 5. while request valid = true do 6. send pre-prepare message; 7. number = 1; 8. if prepare valid = true then 9. number = number + 1; 10. if number > 2f + 1 then 11. send commit certificate; 12. end 13. if commit valid = true then 14. send reply client; 15. end 16. end 17. end while 18. a = a + 1; 19. end for 20. send consensus request to k layer; 21. end |
Taking the commodity group as an example, node A22 is the leader, nodes A31, A32, A33 and G1 are the followers, and node G1 is also the supervising node. Node G1 is responsible for supervising node A22 to prevent the leader from sending false messages. This is so that the group’s consensus cannot remain consistent once the leader transforms into a resentful Byzantine node and begins to send messages to the other nodes.
The three steps of the consensus process are the pre-preparation stage, the preparation stage, and the submission stage. The top layer of nodes employs the PBFT algorithm consensus. In the pre-preparation stage, a client message is broadcast by the main node S to the slave nodes A11, A21, A22, A23, and A24. In the preparation stage, the preparation messages are broadcast by the slave nodes A11, A21, A22, A23, and A24 after receiving the pre-preparation messages sent by the main node S. In the commit stage, the main node S broadcasts an acknowledgment message to all consensus nodes and receives acknowledgment messages from other nodes. When it receives no less than valid confirmation messages, it is determined that the node has completed the three stages of consensus. The consensus result is delivered to the next layer and the PBFT algorithm consensus is continued until the K layer is reached.
The Raft algorithm consensus is used by the layer k nodes, and A22 packages the transaction to generate a block and broadcasts it to A31, A32, A33, and G4. When a majority of the follower replies are received for confirmation, A22 sends the validation confirmation to all the nodes.
Since the leader might turn out to be a malicious node, a supervisory policy mechanism is used to regulate the leader’s behavior in sending messages.
Figure 3 shows a multilayer consensus model based on node attribute grouping.
3.4. GM-PBFT Consensus Process
All nodes can be classified via preprocessing based on node attributes prior to the consensus phase of the group of nodes. The enhanced ant colony algorithm sorts the nodes into groups according to their pheromone concentrations. The node in the group with the highest pheromone concentration is the supervisory node, while the other nodes are regular nodes.
The first layer master node initiates a PBFT consensus request to the second layer node, and the result is sent to the first layer master node and delivered to the client after successful consensus. The second layer master node initiates another submission request to the next layer, which is executed recursively until the kth layer node. The kth layer node forms a committee with the leader node of the previous layer, and the leader and the kth layer node perform the Raft algorithm consensus. For the sake of the consistency of the messages provided by the leader, the kth layer also adds supervisory nodes.
The supervising node collects messages from other nodes and validates the leader message after receiving it to ensure its accuracy. The log message is then broadcast to other nodes after passing to complete the verification within the group. The overall process is shown in
Figure 4.
Accessing the first layer of the blockchain network, the main node and the second layer nodes form a consensus group. When the main node receives a client proposal, it propagates the message to the , , and nodes. The slave node receives the pre-prepared message from the main node and starts to verify the legitimacy of the consensus node. It propagates a vote message with its own vote to the whole network if the verification is passed and writes it in the message log. The master node propagates an acknowledgment message with its own vote value to the whole network and collects acknowledgment messages from other nodes.
If the consensus node receives no less than
confirmation messages, it initiates the PBFT consensus request with the consensus result to the next layer nodes in the same group. In this context, f is the number of Byzantine nodes in the group,
indicates the bth node of the ath layer, and the first layer PBFT consensus flow is shown in
Figure 5.
When the leader node
receives the proposal, it propagates the message to the nodes
,
, and
The second layer node
sends the message to all the nodes in the third layer and each node will receive the relevant information such as node signature, view number, etc. After the pre-preparation phase receives the message, the preparation phase generates a certificate and the submission phase will wait for at least
nodes’ same node signature, view number, and other related information. Receiving the certificate of the submission phase, the request message is sent to the leader node and passed to the client. The leader node of the third layer makes a submission to the same group of lower layer nodes to launch the PBFT consensus request again, and there is a recursive consensus to the last layer. The second layer PBFT consensus process is shown in
Figure 6.
The upper layer PBFT consensus node will take over as the Raft consensus leader once the consensus request reaches layer k. Within the group, the leader conveys a message to all followers after collecting all transactions into a block and broadcasting it to the group as a whole. The block is added to the chain when the leader sends an acknowledgment message to every node and more than half of the followers have responded.
If the node reply threshold is not reached, the supervising node triggers the leader reselection mechanism to perform the group Raft consensus again. In case the leader appears as a Byzantine node, the supervisory strategy will be used.
represents group b in layer a, and
represents the leader node of group b in layer a. The K layer Raft consensus process flowchart is shown in
Figure 7.
4. Analysis of the Experiment
With the GM-PBFT algorithm as a consensus algorithm for federated chains, it is necessary to work with a system with a small number of malicious Byzantine nodes by simulating the blockchain network and experimentally recording the transaction data latency and throughput during the consensus process. In this section, four aspects of communication overhead, delay, throughput, and fault tolerance are analyzed to compare the results of pre- and post-optimization to experimentally demonstrate the advantages of the GM-PBFT consensus algorithm.
4.1. Experimental Environment
First, configure the Ubuntu operating system and virtual machine on the PC and allocate memory and disk size for the virtual machine. Next, install the Docker environment on the Ubuntu system, then download the Fabric version 2.2 source code and extract it to install and configure it. Run the byfn.sh script to start the Fabric network by going to ~/gowork/go/src/github.com/hyperledger/fabric/scripts/fabricsamples/first-network/trade.
Using the go language to write auto-executable code encapsulated into a corresponding smart contract such as trade.go, after starting the cli and nodes, execute the peer chaincode, and install -n basic -v 1.0-p github.com/chaincode/trade command to install trade.go in the docker container. Simultaneously with the initial end page code, the backend logic code is packaged, uploaded, and deployed to the server. The remote client then accesses the digital assets to trade the system and run latency and throughput performance tests.
4.2. Communications Overhead Analysis
The PBFT consensus mechanism requires two-two nodes to communicate with a traffic of , and N is the number of nodes. The Raft consensus mechanism has a traffic of O(N), and by grouping the network, the traffic of GM-PBFT decreases from to , abd k is the number of partitioned groups, compared to the PBFT consensus mechanism.
The number of communication times between nodes in the blockchain network represents the communication complexity; a lower number of times means the communication complexity is lower, and the scalability of the system is better. The number of communication times required for the consensus of the GM-PBFT algorithm is contrasted with that of the traditional PBFT algorithm. The number of node layers of the blockchain network is k (k ≥ 3), the number of nodes in each layer is n (n ≥ 3), and the total number of nodes is N.
As the blockchain network adopts the PBFT algorithm for consensus, the main node sends a pre-prepared message to the slave nodes with a communication count of
. The slave nodes send a prepared message to the rest of the nodes with a communication count of
. All the nodes will send acknowledgment messages to other nodes for
The consensus node will send a reply message to the client, and the number of the communication is N. Then the number of PBFT consensus communications is:
As the blockchain network adopts the GM-PBFT algorithm for consensus, in the case of a trademark consensus group, the number of communications for the first
layers to perform PBFT consensus is
. k layers use the Raft algorithm for consensus, and the leader broadcasts blocks to the followers as well as the supervisory node, with a number of communications of n. The supervisory node collects the follower logs, with a number of communications of
. The submit phase supervisory node sends a confirmation message to followers and validation message to leaders with a communication count of
. GM-PBFT consensus communication count is:
When
, the communication overhead required for a single consensus of the GM-PBFT consensus algorithm is analyzed and compared with the traditional PBFT algorithm.
Figure 8 shows the comparison of the effect of the number of nodes on the communication overhead.
From the figure, it is known that the communication complexity of both the GM-PBFT and the PBFT consensus algorithms increase with the increase in the number of nodes in the same network situation. As the number of nodes increases, more neighboring nodes need to communicate, thus increasing the communication complexity. When the number of nodes is the same, the communication overhead of the GM-PBFT consensus algorithm is lower than that of the PBFT consensus algorithm. The PBFT consensus algorithm can lead to a significant increase in the performance of the Byzantine fault-tolerant consensus, but the communication complexity is still huge.
The GM-PBFT consensus algorithm effectively reduces the number of consensus communications when the number of nodes increases. When the number of nodes at each layer in the system is 30, the number of GM-PBFT communications is reduced significantly compared to the PBFT algorithm. The beneficial effect of lower communication overhead increases as the system’s nodes are superior to 50.
4.3. Delay Analysis
Delay is an essential property indicator that measures the efficiency of the consensus algorithm as well as the performance of the blockchain network. It refers to the time it takes from the client initiating the request to the block successfully being uploaded to the chain. If the transaction experiments take less time, it means the consensus is reached more quickly and the system performance of the blockchain system is better.
represents the time delay,
represents the moment of initiating the transaction request, and
represents the moment of completing the transaction confirmation. The consensus delay calculation formula is shown below:
The average value of the data from several experiments is used as the end result to test the consensus latency. This section of the experiment tests the GM-PBFT algorithm and PBFT algorithm for different numbers of nodes in the system network when the number of nodes in the system network is 10 to 100, respectively, and compares and analyzes the change in transaction delay. The time interval of each transaction message generation and chaining is calculated, which is converted to transaction delay, and some of the selected data are plotted as folds.
Figure 9 shows the comparison of the impact of the number of nodes on the consensus delay.
Based on the graph, the consensus delays of the two methods increase gradually as the number of nodes rises; however, the GM-PBFT algorithm’s delay increases more gradually while the PBFT algorithm’s delay increases more dramatically. The grouping of several layers during the consensus process changes when there are more than 50 nodes, and the increased consensus performance of the GM-PBFT algorithm has some bearing on the consensus time.
The single-layer PBFT consensus method and the GM-PBFT algorithm described in this paper generally perform well in terms of latency as the number of nodes increases, with GM-PBFT having lower latency than the standard PBFT for the same number of nodes. Therefore, the GM-PBFT method can significantly reduce latency when used with large nodes.
4.4. Throughput Analysis
In blockchain systems, throughput refers to the number of transactions per second (TPS) processed by the system, reflecting the system’s ability to process transaction information. A high throughput of transaction data implies that the consensus algorithm used has a good performance.
is the time to complete the transaction consensus, and Transactions is the total number of transactions processed during the time to complete the transaction consensus. The throughput is calculated by the formula:
The GM-PBFT algorithm and the PBFT method were tested on multiple occasions in an environment with various numbers of nodes to assess transaction throughput, and the average value of the experimental data was taken as the test results. The average time to complete 1000 transactions of the two algorithms was recorded, and the transaction throughput was calculated by the generation time of each block and the number of transactions in the block.
Figure 10 shows the comparison of the impact of the number of nodes on throughput.
From the figure, it is known that the throughput of consensus algorithms decreases gradually with the increase in the number of nodes. The TPS of the GM-PBFT algorithm is much larger than the PBFT consensus algorithm with the same size of nodes. The throughput of the blockchain system increases because of the grouped multilayer consensus of the GM-PBFT algorithm. With the increasing size of nodes in the system, the transaction volume will increase, and the throughput of the two algorithms will gradually decrease due to the influence of the upper limit of communication bandwidth. The throughput of the GM-PBFT algorithm is always larger than that of the PBFT algorithm in the whole consensus process, which can handle more transactions per unit of time and is suitable for the environment of a coalition chain with high throughput requirements.
4.5. Fault Tolerance Analysis
In terms of fault tolerance, the upper layer consensus phase of the GM-PBFT algorithm is guaranteed by the PBFT consensus algorithm, in which the messages of pre-prepare, prepare, and commit need to be completed in the same view. All messages need to conform to the PBFT consensus process for digest, sequence number, and verification of signatures. The consumption time is shorter than the node-triggered view switching time. The last layer consensus phase adopts the Raft algorithm and the supervisory node row supervisory leader, which makes the in-group consensus resilient to malicious Byzantine behavior.
The security of the GM-PBFT algorithm’s end layer consensus is guaranteed by the supervisory nodes, which makes the consensus resistant to malicious Byzantine behavior and enhances the security of the end Raft consensus. Ordinary nodes only submit log messages to the chain when they receive a commit message from the N-1 layer leader and verify that the message turns out to be true. The traditional PBFT algorithm has a fault tolerance of N/3, but with the GM-PBFT algorithm with the addition of the Raft algorithm and the supervisory nodes, the fault tolerance will be higher than N/3. Therefore, the GM-PBFT algorithm improves the fault tolerance of the system consensus, and there is an improvement in the security of the system. A comparison of the performance of this optimized algorithm with other commonly used consensus algorithms was made and the results are shown in
Table 1.