Auction and Classiﬁcation of Smart Contracts

: The execution of smart contracts (SCs) relies on consensus algorithms that validate the miner who executes the contract and gets a fee to cover her expenditure. In this sense, miners are strategic agents who may focus on executing those contracts with the largest fee, to the detriment of other SCs’ execution times, which also harms the blockchain’s reputation. This paper analyzes the impact of miners’ competition on SCs’ execution times in a public blockchain. First, we explain that the Proof-of-Work mechanism casts similarities with a time auction, where the one who ﬁrst adds blocks is the one who executes the contract and gets the fee. At equilibrium, costs negatively affect execution times, while the opposite holds concerning fees. However, this result does not capture the competition for other contracts; hence, we apply the Naïve Bayes method to classify SCs by considering a simulated database that comprises miners’ competition for several contracts. We observe that simultaneous competition generates patterns that differ from the ones expected by the auction solution. For example, miners’ valuation does not accelerate contracts’ execution, and high-cost smart contracts do not necessarily execute at last places.


Introduction
Blockchain networks have boosted the implementation of smart contracts (SCs) since they provide a decentralized process that self-activates such agreements when certain conditions are satisfied. During this process, the network's nodes (miners) create blocks by solving mathematical puzzles, which is an activity that requires resources like hash power in Ethereum [1]. Later, a 'consensus algorithm' determines the miner who adds the block that the SC's execution needs and this miner gets a fee as a reward [2]. So, consensus mechanisms promote miners' competition because miners only get fees by adding the blocks that smart contracts need [3,4].
Consequently, miners follow an economic and strategic behavior since they choose those SCs that provide them the largest benefit [5] and join pools to share resources, which allows them to compete for a larger number of smart contracts [6]. So, public blockchain platforms deal with the issues associated with peer-to-peer networks, such as lack of security and coordination [7]. Nevertheless, SCs' execution times also rely on miners' decision-making. Specifically, miners may slow the activation of smart contracts because puzzles are costly to solve [8] or there are simultaneous requisitions to execute contracts due to an increasing number of SCs' applications [9,10]. In general, it is not clear the impact of miners' interactions, mining costs, and contracts' fees on the time that independent smart contracts last to be executed [11]. In this sense, by considering that miners simultaneously compete to add blocks in other contracts, this paper addresses the following research question: How do costs, fees, and miners' valuation impact SCs' execution times? To answer this question, we first propose a game-theoretical model to determine the execution time that miners last in executing a contract characterized by its cost and fee. Later, we use the previous result to simulate the simultaneous execution of several smart contracts. Finally, we use machine learning techniques to classify execution times by considering costs, fees, and miners' features.
It is worth recalling that consensus algorithms play a major role in activating smart contracts since they determine the miner who adds a contract to the blockchain. To build our game-theoretical model, we assume the blockchain uses the proof-of-work (PoW) algorithm because it assigns a contract to the miner who first solves the contract's puzzle after spending her resources. Furthermore, we simplify the analysis by considering that contracts are independent among, which means that contracts do not trigger other contracts' variables [12].
By the previous discussion, miners' competition resembles a sealed bid time auction because the miner who sets the minimum time to create a node is the one who executes the contract's code. So, we model the miners' competition as a simultaneous game of incomplete information where miners observe each contract's features but do not know other miners' valuations. The equilibrium analysis provides a closed-form solution concerning the time each miner bids, which is described in terms of the miners' and contracts' features. At equilibrium, the comparative statics point out that execution times diminish as the number of miners and the fee increase, while the opposite happens when cost increases. Nevertheless, this result ignores the fact that miners can compete to get other contracts [9]. Although we can understand the previous interaction as a simultaneous auction problem [13], this framework is not necessary since SCs' are not interrelated, miners independently value each smart contract, and the consensus algorithms serially allocate contracts among miners. Thus, we propose a Naïve Bayes classification to determine how competing for other contracts impacts execution times. The Naïve Bayes technique groups SCs by considering the execution time as the independent variable. In contrast, miners' and contracts' features are the independent variables. Then, we simulate the competition between 1000 miners and 10,000 contracts by considering the auction solution.
Surprisingly, our classification's results differ from those we expected, given the comparative statics analysis. First, miners' valuation does not increase or decrease execution times; specifically, we get that miners' valuation induces an almost uniform conditional probability distribution. Second, fees and costs modify how fast a smart contract is executed, observing counter-intuitive results. For example, low cost and high fees slow the execution of some contracts.
Our paper is closely related to the literature that analyzes how miners impact the execution of smart contracts [14]. For example, miners pool resources as the contracts' complexity increases [15] to maximize their benefits [16]. Moreover, consensus algorithms are coordination mechanisms that transparently determine who has the right to execute a smart contract without interfering in how miners pick contracts, which also may cause dishonest behavior from them [17]. So, miners can manipulate the consensus mechanism by centralizing resources in mining pools [18], which tends to happen in those platforms that use algorithms that do not require the explicit use of resources for mining blocks, such as the Proof-of-Stake (PoS) and the Proof-of-Authority (PoA) algorithms [19,20]. In this sense, our contributions unfold in two streams. First, we describe the PoW mechanism as a time auction that allows us to find a closed-form solution that echoes empirical findings: the execution time of a contract increases as the contracts need more resources to be executed (costs) [21], and large fees reduce execution times [22]. This shows that game-theoretical models serve for designing consensus algorithms, which is of growing interest to avoid manipulation and safeguard users' welfare [23,24]. Second, we extend the applications of the Naïves Bayes technique to classify smart contracts based on the features that characterize their time of execution.
Typically, classification techniques have widely used to determine if a SC is not legal or duplicates a transaction [25,26] because not all smart contracts are secure [27] or well-defined [28]. Furthermore, we can classify miners to identify pools that try to prioritize the execution of certain contracts over others [14]. Our classification shows that the probability of being executed with a certain priority is independent of miners' valuation, while economic variables (fee and costs) are the ones that change this probability. This result supports the necessity of designing consensus mechanisms based on auctions to prevent miners' collusion [29] and reduce the use of resources [30].
The paper is organized as follows. The next section presents the auction game in which miners interact to set execution times. Later, in Section 3, we describe the game s solution, which we use to build the dataset. The theoretical model allows us to create a Naïve Bayes classifier, in Section 4, such that dependent variables are the contracts' features. Section 5 discusses the main results concerning Naïve Bayes evaluation and classification. The last section presents the paper's conclusions.

