# A Blockchain Prediction Model on Time, Value, and Purchase Based on Markov Chain and Queuing Theory in Stock Trade

Authors: Wenjuan Lian; Qi Fan; Bin Jia; Yongquan Liang
Journal: Mathematical Problems in Engineering
 (2020)

---

## Abstract

With the continuous development of the blockchain, it has brought a subversive impact on the blossom of all fields with its characteristics of decentralization, trust-free, and tampering, especially in the financial field. It is of great significance to research the application of blockchain technology in the financial field. As an important part of the financial market, stock has the crucial influence, and the combination of stock and blockchain is becoming a growing trend. In recent years, many studies have focused on the prediction of the stock value, but they have not fully considered the combination of time, value, and purchase. To solve the above problem, we propose a preemption queuing model for multipriority service objects in the blockchain financial architecture according to different service priority. Meanwhile, a queuing-based resource scheduling model is established by using the Markov chain to find the optimal solution. The method in this paper can greatly improve the efficiency of the system and provide a basis for future scientific research in the healthy and sustainable development of the securities industry.


---

## Body

## 1. Introduction

The cash stock market is the most popular and active capital market in the world. The rise of stocks is directly influenced by national policies. The stock market is also the engine and booster of national economic development. According to statistics, nowadays, it is an era of the national stock speculation. At present, China has more than 100 million investors in the stock market, and people pay more attention to the stock industry. However, due to the process of traditional asset management, such as equity and securities that take a long time, there is an increase in the intermediate business cost, transaction fee, information fraud, disclosure, etc. Moreover, it is managed by different intermediaries, which not only increases the transaction cost of assets, but also causes the problem of certificate falsification. The emergence of the blockchain provides a solution for it, which can upgrade securities trading to the automatic execution of intelligent contracts. Since it allows payments to be finished without any bank or any intermediary, the blockchain can be used in various financial services such as digital assets, remittance, and online payment [1]. Through P2P trading transmission, it not only saves the intermediate process and reduces the cost and loss, but also guarantees the private security of trading information and changes the trading efficiency of the stock market. In addition, the Markov chain can select a decision-making from the available set of actions based on the observed state at each moment. At the same time, the system can make new decisions based on the observed newcome states. Markov chain can be used to conduct the dynamic optimization of the resource scheduling scheme in the stock trading process, and the optimal resource scheduling scheme can be found to ensure the timeliness of the transaction.In 2008, Satoshi Nakamoto proposed an electronic cash system for bitcoin, which could be implemented through peer-to-peer (P2P) technology, allowing online payments to be initiated directly by one party to another without going through any financial institution [2]. This leads to the concept of “blockchain.” The blockchain is one of the hot technologies, which appeared in the last decade and brought a lot of promise with it [3]. As the underlying key technology and infrastructure of bitcoin, the blockchain has attracted great attention from academia and industries. A blockchain, originally blockchain [4], is a growing list of records, called blocks, which are linked and secured by using cryptography [5]. Each block contains a cryptographic hash of the previous block [6], a timestamp, and transaction data. A blockchain is a decentralized, distributed, and public digital ledger that is used to record transactions across many computers so that any involved record cannot be altered retroactively, without the alteration of all subsequent blocks [7]. Blockchain technology has the key characteristics, such as decentralization, persistence, anonymity, and audibility. Blockchain can work in a decentralized environment and be realized by multiple core technologies such as the integrated password hash, the digital signature (based on asymmetric encryption), and the distributed consensus mechanism. Based on a distributed P2P network, blockchain technology combines consensus mechanism, smart contract, and privacy protection with the open source software to ensure the continuity and security of each node in the distributed database. These can make information instant verifiable and traceable, but it is difficult to change and revoke. Thus, blockchain technology is a set of private, efficient, safe, and shared value systems. Blockchain can serve not only to save the operating costs of the companies, but also to retrench the potential legal fees arose from disputes which could have been avoided [8]. In December 2013, Vitalik proposed Ethereum, a blockchain platform, which could realize digital currency transactions based on ether currency. Simultaneously, this platform can also provide a complete programming language to write a smart contract [9]. It is the first time that an intelligent contract is applied to the blockchain. Because the blockchain allows payments to be completed without any bank or agency, it could be used in various financial services [10, 11]. Besides, blockchain technology is applied in other scenarios, such as smart contracts [12], public services [13], Internet of Things (IoT) [14], reputation systems [15], and security services [16]. However, further work still needs to explore the full capabilities of the blockchain and where it can be adopted.Markov chain was proposed by Andrey A. Markov, a Russian mathematician. It refers to the random transitioning process from one state space to another state space. This process requires memory-less properties. The probability distribution of the next state can only be determined by the current state, which has nothing to do with the original state or the Markov process before the transition. The probability function of a Markov chain is a random process generated by two interrelated mechanisms. One is a potential Markov chain with a finite number of states, and the other is a set of random functions. At discrete instants of time, the process is assumed to be in some state, and observation is generated by the random function corresponding to the current state [17]. Markov chain is a powerful mathematical tool that is widely used to capture random transitions between different states of a system. Since the complexity of the model can be greatly reduced by utilizing the properties of the Markov chain, it has been widely used in many time model sequences and became one of the most widely applied algorithms. Cerqueti et al. optimized the Markov chain according to the application scenario [18]. And, Li et al. studied the limit theorem of the Markov chain function in the environment of single infinite Markovian systems [19]. Markov chain has been widely used for prediction in other fields, such as parallel computing [20], data modeling [21], information freshness [22], robotic surveillance [23], and transformer health estimation [24].In the model construction, Ma et al. [25] proposed a preemptive multipriority queuing model, but it did not analyze high-priority data. Li et al. [26] studied the queuing theory of blockchain mining based on nodes and designed a Markov batch service queuing system with two different service stages. However, the existing research studies did not fully consider the resource utilization in the queuing process. In order to solve the above problem, we propose a blockchain-enabled queuing model based on service priority. Although the queuing model in our scheme is built under Poisson’s hypothesis, our analysis method will inspire a series of potential studies for the queuing theory in the blockchain system.To the best of our knowledge, this paper proposes creatively a set of theoretical methods and prototyping based on the blockchain tactics and the Markov chain model and attempts to apply it in the stock trading. By doing a lot of market investigation and reading plentiful references, aiming at some deficiencies of existing methods, we proposed a multipriority prediction model in the blockchain based on the Markov chain and queuing theory. Compared with the previous approaches, our proposed method and model has the following advantages:(i)
Combining queuing theory with the blockchain: this paper creatively proposes a queuing model of multipriority service object preemption based on the blockchain scenario.(ii)
Appling the Markov chain to integrated forecast of the stock trading market: according to the three basic principles of stock trading, the priority of the service object is divided. The different priority service objects in the scenario are also discussed.(iii)
The resource scheduling model of the queuing system is established by using the Markov chain and the blockchain, and the optimal solution of resource scheduling is found by adopting the above model.In the following sections, we will analyze and summarize the principle and basic knowledge of the Markov chain and the queuing theory. Through the analysis of the Markov chain and the blockchain, it is not difficult to find that they belong to the chain structure. Therefore, by combining the queuing model with blockchain technology, this paper proposes a new stock trading method based on the blockchain. Section2 mainly presents the work related to the blockchain, Markov chain, and queuing theory. Section 3 introduces the theoretical knowledge of the Markov chain and queuing theory. Section 4 establishes a queuing model with priority based on the blockchain. Section 5 uses the Markov chain to schedule resources for the queuing model. Section 7 concludes this paper. The method proposed in this paper optimizes and improves the stock trading, which can shorten the settlement time and improve the liquidity of funds.


