Performance Analysis of Blockchain Consensus System With Interference Factors and Sleep Stage

Blockchain system is affected by many factors with the rapid development of technology. In order to study the blockchain system more realistically, the processes of transaction consensus and transaction storage are simulated in this paper, and factors such as interference factors, impatience phenomena of transactions and fault repairable conditions of the system during the service process are considered. Vacation queueing model with negative customers, impatient customers, repairable fault and two-phase service that customers can select sever in the first service is established. Using the matrix-geometric solution method, the expressions of the average confirmation time of transactions and other performance measures are given. The parameters of the system are obtained based on the statistics of the blockchain transaction data. The influence of each parameter on the performance measures of blockchain system is analyzed by using MATLAB software. The equilibrium reception rate is discussed by constructing the revenue function of the system, and equilibrium numerical results are obtained.


I. INTRODUCTION
Blockchain is a decentralized, public, safe, point-to-point transporting and distributed ledger [1], [2]. Since the concept of blockchain was proposed, blockchain technology had developed rapidly and played a greater application value in finance, Internet of Things, public services, legal affairs, medical hygiene and other areas [3]- [7]. Om et al. [8] analyzed infrastructure condition of the public key in blockchain system and discussed key management method of blockchain wallet, which improved the confidentiality of blockchain network accounting. Chen et al. [9] proposed a distributed blockchain model to protect the sensitive information of users, and a protocol for maintaining the blockchain ledger were proposed to maintain the good operation of the client system. Zhao et al. [10] proposed new privacy protection software which updated protocol based on blockchain, and the delivery certificate of Internet of Things is analyzed.
Nakamoto [11] proposed decentralized and distributed accounting firstly, then he introduced the fundamental The associate editor coordinating the review of this manuscript and approving it for publication was Halil Yetgin . operation mechanism of blockchain, which laid a theoretical foundation for the study of blockchain system. The blockchain system mainly includes six parts: data, contract, incentive, network, consensus and application, and the consensus is the main component of the blockchain system. The consensus process solves the problem of trust in the blockchain, which allows each transaction to be treated fairly and makes the results more objective and equal [12]. The consensus algorithms currently studied mainly include Proof of Work (POW), Proof of Stake (POS), Delegated Proof of Work (DPOW), Delegated Proof of Stake (DPOS) and Practical Byzantine Fault Tolerance Algorithm (PBFT).
More and more scholars optimize the consensus algorithm and apply the consensus mechanism in the blockchain system to practice. Alberto et al. [13] provided a control method of anonymous access for wireless network by applying blockchain technology, and wireless network congestion is avoided by using Proof of Work mechanism. Wang et al. [14] emphasized the characteristics of decentralized consensus in the blockchain network, which provided a new perspective for the study of the design of distributed consensus systems and incentive mechanisms. Kim [15] maximized the efficiency of the blockchain system through the sharding mechanism by using game method in the consensus mechanism. Lone and Mir [16] analyzed the consensus protocol of the existing blockchain platform, feasibility and work efficiency of consensus protocol were determined, and main parameters in consensus mechanism were discussed. Singh and Vardhan [17] applied a blockchain system with consensus mechanism to real estate transactions that has a risk of deception, which can effectively prevent existing transactions from being offset by invasive activities. In view of the fact that ordinary counting scheme can not guarantee the credibility of the system, Li et al. [18] proposed a blockchain electronic counting scheme with the Byzantine fault tolerance protocol. Hu et al. [19] applied the Byzantine fault-tolerant consensus mechanism to the information authentication of the Internet of Vehicles, which not only ensured information security, but also improved the efficiency of the consensus node.
Due to the complexity of the network, the blockchain system is also difficult to avoid threats to the security of the blockchain network [20]- [21]. At present, attack methods that threaten the security of the blockchain network are Sybil attack [22], Eclipse attack [23] and DDoS attack [24]. The node which can threaten the security of the blockchain system and threaten the integrity of the consensus process is called malicious node. So it is more important to identify malicious nodes efficiently and accurately, and replace and handle malicious nodes in time. Chicarino et al. [25] detected malicious nodes in the blockchain networks with Proof of Work consensus algorithm by using heuristic method to avoid network attacks. Yang et al. [26] introduced Delegated Proof of Stake in Proof of Work to improve the consensus algorithm, which can quickly find and replace malicious nodes and effectively improve the security of the blockchain system. She et al. [27] applied the blockchain trust mechanism to detect malicious nodes in wireless sensor networks, which could trace the process of detection. With the increase of the number of transactions and the complexity of transaction content, the blockchain network also has the problem of transaction queueing congestion. To alleviate network congestion, Ahn et al. [28] proposed a packet aggregation scheme based on Byzantine Fault Tolerance Algorithm. In addition to the above problems, the blockchain network may also be affected by many factors such as network viruses and system losses [29]. Now, many scholars have applied the queueing theory to the studies of the fundamental theory of blockchain system. Srivastava [30] analyzed the waiting time of transactions, and evaluated blocks acceptance by establishing a M/M/1 queueing model. Li et al. [31] designed a GI/M/1 queueing system with two different service stages, which simulated the processes of mining and building the new blockchain to obtain the average number of transactions in the queue, the average number of transactions in each block and the average confirmation time of transactions in the steady state of the system were obtained by using the matrix-geometric solution method. Li et al. [32] extended the service time from the exponential distribution to PH distribution, the steady-state of the blockchain system was analysed by using the matrix-geometric solution method, and then the queueing waiting time and average transactions number of the blockchain system were obtained. Kasahara et al. [33], [34] studied the transaction confirmation process based on an M/G b /1 queueing system with batch services and priority, the stationary distribution of the system was obtained by using supplementary variable method, and numerical examples were used to illustrate influence of transaction commissions and maximum block size on the confirmation time of transactions. Li et al. [35] analyzed the influence of extremely long waiting time and specific priority users on transaction commissions by establishing a queueing game model with non-preemptive priority based on transaction commissions. The above literatures have studied the blockchain system from the aspects of block building process, chain building process, batch services and games of transaction commissions.
Because of the complexity of the blockchain system, the research on the traditional blockchain queueing model may not be enough and a more realistic blockchain queueing model needs to be established. In this paper, the loss of transactions due to congestion and the adverse effects of interference factors on the system are considered, a novel sleep blockchain queueing system with the consensus protocol of blockchain system is creatively proposed and analyzed. And actual data of the blockchain is applied to the experiment, which improves the feasibility of the novel blockchain queueing system. In Section II, based on the fundamental theoretical knowledge of the blockchain system, a vacation queueing model with negative customers, impatient customers, repairable fault and two-phase service that customers can select sever in the first service is established. In Section III, the steady-state of the system is analysed by using the matrix-geometric solution method, then the expressions of the average confirmation time of transactions and other performance measures are obtained. In Section IV, the parameters of the system are obtained based on the statistics of the blockchain transaction data, the influence of system parameters on the performance measures is analyzed by using MATLAB software, and equilibrium states of the blockchain system is discussed. Conclusions are introduced in Section V.