Model
In a public blockchain platform, miners compete to execute a SC. Specifically, we focus on a public blockchain that uses the proof-of-work consensus mechanism. To model miners' competition in such a structure, we first consider a market where agents a and p exogenously establish a smart contract x with a fee f x . To simplify the notation, we refer to the previous smart contract as x( f x ). The fee is a reward expressed as a positive amount of the digital coin used in the public blockchain P where the SC stands. Miners can use f x to get resources exchanged in P.
We assume the existence of a trustworthy oracle that points out the necessity to execute x( f x ). For instance, we say that the oracle is not strategic. Moreover, all miners observe the need of adding nodes to P .

Basic Elements
Let M = {1, 2, . . . , m} be the set of all miners in the digital platform; we use i to denote a generic miner in M. The time that miner i lasts to pick x( f x ) is denoted by t i , where t i ∈ T i = [0, ∞). Given that smart contracts execution requires miners' resources as time passes, miner i faces a cost function c i (t i ) for picking the contract in a time t i . We consider that c i is a function from T i to R such that dc i /dt i < 0, which captures the fact that miners can get better resources to solve puzzles with more time [31]. We characterize miners by a valuation v i about picking the contract x( f x ) to get f x coins. Let V i be the set of all valuations of miner i.
The state of the market is a vector v = (v 1 , v 2 , . . . , v m ) that is an element of V = V 1 × · · · × V m ⊂ R m . We consider that miners' valuation is private information, i.e., each miner i knows their valuation v i but does not know other miners' valuations. Furthermore, agents p and a do not observe v. So, the market state v is the realization of a random vector V = (V 1 , V 2 , . . . , V m ) that is drawn from a probability density function f : V → R, which we assume common knowledge.

