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

With the continuous development of the blockchain, it has brought a subversive impact on the blossom of all ﬁelds with its characteristics of decentralization, trust-free, and tampering, especially in the ﬁnancial ﬁeld. It is of great signiﬁcance to research the application of blockchain technology in the ﬁnancial ﬁeld. As an important part of the ﬁnancial market, stock has the crucial inﬂuence, 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 ﬁnancial architecture according to diﬀerent service priority. Meanwhile, a queuing-based resource scheduling model is established by using the Markov chain to ﬁnd the optimal solution. The method in this paper can greatly improve the eﬃciency of the system and provide a basis for future scientiﬁc research in the healthy and sustainable development of the securities industry.


Introduction
e cash stock market is the most popular and active capital market in the world. e rise of stocks is directly influenced by national policies. e 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. e 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]. rough 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].
is leads to the concept of "blockchain." e 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. ese can make information instant verifiable and traceable, but it is difficult to change and revoke. us, 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 ings (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. is process requires memory-less properties. e 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. e 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. e different priority service objects in the scenario are also discussed. (iii) e 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.
rough the analysis of the Markov chain and the blockchain, it is not difficult to find that they belong to the chain structure. erefore, by combining the queuing model with blockchain technology, this paper proposes a new stock trading method based on the blockchain. Section 2 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. e method proposed in this paper optimizes and improves the stock trading, which can 2 Mathematical Problems in Engineering shorten the settlement time and improve the liquidity of funds.

Related Work
e 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]. ey were committed to applying blockchain technology to real-world production environments and realizing the ultimate goals of high efficiency and low consumption. e security of the blockchain has always been one of the hotspots, and many researchers have made a host of contributions to this problem [28][29][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. eir 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 selforganizing 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. en, 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. e queuing theory was used to analyze the transaction confirmation time of the blockchain. ey modeled the bitcoin transaction confirmation process as a priority queuing system with batch services and derived the average transaction confirmation time [36]. e 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 twomonth transactions using actual statistics from bitcoin and Ethereum [39].

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, X n , 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.
e finite-dimensional distributions of the process are shown as follows: where the set S is the state space of the process and the value X n ∈ S is the state of the process at the time n. e probability distribution uniquely determines the probability of all events in the process. erefore, if the finite-dimensional distributions of two random processes are equal, their distributions are equal: e stochastic process on the countable set S and X � X n : n ≥ 0 { } is a Markov chain, for any i, j ∈ S and n ≥ 0: where P ij is the probability of a Markov chain moving from state i to state j. Obviously, Mathematical Problems in Engineering 3 (1), called the Markov property, means that at any timen, the conditional distribution of the next state X n+1 is independent of the past state X 0 , . . . , X n− 1 . at 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 X n would be a nontime-homogeneous Markov chain [40].
P ij is a matrix that consists of the transition probability: is 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. e finite-dimensional distribution of X n is determined by its initial probability distribution X 0 and transition probability.
Assuming that the transition probability and the initial probability of the Markov chain X n are P ij and α i � P X 0 � i , respectively, for any i 0 , . . . , i n ∈ S and n ≥ 0, we can get the following formula: P ij is defined as the probability of the process through n steps from state i to state j. In particular, P 1 ij � P ij , P n � PP . . . P n .
√√√ √ √√√ √ e Chapman-Kolmogorov equation can be obtained by the multiplication property of the matrix P m+n � P m p n , for m, n ≥ 1: en, Here, they are established for all nonnegative integers n. e state transition of the Markov chain can be expressed as a graph, called the transition graph, as shown in Figure 1. And, each edge in the graph is assigned a transition probability. e concepts of "reachable" and "connected" can be introduced through the transition graph.

Queuing eory.
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. e queuing process is shown in Figure 2.
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. e 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. e queuing system is divided into two types according to their priority, as shown in Figure 3.

Priority-Based Queuing Modeling
e 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. e set of users is U � 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. ese 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.
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 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) e principle of the value priority: when the value is higher, the priority is higher. e calculation of the value is as follows: where W p represents the transaction univalence, W q indicates the transaction quantity, and W value is the total value of the traded stock. (ii) e principle of transaction time priority: for the same value declaration, the earlier submission time is preferred.
(iii) e principle of the quantity priority: when the purchase quantity is more, the priority is higher.
e 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. is 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. e 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. e chain establishment is that the newly generated blocks are concatenated into a blockchain. e queue and establishment model of a blockchain is shown in Figure 5. 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. e priority-based queuing model is regarded as an M/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. erefore, 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 , λ k�1 2 , and λ k�2 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 is (1/μ 1 ) and T tk , T ω  In the M/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. e 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 lowpriority 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. e specific transmission process is exhibited in Figure 6. In addition, we assume that all the random variables defined above are independent of each other.

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 that b represents the sequence number of blocks and C represents the number of blocks generated by the data flow (b < C). If ρ � (λ 1 /(μ 1 + 2 k�1 μ k 2 )) (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: We can obtain the probability that a high-priority data flow occupies the busy channel, and the probability is as follows: e average queue length of data flow in the channel can be expressed as follows: where and ρ η � mρ m .

Low-Priority Data Flow.
e 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. e processing of lowpriority 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 is N, there is no channel to transmit low-priority data flow.
In the model, we set k as the priority of the data flow, the value of k is 1 or 2, and n is the interrupted number. e service time of the low-priority data flow in the channel η is X η k . en, the busy degree of the channel is as follows:  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: where in which D η k,i is the time delay when the data flow is interrupted in the channel η and p η k,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: e service time can be calculated as follows: In the stop-and-wait situation, when k � 1, the waiting time of the data flow can be computed as follows: 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 highpriority data flow within the waiting time.
rough (21), we can obtain the following formula: Similarly, when k � 2, the waiting time is computed as follows: ET.

(23)
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. rough (22), we get the following: e average remaining service time of the current data flow in the channel η can be expressed as follows:

Mathematical Problems in Engineering
ET. (25) e 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 Figure 7). e proposed method in this paper can greatly improve the efficiency of the queuing model and meet the relevant needs in the trade.