II. MODEL DESCRIPTION
The network layer of the blockchain system which transports transmissions is based on P2P networks, and its operating mechanism is shown in FIGURE 1. Transaction requests which are sent by transaction nodes and received by the system are temporarily stored in the unconfirmed transaction pool to wait for consensus services, and they are transmitted to data storage nodes for storage after verified by consensus nodes. When the transaction confirmation process is finished and the new block is completed and connected to the end of the existing blockchain. In this paper, the consensus process and the storage process are abstracted as service processes, and a blockchain system based on queueing model is established. The parameters of the system are assumed as follows: (1) The transaction request sent by the transaction node is received by the system individually, the sending interval of transaction requests in the system obeys the negative exponential distribution with parameter λ. Transaction requests received by the system were stored into the unconfirmed transaction pool to wait for consensus service with the order of FCFS (First Come First Serve). Because of the excessive number of unconfirmed transaction and the limited memory capacity of the unconfirmed transaction pool, some transactions could not be verified in time, which results in transaction congestion. At the same time, some transactions will lose patience and give up receiving service. The probability of impatience in the blockchain system is α, and only one transaction is lost at one moment. Impatience does not occur if there is no transaction waiting for consensus service in the unconfirmed transaction pool. (2) The consensus nodes in the system will provide two kinds of consensus services for transaction to select: consensus service I with faster service rate is provided for the transactions with simple content and convenient consensus, consensus service II with lower service rate is provided for the transactions with complex content and tedious calculations. Transactions in the unconfirmed transaction pool have to select one of consensus services, and the probability that transactions select consensus service I is p and the probability that transactions select consensus service II isp (p = 1 − p). When there is a transaction in consensus service, other transactions need to wait in the unconfirmed transaction pool. The service time of consensus service I and consensus service II respectively obey the negative exponential distribution with parameters µ 1 and µ 2 (µ 1 > µ 2 ). After consensus service is finished, each transaction will also go through a transmission service process, then it can be stored in the data storage node. It is assumed that the transmission service time obeys the negative exponential distribution with parameter µ 3 . (3) After the new block is completed, to avoid damage to the system caused by long hours of work, the system will start sleep adjustment state with the probability γ or maintain working state with probabilityγ (γ = 1 − γ ) whatever there are requests in the system. The sleep time of the system obeys the negative exponential distribution with parameter θ. There will be some interference factors such as network security threat, malicious nodes and mistakes of arrival transaction requests, they are bad for the normal operation of the system. It is assumed that generation interval of interference factors obeys the negative exponential distribution with parameter β. The transaction that is currently in consensus service is interrupted and lost because of interference factors, but the transactions in the transmission service are not affected.
Interference factors can also cause the fault of system, and then the system enters the fault repair state immediately, the repair time obeys the negative exponential distribution with parameter η.
It is assumed that the random variables in the system, such as the time of transaction requests sending interval, the time of consensus service, the time of transmission service, the time that the system is in sleep state, the time that the system is in fault state, are mutually independent. The blockchain system allows appearing idle condition with no transaction.