The Game
Regardless of digital platforms' architecture, they have similar rules concerning their application on smart contracts. Specifically, digital platforms establish that miners should compete among them to execute the smart contract, i.e., the miner who solves the puzzle as soon as possible is the one who adds the block to the blockchain and gets the associated fee. Thus, we model the competition between miners as a time auction where the winner is the one that sets the minimum time to pick x( f x ).
The interaction between miners starts when all of them observe the request to execute x( f x ). Hence, the game proceeds in the following two stages: Stage 1. Nature draws the market state v = (v 1 , v 2 , . . . , v m ) by following the probability density function f .

Stage 2.
Each miner i observes their valuation v i , but no other miners' valuations. Simultaneously, each miner sets the time t i to pick x( f x ).
All nodes in the platform P observe the profile of picking times t = (t 1 , t 2 , . . . , t m ). Since picking times represent how fast miners mine a block, the miner who sets the lowest picking time is the one who executes x( f x ). If two or more miners set the lowest picking time, the tie is randomly broken, i.e., the probability of executing the code is the same for all these miners. The game finishes with the execution of the smart contract, and the miner who runs it gets f x .
Let u i be the payoff function of i that depends on σ, and the amount of (digital) money µ i that miner i gets when the game finishes.

The Solution Concept
The set of all possible actions of miner i is T i . Recalling that miners' valuation are private information, a pure strategy is a decision rule σ i that maps i's valuation into a picking time t i , i.e., σ i is a function from V i to T i . So, Remembering that miners' valuation is private information, miners have no certainty concerning the payoff that they get when the game finishes with a profile of decision rules ] the expected payoff of miner i at the end of the game; and we consider the Bayesian Nash equilibrium as the solution concept for the game described in Section 2.2.
for all i ∈ M and σ i ∈ Σ i .
In other words, a Bayesian Nash equilibrium is a profile of decision rules under which all miners do not have incentives to deviate from the action that they choose concerning the state of the market v.

Picking Times at Equilibrium
This section searches for the Bayesian Nash equilibria of the game described in the previous section. To simplify the analysis, we assume that miners follow symmetric behavior, and later we perform some comparative statics by considering that random variables V i are independent and uniformly distributed.