## 2. Related Work

The development of the blockchain is been explored, and its application scenarios have been expanded from a single electronic virtual currency trading system to the other wider fields. Today some of the largest financial institutions in the world, including central banks, major commercial banks, and stock exchanges, have launched ambitious projects to use the blockchain in both wholesale and retail applications [27]. They were committed to applying blockchain technology to real-world production environments and realizing the ultimate goals of high efficiency and low consumption. The security of the blockchain has always been one of the hotspots, and many researchers have made a host of contributions to this problem [28–30]. In other applications, in 2017, Li et al. proposed a payment method based on credit, which can be used for the fast and frequent transactions. Their work also provided an optimal pricing strategy for the Stackelberg game based on credit loans [31]. Due to the lack of some comprehensive literature reviews on the development of decentralized consensus mechanisms in the blockchain network, in 2018, Wang et al. provided a systematic vision of the organization of the blockchain network, and they also made a comprehensive review of the self-organizing strategies of each node in the blockchain backbone network from the perspective of game theory [32]. In the same year, Hussein et al. proposed a data-sharing system based on the blockchain, which makes full use of the invariance and autonomy of the blockchain to meet the challenges of access control and sensitive data processing [33]. In 2019, Andoni et al. demonstrated that the blockchain can get over the technical difficulties of identification and its potential disadvantages. Then, they introduced the current development prospects of the blockchain into industrial projects and entrepreneurial firms in brief. Finally, they discussed the challenges and market obstacles that blockchain technology needs to conquer and proved its commercial feasibility [34]. In order to achieve safe and fair payment of outsourcing services without relying on the third party, Zhang et al. proposed BCPay, which was a fair payment framework of cloud computing outsourcing services based on the blockchain [35].So far, the research for the blockchain has obtained many important advances, but an army of optimization theory of blockchain systems is anticipated, for example, developing and promoting a slice of mathematical models (e.g., Markov processes, queuing theory, and game models), to provide performance analysis and method improvement, and to set up useful relations among key factors or basic parameters. Kasahara and Kawahara pour attention into applying queuing theory into the processing of transaction confirmation bitcoins, and they gave some interesting ideas and useful simulations for inspiring future research. In their works, Kasahara and Kawahara assumed that the transaction confirmation times follow a continuous probability distribution function. The queuing theory was used to analyze the transaction confirmation time of the blockchain. They modeled the bitcoin transaction confirmation process as a priority queuing system with batch services and derived the average transaction confirmation time [36]. The blockchain is maintained and updated by modeling the mining process with a queuing system. In the model, they considered the joint distribution of the number of transactions in the system and the running service time and obtained the average transaction validation time at last [37]. In 2018, Li et al. designed a Markov batch service queuing system with two different service stages, which can well express the process of mining and establishing a new block [25]. In addition, there are some research studies about the queuing model to apply to the blockchain. In 2019, Ricci et al. proposed a framework that includes the machine learning and queuing theory model to describe the delay experienced in bitcoin transactions, which related transaction delays to the time between every two block validations [38]. Memon et al. built a model that uses queuing theory to simulate the blockchain and verified the designed blockchain model by simulating two-month transactions using actual statistics from bitcoin and Ethereum [39].


## 3. Preliminaries

### 3.1. Markov Chain

Markov chain is a discrete Markov process with time and state parameters. Because the time learned by the general Markov process is infinite, the time is a continuous variable, and its value is also continuous. An infinite partition can be made between two adjacent values. Meanwhile, the time parameter of the Markov chain is discrete, and the state of the Markov chain is also finite. When one state can be listed, the future state is solely related to the current state, and it has nothing to do with the previous state.For instance, consider a discrete-time stochastic process,Xn,n=0,1,2…; here, its value is a finite or countable set of S, which is the state space of the process, and a state space is the collection of all possible states that contain the Markov chain.The finite-dimensional distributions of the process are shown as follows:(1)PX0=i0,…,Xn=j,i0,…,j∈S,n≥0,where the set S is the state space of the process and the value Xn∈S is the state of the process at the time n. The probability distribution uniquely determines the probability of all events in the process. Therefore, if the finite-dimensional distributions of two random processes are equal, their distributions are equal:(2)PXn+1=jX0,…,Xn=PXn+1=jXn.The stochastic process on the countable setS and X=Xn:n≥0 is a Markov chain, for any i,j∈S and n≥0:(3)PXn+1=jXn=i=Pij,where Pij is the probability of a Markov chain moving from state i to state j. Obviously,(4)Pij≥0,∑i=0∞Pij=1,j=0,1,….(i)
Condition (1), called the Markov property, means that at any timen, the conditional distribution of the next state Xn+1 is independent of the past state X0,…,Xn−1. That is to say, the future state is independent of the past state and is dependent on the present state.(ii)
Condition (2) simply says that the transition probabilities do not depend on the time parameter; the Markov chain is “time homogeneous.” If the transition probabilities were functions of time, the process Xn would be a nontime-homogeneous Markov chain [40].Pij is a matrix that consists of the transition probability:(5)P=P00P01⋯P10P11⋯⋮⋮⋮.This process is called the transition probability matrix.To describe the finite-dimensional distribution of stochastic processes is a basic problem in analyzing the structure of stochastic processes. The finite-dimensional distribution ofXnis determined by its initial probability distribution X0 and transition probability.Assuming that the transition probability and the initial probability of the Markov chainXn are Pij and αi=PX0=i, respectively, for any i0,…,in∈S and n≥0, we can get the following formula:(6)PX0=i0,…,Xn=in=αi0Pi0,i1…Pin−1,in.Pij is defined as the probability of the process through n steps from state i to state j. In particular, Pij1=Pij,(7)Pn=PP…P︸n.The Chapman–Kolmogorov equation can be obtained by the multiplication property of the matrixPm+n=Pmpn, for m,n≥1:(8)Pijm+n=∑k∈Spikmpkjn,i,j∈S.Then,(9)Pijn+1=∑k∈Spiknpkj1=∑k∈Spiknpkj=Pn+1ij.Here, they are established for all nonnegative integersn.The state transition of the Markov chain can be expressed as a graph, called the transition graph, as shown in Figure1. And, each edge in the graph is assigned a transition probability. The concepts of “reachable” and “connected” can be introduced through the transition graph.Figure 1
Markov chain on the graph.