III. ANALYSIS OF THE BLOCKCHAIN SYSTEM A. STATE TRANSITION RATE MATRIX
Let L(t) represent the number of transactions in the system at the time t. Let C(t) represent the state of the system at the time t, and the details are defined as follows: (1) C(t) = 0 indicates that the system is in normal standby state at the time t.
(2) C(t) = 1 indicates that the system is in consensus service I state at the time t.    Thus, {(L(t), C(t)) , t ≥ 0} is a 2-dimensional Markov process, and the state space is where 0 = {(0, 0), (0, 3), (0, 4)}, and 0 represents the state of the system with the number of transactions is zero, which is called the idle state of the blockchain system. The state transition of system is shown in FIGURE 2.
The system states are arranged in alphabetical order, and the system state transition rate matrix can be written as follows: where A 0 , C 0 , A 1 , B 1 , A, B, C represent the state transition rate between levels. To make it easier to write matrices, the symbols are defined as follows: The submatrices of the matrix Q are represented as follows:

C. PERFORMANCE MEASURES
According to the steady-state analysis of the above queueing model, the expression of the steady-state distribution can be obtained, and performance measures of the blockchain system can be further obtained.
(1) The average number of transactions is given by

Algorithm 1 Gauss-Seidel Iterative Algorithm
Input: Error accuracy ε (greater than 0, far less than 1), the initial value of R is R 0 , let R 0 = 0; Output: Rate matrix R.
The average number of transactions in the unconfirmed transaction pool is given by (2) The average length of time that a transaction goes from entering the blockchain system to leaving the system is defined as the average confirmation time E(W ) of transaction, which can be obtained by using the Little formula [37], [38] in queuing theory, and it is given by (3) The probability that the system is in the consensus service I state is given by The probability that the system is in the consensus service II state is given by (4) The probabilities that the system is in the consensus service state, fault repair state, sleep adjustment state and transmission service state are respectively given by 3 , 4 ,  (5) The idle probability of blockchain system is given by