Solving the Game
The game described in Section 2.2 establishes that miners simultaneously set the time to pick x( f x ) whereas each miner's valuation is private information. Furthermore, each miner i knows that other miners picking times depend on valuations v j , for all j ∈ M − {j}, i.e., i knows that others decision rules profile σ −i (v −i ) = (t j (v j )) j =i depends on the market state. Then, at the end of the game, i faces three possible scenarios: (a) i executes the smart contract because he sets the lowest picking time, (b) i ties with other miners in setting the lowest time to pick the contract, or (c) i does not set the lowest picking time which means that i does not execute the code.
If i gets the right to execute the contract's code, i gets the fee associated with x( f x ), and he also spends resources to mine blocks that guarantee x( f x ) execution. For example, in Ethereum, these resources are gas and ether. In the opposite case, miners do not get f x and do not spend resources to execute the code. Hence, the payoff function of miner i is Thus, the expected payoff function of miner i is where W, T, and L are the probability events associated with scenarios (a), (b) and (c), respectively.
, each decision rule t j is a transformation of the random variable V j for all j ∈ M − {j}. By assuming that V j is a continuous random variable for all j ∈ M, we have that Consequently, we can rewrite the expected payoff function of i as follows where To search for the best decision rules of miner i to σ(v) −i , we maximize their expected payoff. By expression (1), we first compute the probability Pr[W]of winning the right to execute x( f x ). Note that Pr[W] depends on the profile σ −i (v −i ); as in Auction theory, we assume that all miners behave symmetrically picking x( f x ) in a time that is inversely proportional to their valuation, i.e., all miners j = i choose the decision rule where α is a positive constant. Intuitively, expression (2) captures the fact that miners pick the contracts as soon as their valuation on x( f x ) increases. For example, the previous case arises when miners need money to acquire resources in P. Now, given that t j (v j ) = α/v j is the realization of the random variable α/V j , the probability of winning the right to execute x( f x ) is By assuming that V = (V 1 , . . . , V m ) is a random vector of independent and identically distributed random variables, the definition of the minimum order statistic implies that Finally, we consider that V j follows a uniform distribution on the interval [0, 1], which means that To simplify the calculation of miners' best decision rules, we consider that c i (t i ) = 1/t i + κ, where κ is a fixed cost to mine x( f x ), and 1/t i are the variables costs, in accordance with the assumption that ∂c i /∂t i < 0. The previous cost function, together with expression (3), implies that the expected payoff function in (1) can be rewritten as follows Then, we compute the best response of i to σ −i by considering that other miners decision rules profile is We use the criterion of the first derivative to search for the best response of i; that is to say, we need to solve the equation So, the critical points of the expected payoff function of i are the solutions of Note that the previous expression is equivalent to which is a linear equation on t i . Consequently, the unique solution of the first order condition In other words, E[u i ] has a unique critical point t i that depends on v i . The next theorem demonstrates that t i (v i ), as in expression (5), maximizes the expected payoff function of i when other miners set a picking time that is inversely proportional to their valuation.
Proof. By expression (5), By performing some algebraic simplifications on the previous expression, we have that Furthermore, mα m−1 is a positive constant. So, to verify if the expected payoff function reaches a maximum, or a minimum, on t i , we focus on identifying the sign of where m − 1 and v i + f x − κ are greater than zero. So Consequently, we have that In other words, miner i maximizes their expected utility function by picking .

Corollary 1.
If v i + f x − κ > 0, the game described in Section 2.1 has a unique symmetric Bayesian Nash equilibrium σ * for all i ∈ M.
Proof. It follows from Theorem 1.
Expression (5) establishes a closed-form solution for miners' decision rule at the symmetric Bayesian Nash equilibrium (SBNE). Aside from the fact that such an equilibrium decision rule is unique and single-value, we observe that picking times are inversely proportional to the net revenue that each miner gets, after covering fixed costs, when they get the right to execute the smart contract. The following corollary shows that picking times tend to be such net revenue as the number of miners increases to infinity.

Corollary 2.
As m → ∞, the equilibrium decision rule of i tends to

Proof. From Theorem 1, the equilibrium decision rule of miner
Since lim m→∞ m/(m − 1) = 1, we conclude that

Comparative Statics
As we mentioned before, one of the main advantages of establishing smart contracts relies on the fact that agents p and a do not need the intervention of a third party agent to guarantee the fulfillment of all agreements in x( f x ). By an almost immediate execution, smart contracts provide security and transparency to agents p and a. However, there exogenous factors that may slow or accelerate the execution of smart contracts.
Specifically, expression (5) points out that picking times at equilibrium depend on the number of miners m, the fee f x provided by x( f x ), and the fixed cost κ that miners face by belonging to P. Moreover, Theorem 1 and Corollary 1 imply that the equilibrium decision rule σ * i is single-value, which allow us to perform some comparative statics with respect to the exogenous variables m, f x and κ. The following propositions summarizes the relationship between equilibrium picking times and exogenous variables.
First, picking times reduce as the number of miners increases. Intuitively, a larger number of miners promote competition among them since the consensus algorithm drive a strategic behavior. Proposition 1. At equilibrium, if v i + f x − κ > 0, then picking times diminish as the number of miners increases.
Proof. To demonstrate this proposition, we take the partial derivative of expression (5) concerning m. So, we have that Since In words, there is negative relationship between the time that i lasts to pick x( f x ) and the number of miners in P.
As a consequence of Corollary 2 and Proposition 1, we have that picking times monotonically decreases to 1/(v i + f x − κ) as the number of miners m increases to infinity. In other words, after covering fixed costs, the inverse of the net revenue represents a lower bound for the time that miners last to pick the smart contract x( f x ). Consequently, smart contracts do not immediately execute. Thus, a large number of miners does not guarantee the execution of a smart contract despite that picking times diminish as there are more miners in the public blockchain.
The existence of a lower bound for picking a contract, different from zero, implies that the need for resources plays a major role in the execution of a smart contract x( f x ). The following proposition shows the relationship between the equilibrium decision rule and the economic variables that characterize the contract.