### 3.2. Queuing Theory

Queuing theory, known as a random service system as well, originated from the research on the telephone trunk line in the early 20th century. Queuing theory is widely used in service systems, especially in communication systems, transportation systems, computer storage systems, production management systems, and so on. The queuing process is shown in Figure2.Figure 2
Queuing process of the queuing system.Using Kendall’s representation method [41], a queuing process is usually represented by A/B/C/X/Y. Among them, “A” represents the random distribution of customers arriving at the system, “B” expresses the distribution type of the service time in the service center, “C” indicates the number of the service center, “X” shows the capacity of the queue, and “Y” reveals the queuing rule. The queuing system mainly has three important performance indicators, and they are queue length, waiting time, and service center workload.Queuing system with priority has many applications in real life. Priority is a kind of rules separated from service rules, which is the VIP (very important person) system advocated by many merchants in marketing. The queuing system is divided into two types according to their priority, as shown in Figure3.Figure 3
Classification of priority queuing.


## 3.1. Markov Chain

Markov chain is a discrete Markov process with time and state parameters. Because the time learned by the general Markov process is infinite, the time is a continuous variable, and its value is also continuous. An infinite partition can be made between two adjacent values. Meanwhile, the time parameter of the Markov chain is discrete, and the state of the Markov chain is also finite. When one state can be listed, the future state is solely related to the current state, and it has nothing to do with the previous state.For instance, consider a discrete-time stochastic process,Xn,n=0,1,2…; here, its value is a finite or countable set of S, which is the state space of the process, and a state space is the collection of all possible states that contain the Markov chain.The finite-dimensional distributions of the process are shown as follows:(1)PX0=i0,…,Xn=j,i0,…,j∈S,n≥0,where the set S is the state space of the process and the value Xn∈S is the state of the process at the time n. The probability distribution uniquely determines the probability of all events in the process. Therefore, if the finite-dimensional distributions of two random processes are equal, their distributions are equal:(2)PXn+1=jX0,…,Xn=PXn+1=jXn.The stochastic process on the countable setS and X=Xn:n≥0 is a Markov chain, for any i,j∈S and n≥0:(3)PXn+1=jXn=i=Pij,where Pij is the probability of a Markov chain moving from state i to state j. Obviously,(4)Pij≥0,∑i=0∞Pij=1,j=0,1,….(i)
Condition (1), called the Markov property, means that at any timen, the conditional distribution of the next state Xn+1 is independent of the past state X0,…,Xn−1. That is to say, the future state is independent of the past state and is dependent on the present state.(ii)
Condition (2) simply says that the transition probabilities do not depend on the time parameter; the Markov chain is “time homogeneous.” If the transition probabilities were functions of time, the process Xn would be a nontime-homogeneous Markov chain [40].Pij is a matrix that consists of the transition probability:(5)P=P00P01⋯P10P11⋯⋮⋮⋮.This process is called the transition probability matrix.To describe the finite-dimensional distribution of stochastic processes is a basic problem in analyzing the structure of stochastic processes. The finite-dimensional distribution ofXnis determined by its initial probability distribution X0 and transition probability.Assuming that the transition probability and the initial probability of the Markov chainXn are Pij and αi=PX0=i, respectively, for any i0,…,in∈S and n≥0, we can get the following formula:(6)PX0=i0,…,Xn=in=αi0Pi0,i1…Pin−1,in.Pij is defined as the probability of the process through n steps from state i to state j. In particular, Pij1=Pij,(7)Pn=PP…P︸n.The Chapman–Kolmogorov equation can be obtained by the multiplication property of the matrixPm+n=Pmpn, for m,n≥1:(8)Pijm+n=∑k∈Spikmpkjn,i,j∈S.Then,(9)Pijn+1=∑k∈Spiknpkj1=∑k∈Spiknpkj=Pn+1ij.Here, they are established for all nonnegative integersn.The state transition of the Markov chain can be expressed as a graph, called the transition graph, as shown in Figure1. And, each edge in the graph is assigned a transition probability. The concepts of “reachable” and “connected” can be introduced through the transition graph.Figure 1
Markov chain on the graph.


## 3.2. Queuing Theory

Queuing theory, known as a random service system as well, originated from the research on the telephone trunk line in the early 20th century. Queuing theory is widely used in service systems, especially in communication systems, transportation systems, computer storage systems, production management systems, and so on. The queuing process is shown in Figure2.Figure 2
Queuing process of the queuing system.Using Kendall’s representation method [41], a queuing process is usually represented by A/B/C/X/Y. Among them, “A” represents the random distribution of customers arriving at the system, “B” expresses the distribution type of the service time in the service center, “C” indicates the number of the service center, “X” shows the capacity of the queue, and “Y” reveals the queuing rule. The queuing system mainly has three important performance indicators, and they are queue length, waiting time, and service center workload.Queuing system with priority has many applications in real life. Priority is a kind of rules separated from service rules, which is the VIP (very important person) system advocated by many merchants in marketing. The queuing system is divided into two types according to their priority, as shown in Figure3.Figure 3
Classification of priority queuing.


## 4. Priority-Based Queuing Modeling