IV. EXPERIMENT OF THE BLOCKCHAIN SYSTEM A. ANALYSIS OF SYSTEM PARAMETERS
Taking Bitcoin transactions on July 10, 2019 as an example, the hash value, transaction time, transaction costs and other related data of Bitcoin blockchain are obtained through the Bitcoin browser (https://btc.tokenview.com/cn/). The intervals between two connected sending transaction requests are calculated by sorting data, and some calculation results are shown in TABLE 1. By observing data, the interval between transaction requests has the characteristics of exponential distribution. Kolmogorov-Smirnov Test [39] is applied to examine whether the interval between transaction requests obeys the exponential distribution by using SPSS software. The assumptions are given as follow: Original hypothesis H 0 : the interval between transaction requests obeys the exponential distribution.
Alternative hypothesis H 1 : the interval between transaction requests does not obey the exponential distribution.
Fixing the accuracy α = 0.05, hypothesis test results are shown in TABLE 2. As it can be seen from the table, the exact significance value in the transaction requests sending interval test is 0.114 which is greater than accuracy α = 0.05. So the original hypothesis cannot be rejected, and we believe that the interval of Bitcoin transaction request obeys the exponential distribution. And it is shown in table that the average sending interval between transaction requests is 10.8636 minutes, in other words, the rate that the system receives the transaction requests is λ = 1/10.8636 ≈ 0.0920.
According to the information obtained from the statistics, the parameters of the blockchain system can be determined,  and they are shown in TABLE 3. The minimum nonnegative solution R of the matrix quadratic equation R 2 B+RA+C = 0 is obtained by Gauss-Seidel iterative method. The numerical results π i,j can be obtained by using the steady state distribution equations, and then the performance measures of the blockchain system can be obtained. The relationship charts of performance measures of the blockchain system with the change of parameters are obtained by using MATLAB software. The changes of performance measures influenced by parameters can be analyzed through the relationship charts, which provide an important basis for finding the equilibrium reception rate of the blockchain system.   The changes of performance measures of the blockchain system with the change of the probability p that transactions select consensus service I are shown in FIGURE 5 and TABLE 4. It can be seen from FIGURE 5 that with the increase of p, the probability P 1 that the system is in the consensus service I state increases from zero and the probability P 2 that the system is in the consensus service II state gradually decreases to zero. Because the working time of consensus node I becomes longer, the consensus service time and the average number E(L) of transactions in the system decrease. The probability P c that the system is in the consensus service state decreases, so the proportion of the consensus service in the time that the system is operating decreases and other performance measures of the system increase, partial changes are shown in TABLE 4.

B. INFLUENCES OF THE CHANGE OF PARAMETERS ON PERFORMANCE MEASURES
The changes of performance measures of the blockchain system with the interference factors generation rate β are   shown in FIGURE 6 and TABLE 5. It can be seen from FIGURE 6 that the probability P c that the system is in consensus service state decreases with the increase of β and the probability P 2 that the system is in the consensus service II state is slightly affected by β. As more interference factors occur, the probability P f that the system is in the fault repair state increases, the transaction service is interrupted by interference factors, the probability P t that the system is in the transmission service period and the probability P s that the system is in the sleep adjustment state decrease, and the average number E(L) of transactions in the system and the system idle rate P i slightly increase. The changes are shown in TABLE 5.
The changes of performance measures of the blockchain system with the system sleep probability γ are shown in TABLE 6. With the increase of the sleep probability γ , the average number E(L) of transactions in the blockchain system and the probability P s that the system is in the sleep adjustment state gradually increase. The probability P t that the system is in the transmission service state and the system idle rate P i gradually decrease. The probability P f that system is in fault repair state remains basically unchanged. In particular, when the system sleep rate is close to 0, it means that the system will not sleep.

C. EQUILIBRIUM OPTIMIZATION OF THE BLOCKCHAIN SYSTEM
The revenue of system mainly comes from transaction commission and service reward. The commission paid to the system when each transaction arrives the blockchain system is C, the unit time service reward obtained by consensus nodes is ε. The service consumption of the system per unit time is different in each service periods, it is assumed that the unit time service consumption of consensus service I, consensus service II and transmission service are f 1 , f 2 and f t respectively. The revenue of the blockchain system is defined as F, and it is given by where F is a function of several variables about system parameters λ, µ 1 , µ 2 , µ 3 , p, γ , θ, η, α, β, C, ε, f 1 , f 2 and f t . In order to ensure the profitability of the blockchain system, it is necessary to meet the requirements as follow: and that is For the convenience to find the equilibrium transaction request reception rate, it is assumed that µ 1 , µ 2 , µ 3 , p, γ , θ, η, α, β, C, ε, f 1 , f 2 and f t are fixed values. F is a function of one variable about λ at this time. Now, it is supposed that the state of the system is unpredictable when transaction nodes send transaction requests, and the effective reception rate of transaction requests is defined as λ * (λ * = λq). The transaction that arrives in the system will be received by the system with probability q and leave with probabilityq (q = 1 − q). Considering the revenue of the blockchain system, the equilibrium transaction request reception rate of system is defined as λ e and the equilibrium probability of transactions received by the system is defined as q e . The operating state of system are as follows: (1) When F(λ * ) > 0, the blockchain system gains benefits, the system is in profit state, and λ * < λ e , q < q e ;  (2) When F(λ * ) < 0, the blockchain system loses benefits, the system is in loss state, and λ * > λ e , q > q e ; (3) When F(λ * ) = 0, the blockchain system gains no benefits, the system is in equilibria state, and λ * = λ e , q = q e = λ e /λ. According to statistics, parameters are determined as C = 3.5394, ε = 2.1240, f 1 = 4.99, f 2 = 4.77 and f t = 4.57. The change of the revenue F with the effective reception rate λ * under different transmission service rate µ 3 is shown in FIGURE 7. Under the same transmission service rate µ 3 , the revenue F of the blockchain system has a significant downward trend with the increase of the effective reception rate λ * of transaction requests. With the increase of the number of transaction requests, the average transaction confirmation time is prolonged and the consumption cost of the blockchain system is increased, so the system revenue is reduced. When the service rewards and transaction consumptions obtained by the blockchain system per unit time are fixed, the larger the transmission service rate is, the shorter the average transaction confirmation time is. So the revenue of the blockchain system increases.
According to the trend of the system revenue F, the appropriate ranges of the equilibrium probability q e of the transaction requests received by the system and the equilibrium receiving rate λ e under different transmission rate µ 3 can be obtained. TABLE 7 shows the results of the equilibrium numerical of the system revenue F at different transmission rate µ 3 . It is found that the equilibrium reception rate λ e increases with the increase of the transmission rate µ 3 . According to the parameter µ 3 = 0.1792 of the blockchain system obtained statistically, the appropriate range of the equilibrium receiving rate λ e is 0.0800 − 0.0801, and the appropriate range of the equilibrium probability q e is 0.8696 − 0.8707.

V. CONCLUSION
Blockchain system with the consensus mechanism is getting more and more attention, a novel sleep blockchain queueing system combined with the consensus protocol of blockchain system is creatively proposed and analyzed in this paper, and a vacation queuing model with negative customers, impatient customers, repairable fault and two-phase service that customers can select sever in the first service was established. The steady state distribution of the system was obtained by using the matrix-geometric solution method, and the expressions of the average number of transactions and the average confirmation time of transactions were obtained. The distribution of transaction request intervals was determined by using hypothesis test, and parameters of the system is obtained based on the statistics of the blockchain transaction data. Through numerical analysis, the changes of performance measures influenced by parameters were obtained by MATLAB software. Constructing revenue function of the system, equilibrium states of the system were discussed, and the numerical results of equilibrium states were solved. It was found that the increase of interference factors generation rate, the probability that transactions select consensus service I and the sleep probability of the system would have some adverse effects on the blockchain system. In order to optimize the blockchain system, the system transaction requests reception rate should be appropriately reduced, and the transaction transmission rate, the system failure repair rate and sleep wake rate should be improved.
ZHANYOU MA received the B.Sc. degree in mathematics from Jilin Normal University, Siping, China, and the M.Sc. degree in operations research and the Ph.D. degree in management science and engineering from Yanshan University, Qinhuangdao, China. He is currently a Professor at the School of Sciences, Yanshan University, Qinhuangdao. His research interests include cognitive radio networks, wireless sensor networks, queueing systems with vacations, and performance evaluation models in communication networks.
JIAQI FAN received the bachelor's degree in mathematics and applied mathematics from the Changchun University of Science and Technology, Changchun, China. He is currently pursuing the master's degree with the School of Science, Yanshan University, Qinhuangdao, China. His research interests include cognitive radio networks, wireless sensor networks, queueing systems with vacations, and performance evaluation models in communication networks.
YANG ZHANG received the bachelor's degree in mathematics and applied mathematics from Ankang University, Ankang, China. She is currently pursuing the master's degree with the School of Science, Yanshan University, Qinhuangdao, China. Her research interests include cognitive radio networks, wireless sensor networks, queueing systems with vacations, and performance evaluation models in communication networks.
LIN LIU received the bachelor's degree in statistics from Tangshan Normal University, Tangshan, China. She is currently pursuing the master's degree with the School of Science, Yanshan University, Qinhuangdao, China. Her research interests include cognitive radio networks, wireless sensor networks, queueing systems with vacations, and performance evaluation models in communication networks. VOLUME 8, 2020