Proposition 2.
Consider σ * i , the equilibrium decision rule of miner i. The relationship between σ * i and f x is negative, and the relationship with respect to κ is positive.
Proof. First, we compute the partial derivative of σ * i with respect to κ. So, we have that Since Given that v i + f k − κ > 0, the relationship between σ * i and f x is negative.
The previous proposition establishes that higher costs of belonging to P may discourage miners from picking a contract in case of not having enough resources. So, picking times increase as the fixed cost increases. Moreover, the relationship between the equilibrium picking time and the fee is negative, which means execution times reduce as p and a provide a larger reward for executing x( f x ).

Contracts Classification
Blockchain platforms provide a decentralized environment for executing smart contracts. The decision rule in Corollary 1 shows the equilibrium picking time that each miner spends to execute contract x( f x ); hence, the minimum picking time is the execution time of x( f x ). So, Corollary 1 allows us to analyze the relationship between the execution time and the exogenous variables v i , f x and k. However, the equilibrium decision rule σ * i does not indicate how the simultaneous competition to execute other contracts y( f y ) = x( f x ) impact the execution time. This section analyzes the implications of simultaneous competition on the SCs' execution times.
It is worth recalling that we consider independent smart contracts, which means that x( f x )'s features and execution does not depend on other contract y( f y ) features and execution. So, if miner i gets a set of contracts {x 1 Consequently, we do not follow a simultaneous auction approach to analyze how the competition for getting other contracts impacts execution times since such an interaction is different from classical simultaneous auctions [13]. Hence, we use machine learning techniques to analyze execution times when miners simultaneously compete to get other contracts.
First, we simulate the game in Section 2.2. The previous simulation provides a database that comprises execution times, fee, cost, and miner's valuations. Then, we classify execution times in terms of the contracts and miners' features.

Building the Data
At equilibrium, miners pick smart contracts by considering the decision rule in Corollary 1. Such a closed-form solution is appealing for classifying smart contracts since it summarizes the SCs' features and the equilibrium behavior of miners. By using the software R, we build a database that comprises the interaction of 1000 miners to execute 10,000 smart contracts. The simulation considers as basis values maximum and minimum costs and fees from the Ethereum platform [32]. Below, we present the code we use to create such a database; it is divided into sections describing the platform, miners, and contracts' features. Note that all variables in the database Contracts_ex are continuous. By applying the classification technique, we get back the mean and standard deviation of the random numbers we used to create the database. So, we need to transform fee, cost, valuation, and picking time into categorical variables to classify contracts.

#PLATFORM
The transformation of variables is based on quantiles of five levels, and each of them represents a qualitative feature. In the case of fee and cost, each level refers to magnitude, that is to say, how large fees and costs are. Specifically, the fee or cost of a smart contract can be considered as Low, Medium-Low, Medium, Medium-High, and High. Concerning valuation, each level represents preference. Then, we can say that the SC x is the Top, Second-best, Third-best, Fourth-best, or Bottom for a miner i depending on her valuation v i . Finally, the picking time categories refer to how fast a smart contract is executed; in this sense, a smart contract can be executed in First, Second, Third, Fourth, and Fifth place. Table 1 shows the labels of each quantile with respect to variables f x , c x , v and t x . Below, we explain the code that we use to perform the previous transformation in R.