The blockchain application architecture in this paper is a distributed communication network that is composed of multiple users, in which one user is randomly spread over any position. The set of users isU=u∈U,u=1,2,…,m, and the users do not affect each other. Users are represented by nodes in the network, and the connections between every two nodes are irregular. As we can see in Figure 4, the AB chain starts at node A, but the state transition occurs at node X to form a second chain AC. These two chains end at node B and node C, respectively. In Section 5 of this paper, we will use the Markov theory to calculate the transition probability at node X.Figure 4
Random distribution of the user and transfer process of status.In the actual scenario, it is assumed that all users can generate transactions and blocks, where user-generated transaction sets are represented byξ=t∈ξ,t=1,2,…,T and the user-generated block sets are represented by σ=b∈σ,b=1,2,…,B.According to the working process of the blockchain, we creatively propose a priority-based stock trading prediction model. In stock trading, the model is processed according to three basic principles as follows: the value priority principle, the transaction time priority principle, and the quantity priority principle.(i)
The principle of the value priority: when the value is higher, the priority is higher. The calculation of the value is as follows:(10)Wvalue=Wp×Wq,whereWp represents the transaction univalence, Wq indicates the transaction quantity, and Wvalue is the total value of the traded stock.(ii)
The principle of transaction time priority: for the same value declaration, the earlier submission time is preferred.(iii)
The principle of the quantity priority: when the purchase quantity is more, the priority is higher.The above three principles interact with each other. Users with a high transaction value have higher priority than users with a lower value. However, if the transaction value of two users is equal, it will queue according to the transaction time sequence. And, if two users submit the same value at the same time, they sort according to the third principle. This is a typical queuing problem by priority.In this section, in order to solve the above problems, we design a queue model with priority based on the blockchain framework. The model is divided into two phases, i.e., the block generation phase and the chain establishment phase. In the block generation phase, when the data flow arrives, it needs to enter and queue in an infinite waiting room. According to the queuing rules, the system divides it into the high-priority data flow and the low-priority data flow, and then it waits to be assembled into blocks. The chain establishment is that the newly generated blocks are concatenated into a blockchain. The queue and establishment model of a blockchain is shown in Figure5. Since the built blockchain also involves the consensus mechanism of the blockchain, the required time in this stage is related to the consensus in the network, and there is network delay in the consensus process. Each consensus mechanism takes a different amount of time. In this paper, we do not discuss it. Here, we apply ET (establishment time of the blockchain) to represent the required time to build a blockchain. By the above two stages, we can derive the average waiting time and average queue length of all data streams with different priorities in a blockchain.Figure 5
Queue and establishment model of a blockchain.The priority-based queuing model is regarded as anM/M/N/m queuing model with three types of users, where the first “M” represents that the arrival process is the Poisson process, the second “M” means that the service time obeys exponential distribution, “N” is the N channels, and “m” is the m users. When the data flow arrives, it will select the free channel for transmission, and the system processes the business submitted by users according to three kinds of priorities. Therefore, it can be considered as an M/M/N/m queuing model with three types of users. Assuming that the arrival rates of the three priorities are λ1,λ2k=1,andλ2k=2, respectively, we will analyze the three different types of priority data flow.In this model, the transmission time of the high-priority and low-priority data flow in a channel is1/μ1 and Ttk, Tω is the average wait time of high-priority data flow, ω is the average quantity of data flow, and ∂k,jη and ψk,jη are the arrival rate and effective service time of low-priority data flow in the channel η with priority k, respectively.In theM/M/N/m queuing model, each channel can transmit high-priority and low-priority data flow. Here, according to the k value, the low-priority data flow is classified into two categories. The high-priority data flow receives service firstly, and the data flow of the same priority follows the scheduling strategy of the first come first serve (FCFS); the low-priority flow can access the channel only after the high-priority data flow to complete the data transfer. When the high-priority data flow reappears, the low-priority data flow must suspend the data transmission or switch to another channel. The specific transmission process is exhibited in Figure 6. In addition, we assume that all the random variables defined above are independent of each other.Figure 6
Priority-based queuing system model.


### 4.1. High-Priority Data Flow

Since the high-priority data flow receives the service firstly, the queuing time of the high-priority data flow is the service time of the same priority data flow.Based on the analysis of the queuing model above, we assume thatb represents the sequence number of blocks and C represents the number of blocks generated by the data flow b<C. If ρ=λ1/μ1+∑k=12μ2k (where ρ is the average quantity of the high-priority data flow model), then the average quantity of data flow to process and the average service time of the high-priority data flow can be described as follows:(11)ω1=λ1μ111−ρ21+λ1μ111−ρ−1,(12)EXpη=1μ111−ρ21+λ1μ111−ρ−1+∑b=0CET.We can obtain the probability that a high-priority data flow occupies the busy channel, and the probability is as follows:(13)αpη=λ1EXpη.The average queue length of data flow in the channel can be expressed as follows:(14)lη=pη0ρηρηmm!1−ρηm2+ρη,where pη0=∑n=0m−1ρη/n!+ρη/m!1−ρηm−1andρη=mρm.


### 4.2. Low-Priority Data Flow

The model belongs to the multiserver system in queuing theory. When the priority has been introduced into the model, it became difficult to deal with. To quantitatively analyze the multiservice flow and multichannel model with priority, the dimension reduction method is adopted to process it. The processing of low-priority data flow depends on the amount of high-priority data flow. When there is no high-priority data flow in the model, all channels transmit low-priority data flow. When the amount of high-priority data flow is more than 0, the remaining channels transmit low-priority data flow; when the amount of high-priority data flow isN, there is no channel to transmit low-priority data flow.In the model, we setk as the priority of the data flow, the value of k is 1 or 2, and n is the interrupted number. The service time of the low-priority data flow in the channel η is Xkη. Then, the busy degree of the channel is as follows:(15)ν=∑k=12∑i=1nνk,i,where νk,i is the probability of the channel busy level caused by data flow with priority k and interrupted number i.During the data transfer, the process is likely to be interrupted for several times. We consider the traffic of channelη, and then the average data transmission time of data flow can be expressed as follows:(16)ETtk=∑i=1nETωkPrn,where(17)ETωk=EXkη+∑i=1nEDk,iη,(18)Prn=1−pk,nη∏i=0n−1pk,nn,in which Dk,iη is the time delay when the data flow is interrupted in the channel η and pk,nη is the probability of the data that is interrupted again in the current channel. Substituting (17) and (18) into (16), we can gain the following formula:(19)ETtk=EXkη+∑j=1n∑i=1nEDk,iη1−pk,nη∏i=0n−1pk,nη.The service time can be calculated as follows:(20)E∂k,jη=∑n=1MEψk,iη−1−1.In the stop-and-wait situation, whenk=1, the waiting time of the data flow can be computed as follows:(21)EA1,iη=EXpη+λ2k=1EA1,iηEXpη+∑b=0CET.On the right of the equal sign of (21), the first item represents the average service time of the high-priority data flow that caused the interruption, and the second item represents the average service time of the newly arrived high-priority data flow within the waiting time.Through (21), we can obtain the following formula:(22)EA1,iη=EXpη+∑b=0CET1−λ2k=1EXpη.Similarly, whenk=2, the waiting time is computed as follows:(23)EA2,iη=EXpη+λ2k=2EA2,iηETω1+∑j=0n∂1,jηEA2,iηEψ1,jη+∑b=0CET.On the right of the equal sign of (23), the first item represents the average service time of the high-priority data flow that caused the interruption, the second item represents the average service time of the newly arrived high-priority data flow, and the third item reveals the average service time of the arrived k=2 data flow during the wait time. Through (22), we get the following:(24)EA2,iη=EA2,iη+∑b=0CET1−λ2k=2EXpη−∑j=0n∂1,jηEψ1,jη.The average remaining service time of the current data flow in the channelη can be expressed as follows:(25)EVtη=12λ1EEXPη2+12∑k=12∑j=0n∑η−1Mλ2k∂k,jηEψk,jη2+∑b=0CET.The interruptible queuing model in the paper can apply to the stock deal. When the data flow reaches, the model will deal with the data flow according to its priority (in Figure7). The proposed method in this paper can greatly improve the efficiency of the queuing model and meet the relevant needs in the trade.Figure 7
Priority-based queuing model flowchart.