Markov Chain Model
Markov chain is a mathematical model to describe the state transition of complex systems. e multistage decision process problem can be solved by adopting the model. However, the state of the process must satisfy the nonaftereffect property. e nonaftereffect property is only related to the state of the phase, and it is irrelevant to the previous state. e 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 Figure 8. erefore, the application of the Markov chain theory can solve the problem of resource allocation in the queuing model.

Model Building.
In this paper, we apply F(s) to represent the state of the model, and F(s); s ∈ S { } is a random process; the state vector distribution χ � χ 1 , χ 2 , χ 3 , . . . represents the probability of each state at the current moment. P ij constitutes the probability transition matrix Λ. e formula of state distribution vector at the time n is as follows: 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: We suppose the current time is t, the node o is overloaded, and the state of node o at the time t is L t . To make the model achieve efficiently, data flow needs to be migrated. For the first d moments (d < t), the load transfer sequence is L 1 , L 2 , . . . L d . From this transition sequence, the occurrence time of state transition i ⟶ j in adjacent moments are denoted as C ij and P ij is the transition probability from state i to state j, which can also be obtained as follows: From the state transition probability, we can obtain the transition probability matrix of the Markov chain.
In addition, we supposed that f(n) represents the total expected reward at the end of the process when the model is in the state F(n) � i and r ij represents the corresponding reward for moving from state F(n) � i to the next state F(n + 1) � j, then we can gain the following equation: 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 where q(i) is the expected cost of a transition from the state i, namely, it is the expected cost of the state i. e 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 the Z-transform analysis method, which can transform the differential equations into the corresponding ordinary equations. e 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:

Resource Scheduling Algorithm Based on Markov
Chain. e specific algorithm is shown in Algorithm 1. 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.

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

Data Simulation.
First of all, we set the simulation parameters as follows: � 0.01. en, 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. e arrival time of transaction for each account is random as well. e statistics of transaction quantity and transaction price of all accounts are shown in Table 1.
According to Table 1, 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.

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

roughput.
roughput 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 apply TPS (transaction per second) to represent it. e 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. e formula is as follows: 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. e throughput's comparison of the two queuing models is shown in Figure 9.
It can be seen that when T < 10 s, 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. e 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. erefore, 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.

Delay.
In networks, delay includes sending delay, propagation delay, processing delay, and queuing delay. Here, we define the delay indicator as follows: where T send is the block-sending delay; T deal is the processing delay; T receive is the transmission delay that the block reaches the next node; T queue is the queuing waiting delay of the data flow. e delay comparison between the two queuing models is shown in Figure 10.
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. is is because the highpriority data flow of the M/M/N/m queuing model preempts the channel, and it results in a higher delay of the lowpriority 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.
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.

Channel Utilization.
Channel utilization refers to the ratio of the time T work to the total time T all when the channel is in the state of transmitting data, namely, Apparently, we hope that the channel utilization is higher. e comparison of channel utilization for the two queuing models is shown in Figure 11.
We find that the channel occupancy rate of the M/M/N/m queuing model is generally higher than the FCFS model. e 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.

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. e methods reported here will open up avenues for further research in the financial field.

Data Availability
e data used to support the findings of this study are included within the article.

Conflicts of Interest
e authors declare that they have no conflicts of interest.