The Näive Bayes Classifier
To analyze the impact of cost, fee and valuation on the simultaneous execution of smart contracts, we classify them through the Naïve Bayes (NB) technique. We also consider NB's variations to check the classification's accuracy since the database Contracts_ex is the result of a qualitative transformation of continuous variables. Table 1 summarizes the categorical values that each variable can take. We consider that execution time (t x ) is the independent variable, while fee ( f x ), fixed cost (k) and valuation (v) are the dependent variables. In other words, we classify execution times through the main features of contracts and miners.
Note that our database satisfies the naïve assumption since its variables are independent by construction. Then, the Naïve Bayes method classifies smart contracts through the Bayes' theorem. Mathematically, this technique computes which refers to the conditional probability of being executed at place t ∈ {First, Second, Third, Fourth, Fi f th}, given the features that characterize the contract (fee, cost) and miners' valuation.

Naïve Bayes Implementation
Remember, the Contracts_ex summarizes a simulated interaction between 1000 miners that compete for executing 10,000 contracts. Thus, contracts' classification identifies those features that accelerate or slow the execution of SCHence, we use the Contracts_ex database that comprises categorical values related to miners' preferences, magnitude, and velocity (see Table 1).
We build the classification model by splitting the database into two databases for training and testing. We use the NaïveBayes and e1072 packages of R to verify the robustness of our results. Furthermore, we apply the Kernel and Laplace correction methods.
First, note that execution times classes (First, Second, Third, Fourth, and Fifth) are (almost) perfectly balanced. In other words, each class has an a priori probability of around 20% (see Table 2). Second, Table 3 illustrates the accuracy, for the training and the testing database, concerning the different packages and the correction methods that we use. We observe that accuracy is the same regardless of the package or the correction method. Although accuracy is lower than 50%, this is not surprising since the five classes are almost perfectly balanced. In other words, random guessing provides an accuracy of around 50% for each execution time, which is relatively high by considering that the smart contracts variables take five values. Finally, in Table 4, we present the statistics concerning the execution time classes. Contracts executed at fifth place, the slowest category, have the highest sensitivity. Then, the classifier correctly predicts those contracts that have a slow execution. In other words, the simultaneous competition for getting SCs makes it difficult to predict which contracts are executed as far as possible. In contrast, the correct identification of false cases concerning how fast an SC is executed is around 80% or more for each execution time level. Thus, the classifier correctly identifies those contracts that do not cope with the features to be executed almost immediately. Even though high sensitivity is desirable, the trust and credibility of Blockchain networks rely on preventing execution times manipulation, which holds when we look out for the Positive Predicted Value (PPV) and the Negative Predicted Value (NPV). So, the NPV is larger than the PPV for all execution time categories, which means that miners' interaction is trustworthy. Even more, the auction mechanism does not execute those contracts incorrectly identified as first class. This is important since most results are false positive according to the sensitivity measure. In other words, the Naïve Bayes classifier identifies those contracts that do not cope with the features for being executed in first, second, third, or fourth place. Hence, a large specificity contributes to identifying miners who try to cheat the blockchain. In this sense, the classification may prevent the blockchain platform's loss of trust and credibility.