## 4.1. High-Priority Data Flow

Since the high-priority data flow receives the service firstly, the queuing time of the high-priority data flow is the service time of the same priority data flow.Based on the analysis of the queuing model above, we assume thatb represents the sequence number of blocks and C represents the number of blocks generated by the data flow b<C. If ρ=λ1/μ1+∑k=12μ2k (where ρ is the average quantity of the high-priority data flow model), then the average quantity of data flow to process and the average service time of the high-priority data flow can be described as follows:(11)ω1=λ1μ111−ρ21+λ1μ111−ρ−1,(12)EXpη=1μ111−ρ21+λ1μ111−ρ−1+∑b=0CET.We can obtain the probability that a high-priority data flow occupies the busy channel, and the probability is as follows:(13)αpη=λ1EXpη.The average queue length of data flow in the channel can be expressed as follows:(14)lη=pη0ρηρηmm!1−ρηm2+ρη,where pη0=∑n=0m−1ρη/n!+ρη/m!1−ρηm−1andρη=mρm.


## 4.2. Low-Priority Data Flow

The model belongs to the multiserver system in queuing theory. When the priority has been introduced into the model, it became difficult to deal with. To quantitatively analyze the multiservice flow and multichannel model with priority, the dimension reduction method is adopted to process it. The processing of low-priority data flow depends on the amount of high-priority data flow. When there is no high-priority data flow in the model, all channels transmit low-priority data flow. When the amount of high-priority data flow is more than 0, the remaining channels transmit low-priority data flow; when the amount of high-priority data flow isN, there is no channel to transmit low-priority data flow.In the model, we setk as the priority of the data flow, the value of k is 1 or 2, and n is the interrupted number. The service time of the low-priority data flow in the channel η is Xkη. Then, the busy degree of the channel is as follows:(15)ν=∑k=12∑i=1nνk,i,where νk,i is the probability of the channel busy level caused by data flow with priority k and interrupted number i.During the data transfer, the process is likely to be interrupted for several times. We consider the traffic of channelη, and then the average data transmission time of data flow can be expressed as follows:(16)ETtk=∑i=1nETωkPrn,where(17)ETωk=EXkη+∑i=1nEDk,iη,(18)Prn=1−pk,nη∏i=0n−1pk,nn,in which Dk,iη is the time delay when the data flow is interrupted in the channel η and pk,nη is the probability of the data that is interrupted again in the current channel. Substituting (17) and (18) into (16), we can gain the following formula:(19)ETtk=EXkη+∑j=1n∑i=1nEDk,iη1−pk,nη∏i=0n−1pk,nη.The service time can be calculated as follows:(20)E∂k,jη=∑n=1MEψk,iη−1−1.In the stop-and-wait situation, whenk=1, the waiting time of the data flow can be computed as follows:(21)EA1,iη=EXpη+λ2k=1EA1,iηEXpη+∑b=0CET.On the right of the equal sign of (21), the first item represents the average service time of the high-priority data flow that caused the interruption, and the second item represents the average service time of the newly arrived high-priority data flow within the waiting time.Through (21), we can obtain the following formula:(22)EA1,iη=EXpη+∑b=0CET1−λ2k=1EXpη.Similarly, whenk=2, the waiting time is computed as follows:(23)EA2,iη=EXpη+λ2k=2EA2,iηETω1+∑j=0n∂1,jηEA2,iηEψ1,jη+∑b=0CET.On the right of the equal sign of (23), the first item represents the average service time of the high-priority data flow that caused the interruption, the second item represents the average service time of the newly arrived high-priority data flow, and the third item reveals the average service time of the arrived k=2 data flow during the wait time. Through (22), we get the following:(24)EA2,iη=EA2,iη+∑b=0CET1−λ2k=2EXpη−∑j=0n∂1,jηEψ1,jη.The average remaining service time of the current data flow in the channelη can be expressed as follows:(25)EVtη=12λ1EEXPη2+12∑k=12∑j=0n∑η−1Mλ2k∂k,jηEψk,jη2+∑b=0CET.The interruptible queuing model in the paper can apply to the stock deal. When the data flow reaches, the model will deal with the data flow according to its priority (in Figure7). The proposed method in this paper can greatly improve the efficiency of the queuing model and meet the relevant needs in the trade.Figure 7
Priority-based queuing model flowchart.


## 5. Markov Chain Model

Markov chain is a mathematical model to describe the state transition of complex systems. The multistage decision process problem can be solved by adopting the model. However, the state of the process must satisfy the nonaftereffect property. The nonaftereffect property is only related to the state of the phase, and it is irrelevant to the previous state. The queuing process is dynamic and meets the above conditions, so it conforms to the requirements of the Markov chain application. Moreover, when an army of users arrive at the model for queuing, the model needs to spread them out the other queues. Meanwhile, the resource scheduling needs to meet the demands as shown in Figure8. Therefore, the application of the Markov chain theory can solve the problem of resource allocation in the queuing model.Figure 8
Solving the logical relation of system resource scheduling by using the Markov chain.


### 5.1. Model Building