Conditional Probabilities
The Naïve Bayes classifier computes the conditional probabilities of how fast a SC is executed, given the features of a smart contract. Table 5 shows the features of some contracts and the execution time that the NB classifier predicts.  Table 6 presents the conditional probabilities concerning smart contracts features. This table provides some interesting insights concerning how fast SCs are executed during the simultaneous competition to execute several contracts. First, we observe that miners' valuation induce a uniform distribution, reflecting the simulation's features (see Figure 1). Specifically, results are balanced around a probability of 0.20, which means that the miners' valuation balances the conditional probability. In other words, such a variable does not accelerate or slow the miners' intervention to execute a contract. Given the economic variables (cost and fee) that characterize smart contracts, conditional probabilities are not balanced as it happens with the miners valuation. In both cases, we observe different patterns that contrast with the relationships in Proposition 2.
First, we discuss the probability of execution times given a fee (see Figure 2). Table 6 shows that the probability of being executed in first or second place weakly increases as the SCs' fee increases, in line with the positive relationship between picking times and fee that we find in Proposition 2. Furthermore, contracts with a low fee have a higher probability of being executed in fourth place. However, the probability of being executed at fifth place calls our attention since such a probability increases as the fee also increases; in other words, simultaneous competition. Even more, this probability is larger (0.275) in comparison with the execution of contracts at first (0.21) or second places (0.19). Finally, those contracts in the third category present a balanced probability distribution (0.20).  Finally, conditional probabilities related to costs present the most drastic results (see Figure 3). For example, given a low cost, the probability of being executed at fifth place is greater than 0.7, which is surprising since we expect the opposite; that is to say, the prioritization of cheap contracts. Furthermore, we observe that low cost (cheap contracts) do not guarantee the immediate execution of smart contracts. A medium cost induces the highest probability of being executed at second (0.315) and third place (0.285), while smart contracts with medium-high costs have priority one to be executed; a probability equal to 0.283. Nevertheless, we get zero probability of being executed in fifth place, given medium and medium-high costs; consequently, no smart contracts are classified in fifth place with such costs. We attribute the previous result to the low accuracy since variables take five values. By the above discussion, the simultaneous competition to get several contracts modifies how fast a smart contract is executed. Particularly, given some combinations of qualitative features, we observe the opposite relationship that we expect from Proposition 2.

Conclusions
In this paper, we study the execution times of smart contracts by considering that miners simultaneously compete to get the right to execute more than one contract. Our analysis focuses on independent contracts that stand in a public blockchain that uses the Proof-of-Work mechanism since this consensus mechanism is secure and guarantees coordination among the blockchain's members [16]. Given that PoW induces a direct use of resources, we model miners' competition for a single contract as a time auction. In other words, the miner who first solves the contract's puzzle is the one who gets the associated fee. The analysis of this game-theoretical framework provides a closed-form solution concerning each miner's time to pick a single contract, which also echoes empirical findings. For example, the comparative statistics point out that picking times reduce as fee increases, while mining costs induce the opposite relationship [21,22].
The previous solution does not capture the fact that miners can compete to pick other contracts at the same time, an interaction that we analyze by classifying contracts. Given that contracts are independent, a simultaneous auction does not interrelate the miners' interaction in multiple executions, while the Naïve Bayes classifier allows us to predict execution times based on the smart contracts and miners' features.
Based on equilibrium picking times, we simulate the interaction of 1000 miners that compete for 10,000 contracts. Unsurprisingly, accuracy and sensitivity are below the standards since the independent variables are not dichotomous (we transform continuous variables into qualitative variables with five levels). However, the classification results show some interesting patterns that do not correspond with those expected from the comparative statics analysis. For example, miners' valuation does not accelerate execution times, while costs induce counter-intuitive patterns (the probability of being executed in the last place increases as cost increases). Concerning the variable fee, there is no clear patron of their impact on execution times.
It is worth recalling that the Naïve Bayes classifier provides interesting insights concerning the possibility that miners manipulate the consensus mechanism when multiple contracts are executed. Although the classification results are not good for identifying those contracts that should be executed in a certain order (low sensitivity and positive predicted value), the opposite happens with the identification of contracts that should not be executed by considering a certain priority (high specificity and negative predicted value). We pretend to verify the previous results in future works by considering real data from public blockchains such as Ethereum.
Finally, our main contribution relies on providing a theoretical framework to analyze concurrent operations, whose efficient performance in public blockchains is of interest given the increasing popularity of smart contracts [9,33]. Particularly, the auction model points out the possibility of designing transparent consensus mechanisms that allow the monitoring of dishonest behavior of miners. Such a game-theoretical framework is suitable for including regulatory agents (such as time oracles) to take care of SC users' welfare, which is also a research topic of growing interest [23]. Moreover, smart contracts classification may predict the features that drive miners to follow dishonest behavior, such as manipulating the consensus algorithm. Avoiding dishonest behavior from miners is crucial for blockchains since it compromises their reputation. In this sense, we explain how the Naïve Bayes method is able to identify if miners' interactions modify the execution order of a smart contract and consequently prevent miners' misbehavior.