In this paper, we applyFs to represent the state of the model, and Fs;s∈S is a random process; the state vector distribution χ=χ1,χ2,χ3,… represents the probability of each state at the current moment. Pij constitutes the probability transition matrix Λ. The formula of state distribution vector at the time n is as follows:(26)χn=χnΛ,where x corresponding to maxχx is to predict the most possible state of state transition at the time n. In order to calculate the load degree of the server, we divide the occupancy rate of the model, and the specific partition function is as follows:(27)levelx=loadx100.We suppose the current time ist, the node o is overloaded, and the state of node o at the time t is Lt. To make the model achieve efficiently, data flow needs to be migrated. For the first d moments d<t, the load transfer sequence is L1,L2,…Ld. From this transition sequence, the occurrence time of state transition i⟶j in adjacent moments are denoted as Cij and Pij is the transition probability from state i to state j, which can also be obtained as follows:(28)Pij=Cij∑C,Cij≠0,0,Cij=0.From the state transition probability, we can obtain the transition probability matrix of the Markov chain.In addition, we supposed thatfn represents the total expected reward at the end of the process when the model is in the state Fn=i and rij represents the corresponding reward for moving from state Fn=i to the next state Fn+1=j, then we can gain the following equation:(29)fi,πn=∑j=1nPijrij+∑j=1nPijfn+1i,πn+1i=1,2,…,where πn represents the sequence ζn,ζn+1,… of the decision rule and ζ is from the n-th period to the end of the process. πn=ζn,πn+1, where ζn is the decision rule in the n-th period. We assume that(30)qi=∑j=1nPijrij,i=1,2,…,m,where qi is the expected cost of a transition from the state i, namely, it is the expected cost of the state i.The above two equations are based on solving the dynamic resource scheduling problem. In order to study the instantaneous behavior of the Markov chain, it is necessary to employ theZ-transform analysis method, which can transform the differential equations into the corresponding ordinary equations. The original function and its Z-transformation can be converted into each other. By the application of Z-transformation, the formula (30) from [42] can solve the resource scheduling problem:(31)nν+fi=qi+∑j=1nPijn−1ν+fi,i=1,2,…,m,nν+fi=qi+∑j=1nPijfi,i=1,2,…,m.


### 5.2. Resource Scheduling Algorithm Based on Markov Chain

The specific algorithm is shown in Algorithm1. We apply Algorithm 1 to discover the optimal solution of resource scheduling and distribute the data flow in the blockchain queuing model to reduce the waiting time of data flow in the waiting room. It not only improves the processing efficiency of the blockchain network, but also meets the demand of the stock trades.Algorithm 1: Resource scheduling algorithm.
Input: stateFs, s∈S, πOutput: final strategyπn(1) Defineqi, Pij, and rij(2) fori=0 to m do(3)dik=ζni(4) forn=0 to N do(5)nv+fi=qi+∑j=1nPijn−1v+fi,nv+fi=qi+∑j=1nPijfi(6)M⟵maxqiζn+1i+∑j=1mPijξn+1ifjn−fi(7)  ifπn=πn+1, then(8)   returnπn(9)  else(10)n=n+1


## 5.1. Model Building

In this paper, we applyFs to represent the state of the model, and Fs;s∈S is a random process; the state vector distribution χ=χ1,χ2,χ3,… represents the probability of each state at the current moment. Pij constitutes the probability transition matrix Λ. The formula of state distribution vector at the time n is as follows:(26)χn=χnΛ,where x corresponding to maxχx is to predict the most possible state of state transition at the time n. In order to calculate the load degree of the server, we divide the occupancy rate of the model, and the specific partition function is as follows:(27)levelx=loadx100.We suppose the current time ist, the node o is overloaded, and the state of node o at the time t is Lt. To make the model achieve efficiently, data flow needs to be migrated. For the first d moments d<t, the load transfer sequence is L1,L2,…Ld. From this transition sequence, the occurrence time of state transition i⟶j in adjacent moments are denoted as Cij and Pij is the transition probability from state i to state j, which can also be obtained as follows:(28)Pij=Cij∑C,Cij≠0,0,Cij=0.From the state transition probability, we can obtain the transition probability matrix of the Markov chain.In addition, we supposed thatfn represents the total expected reward at the end of the process when the model is in the state Fn=i and rij represents the corresponding reward for moving from state Fn=i to the next state Fn+1=j, then we can gain the following equation:(29)fi,πn=∑j=1nPijrij+∑j=1nPijfn+1i,πn+1i=1,2,…,where πn represents the sequence ζn,ζn+1,… of the decision rule and ζ is from the n-th period to the end of the process. πn=ζn,πn+1, where ζn is the decision rule in the n-th period. We assume that(30)qi=∑j=1nPijrij,i=1,2,…,m,where qi is the expected cost of a transition from the state i, namely, it is the expected cost of the state i.The above two equations are based on solving the dynamic resource scheduling problem. In order to study the instantaneous behavior of the Markov chain, it is necessary to employ theZ-transform analysis method, which can transform the differential equations into the corresponding ordinary equations. The original function and its Z-transformation can be converted into each other. By the application of Z-transformation, the formula (30) from [42] can solve the resource scheduling problem:(31)nν+fi=qi+∑j=1nPijn−1ν+fi,i=1,2,…,m,nν+fi=qi+∑j=1nPijfi,i=1,2,…,m.


## 5.2. Resource Scheduling Algorithm Based on Markov Chain

The specific algorithm is shown in Algorithm1. We apply Algorithm 1 to discover the optimal solution of resource scheduling and distribute the data flow in the blockchain queuing model to reduce the waiting time of data flow in the waiting room. It not only improves the processing efficiency of the blockchain network, but also meets the demand of the stock trades.Algorithm 1: Resource scheduling algorithm.
Input: stateFs, s∈S, πOutput: final strategyπn(1) Defineqi, Pij, and rij(2) fori=0 to m do(3)dik=ζni(4) forn=0 to N do(5)nv+fi=qi+∑j=1nPijn−1v+fi,nv+fi=qi+∑j=1nPijfi(6)M⟵maxqiζn+1i+∑j=1mPijξn+1ifjn−fi(7)  ifπn=πn+1, then(8)   returnπn(9)  else(10)n=n+1


## 6. Experiment

The queuing model with three channels is considered in our experiment. The arrival process of the three kinds of priority data flow is Poisson arrival process, and their arrival rates areλ1, λ2k=1, and λ2k=2, respectively. Their service time follows an exponential distribution. Here, data transmission is simulated in three aspects, they are throughput, delay, and channel utilization.


### 6.1. Data Simulation

First of all, we set the simulation parameters as follows:EXpn=EXp=20, λ1=λ2k=1=λ2k=2=0.01. Then, we set up 1000 accounts, with the number of transactions for each account that is randomly distributed between 1 and 100, and the value of each transaction that is randomly distributed between 1 and 1000. The arrival time of transaction for each account is random as well. The statistics of transaction quantity and transaction price of all accounts are shown in Table 1.Table 1
Quantity and price of transactions in the accounts.
QuantityPrice1–350351–660661–10001–338713411934–661249110467–100103126112Total314351335According to Table1, the transaction quantity and transaction price of the accounts are evenly distributed. We sorted the accounts into three priorities based on the three principles mentioned above.


### 6.2. Performance Index

In this paper, we also use throughput, delay, and channel utilization as the indicators to measure the queuing model. Then, the queuing model proposed in this paper is compared with the queuing model based on FCFS.


#### 6.2.1. Throughput

Throughput is to measure a system’s ability in handling issues, requests, and transactions per unit of time, and it also is an important indicator to measure the system’s concurrency. Here, we applyTPS (transaction per second) to represent it. The throughput in the blockchain application refers to that the total number of transactions written into the blockchain divided by the time from transaction issuance to transaction confirmation. The formula is as follows:(32)TPSΔT=TransactionSumΔTT,where ΔT is the time interval between the transaction issuance and the block confirmation, and it is the block time as well, and TransactionSumΔT is the number of transactions included in the block during this time interval. The throughput’s comparison of the two queuing models is shown in Figure 9.Figure 9
Comparison of throughput between two queuing models.It can be seen that whenT<10s, the throughput of the FCFS-based queuing model is greater than the M/M/N/m queuing model with priority. At the beginning, there was much influx of data flow. The FCFS queuing model processes data flow in the light of “come first, be served first,” and there is needless to process data flow according to priority. Therefore, the throughput of the FCFS queuing model is higher than the M/M/N/m queuing model. However, as time goes on, Markov theory is applied to schedule resources in the M/M/N/m queuing model, which improves the efficiency of queuing and reduces the waiting time of data flow. So, throughput of the model can be increased. In summary, the throughput of the M/M/N/m queuing model is generally higher than the FCFS queuing model.


#### 6.2.2. Delay

In networks, delay includes sending delay, propagation delay, processing delay, and queuing delay. Here, we define the delay indicator as follows:(33)delay=Tsend+Tdeal+Treceive+Tqueue,where Tsend is the block-sending delay;Tdeal is the processing delay; Treceive is the transmission delay that the block reaches the next node; Tqueue is the queuing waiting delay of the data flow. The delay comparison between the two queuing models is shown in Figure 10.Figure 10
Comparison of delay between two queuing models.Since the transmission delay and propagation delay of the data flow simulated in this paper are the same, the differences between the two models focus on processing and queuing. When the running time is less than one minute, the delay of the FCFS model is smaller. This is because the high-priority data flow of the M/M/N/m queuing model preempts the channel, and it results in a higher delay of the low-priority data stream. When the running time is longer, as the throughput of the M/M/N/m queuing model increases, the processing capacity of the model also enhances accordingly. Thus, the processing delay of the M/M/N/m queuing model decreases. In addition, Markov theory is applied to schedule resources in the M/M/N/m queuing model, which improves the queuing efficiency of the model. Hence, the queuing delay also is continuously reduced. In summary, the overall delay of the M/M/N/m queuing model is less than the FCFS model.


#### 6.2.3. Channel Utilization

Channel utilization refers to the ratio of the timeTwork to the total time Tall when the channel is in the state of transmitting data, namely,(34)ηchannel=TworkTall.Apparently, we hope that the channel utilization is higher. The comparison of channel utilization for the two queuing models is shown in Figure11.Figure 11
Comparison of channel utilization between two queuing models.We find that the channel occupancy rate of the M/M/N/m queuing model is generally higher than the FCFS model. The channel occupancy of the FCFS model is basically maintained at 60%, while the channel occupancy of the M/M/N/m queuing model is higher than 80%. Moreover, the channel occupancy of the M/M/N/m queuing model increases faster than the FCFS model.In conclusion, the performance of the M/M/N/m queuing model is better than the FCFS model, and the former can better meet the performance requirement of the blockchain application system, reduce the data waiting time, and improve the efficiency of the block.


## 6.1. Data Simulation

First of all, we set the simulation parameters as follows:EXpn=EXp=20, λ1=λ2k=1=λ2k=2=0.01. Then, we set up 1000 accounts, with the number of transactions for each account that is randomly distributed between 1 and 100, and the value of each transaction that is randomly distributed between 1 and 1000. The arrival time of transaction for each account is random as well. The statistics of transaction quantity and transaction price of all accounts are shown in Table 1.Table 1
Quantity and price of transactions in the accounts.
QuantityPrice1–350351–660661–10001–338713411934–661249110467–100103126112Total314351335According to Table1, the transaction quantity and transaction price of the accounts are evenly distributed. We sorted the accounts into three priorities based on the three principles mentioned above.


## 6.2. Performance Index

In this paper, we also use throughput, delay, and channel utilization as the indicators to measure the queuing model. Then, the queuing model proposed in this paper is compared with the queuing model based on FCFS.


### 6.2.1. Throughput

Throughput is to measure a system’s ability in handling issues, requests, and transactions per unit of time, and it also is an important indicator to measure the system’s concurrency. Here, we applyTPS (transaction per second) to represent it. The throughput in the blockchain application refers to that the total number of transactions written into the blockchain divided by the time from transaction issuance to transaction confirmation. The formula is as follows:(32)TPSΔT=TransactionSumΔTT,where ΔT is the time interval between the transaction issuance and the block confirmation, and it is the block time as well, and TransactionSumΔT is the number of transactions included in the block during this time interval. The throughput’s comparison of the two queuing models is shown in Figure 9.Figure 9
Comparison of throughput between two queuing models.It can be seen that whenT<10s, the throughput of the FCFS-based queuing model is greater than the M/M/N/m queuing model with priority. At the beginning, there was much influx of data flow. The FCFS queuing model processes data flow in the light of “come first, be served first,” and there is needless to process data flow according to priority. Therefore, the throughput of the FCFS queuing model is higher than the M/M/N/m queuing model. However, as time goes on, Markov theory is applied to schedule resources in the M/M/N/m queuing model, which improves the efficiency of queuing and reduces the waiting time of data flow. So, throughput of the model can be increased. In summary, the throughput of the M/M/N/m queuing model is generally higher than the FCFS queuing model.


### 6.2.2. Delay

In networks, delay includes sending delay, propagation delay, processing delay, and queuing delay. Here, we define the delay indicator as follows:(33)delay=Tsend+Tdeal+Treceive+Tqueue,where Tsend is the block-sending delay;Tdeal is the processing delay; Treceive is the transmission delay that the block reaches the next node; Tqueue is the queuing waiting delay of the data flow. The delay comparison between the two queuing models is shown in Figure 10.Figure 10
Comparison of delay between two queuing models.Since the transmission delay and propagation delay of the data flow simulated in this paper are the same, the differences between the two models focus on processing and queuing. When the running time is less than one minute, the delay of the FCFS model is smaller. This is because the high-priority data flow of the M/M/N/m queuing model preempts the channel, and it results in a higher delay of the low-priority data stream. When the running time is longer, as the throughput of the M/M/N/m queuing model increases, the processing capacity of the model also enhances accordingly. Thus, the processing delay of the M/M/N/m queuing model decreases. In addition, Markov theory is applied to schedule resources in the M/M/N/m queuing model, which improves the queuing efficiency of the model. Hence, the queuing delay also is continuously reduced. In summary, the overall delay of the M/M/N/m queuing model is less than the FCFS model.


### 6.2.3. Channel Utilization

Channel utilization refers to the ratio of the timeTwork to the total time Tall when the channel is in the state of transmitting data, namely,(34)ηchannel=TworkTall.Apparently, we hope that the channel utilization is higher. The comparison of channel utilization for the two queuing models is shown in Figure11.Figure 11
Comparison of channel utilization between two queuing models.We find that the channel occupancy rate of the M/M/N/m queuing model is generally higher than the FCFS model. The channel occupancy of the FCFS model is basically maintained at 60%, while the channel occupancy of the M/M/N/m queuing model is higher than 80%. Moreover, the channel occupancy of the M/M/N/m queuing model increases faster than the FCFS model.In conclusion, the performance of the M/M/N/m queuing model is better than the FCFS model, and the former can better meet the performance requirement of the blockchain application system, reduce the data waiting time, and improve the efficiency of the block.


## 6.2.1. Throughput

Throughput is to measure a system’s ability in handling issues, requests, and transactions per unit of time, and it also is an important indicator to measure the system’s concurrency. Here, we applyTPS (transaction per second) to represent it. The throughput in the blockchain application refers to that the total number of transactions written into the blockchain divided by the time from transaction issuance to transaction confirmation. The formula is as follows:(32)TPSΔT=TransactionSumΔTT,where ΔT is the time interval between the transaction issuance and the block confirmation, and it is the block time as well, and TransactionSumΔT is the number of transactions included in the block during this time interval. The throughput’s comparison of the two queuing models is shown in Figure 9.Figure 9
Comparison of throughput between two queuing models.It can be seen that whenT<10s, the throughput of the FCFS-based queuing model is greater than the M/M/N/m queuing model with priority. At the beginning, there was much influx of data flow. The FCFS queuing model processes data flow in the light of “come first, be served first,” and there is needless to process data flow according to priority. Therefore, the throughput of the FCFS queuing model is higher than the M/M/N/m queuing model. However, as time goes on, Markov theory is applied to schedule resources in the M/M/N/m queuing model, which improves the efficiency of queuing and reduces the waiting time of data flow. So, throughput of the model can be increased. In summary, the throughput of the M/M/N/m queuing model is generally higher than the FCFS queuing model.


## 6.2.2. Delay

In networks, delay includes sending delay, propagation delay, processing delay, and queuing delay. Here, we define the delay indicator as follows:(33)delay=Tsend+Tdeal+Treceive+Tqueue,where Tsend is the block-sending delay;Tdeal is the processing delay; Treceive is the transmission delay that the block reaches the next node; Tqueue is the queuing waiting delay of the data flow. The delay comparison between the two queuing models is shown in Figure 10.Figure 10
Comparison of delay between two queuing models.Since the transmission delay and propagation delay of the data flow simulated in this paper are the same, the differences between the two models focus on processing and queuing. When the running time is less than one minute, the delay of the FCFS model is smaller. This is because the high-priority data flow of the M/M/N/m queuing model preempts the channel, and it results in a higher delay of the low-priority data stream. When the running time is longer, as the throughput of the M/M/N/m queuing model increases, the processing capacity of the model also enhances accordingly. Thus, the processing delay of the M/M/N/m queuing model decreases. In addition, Markov theory is applied to schedule resources in the M/M/N/m queuing model, which improves the queuing efficiency of the model. Hence, the queuing delay also is continuously reduced. In summary, the overall delay of the M/M/N/m queuing model is less than the FCFS model.


## 6.2.3. Channel Utilization

Channel utilization refers to the ratio of the timeTwork to the total time Tall when the channel is in the state of transmitting data, namely,(34)ηchannel=TworkTall.Apparently, we hope that the channel utilization is higher. The comparison of channel utilization for the two queuing models is shown in Figure11.Figure 11
Comparison of channel utilization between two queuing models.We find that the channel occupancy rate of the M/M/N/m queuing model is generally higher than the FCFS model. The channel occupancy of the FCFS model is basically maintained at 60%, while the channel occupancy of the M/M/N/m queuing model is higher than 80%. Moreover, the channel occupancy of the M/M/N/m queuing model increases faster than the FCFS model.In conclusion, the performance of the M/M/N/m queuing model is better than the FCFS model, and the former can better meet the performance requirement of the blockchain application system, reduce the data waiting time, and improve the efficiency of the block.


## 7. Conclusion

In this paper, we built a multipriority stock trading model based on the Markov chain for blockchain application and deduce the transmission time expression of data flow with different types of priority. We map the priority of service to multiple channels and establish the multichannel data transmission model of the multiservice data flow with priority guarantee. Moreover, applying queuing theory, we analyze the parameters of the multiservice and multichannel model with priority in the blockchain scenario, such as average queue length and average waiting time. In addition, this paper studies the dynamic optimization of resource scheduling in the queuing model by employing the Markov chain, which provides theory and method support for practical application in the future and maximizes the usage of resources in our model. Experiments show that the model proposed in this paper has better performance in three important indicators, i.e., the throughput, the delay, and the channel utilization. So our model improves the efficiency of stock purchase in blockchain application and reduces the waste of resources, which will better meet the current market demand. The methods reported here will open up avenues for further research in the financial field.



---

*Source: 3984924-2020-11-09.xml*