# Optimal Auction For Edge Computing
Resource Management in Mobile Blockchain Networks: A Deep Learning Approach

###### Abstract

Blockchain has recently been applied in many applications such as bitcoin, smart grid, and Internet of Things (IoT) as a public ledger of transactions. However, the use of blockchain in mobile environments is still limited because the mining process consumes too much computing and energy resources on mobile devices. Edge computing offered by the Edge Computing Service Provider can be adopted as a viable solution for offloading the mining tasks from the mobile devices, i.e., miners, in the mobile blockchain environment. However, a mechanism needs to be designed for edge resource allocation to maximize the revenue for the Edge Computing Service Provider and to ensure incentive compatibility and individual rationality is still open. In this paper, we develop an optimal auction based on deep learning for the edge resource allocation. Specifically, we construct a multi-layer neural network architecture based on an analytical solution of the optimal auction. The neural networks first perform monotone transformations of the miners’ bids. Then, they calculate allocation and conditional payment rules for the miners. We use valuations of the miners as the data training to adjust parameters of the neural networks so as to optimize the loss function which is the expected, negated revenue of the Edge Computing Service Provider. We show the experimental results to confirm the benefits of using the deep learning for deriving the optimal auction for mobile blockchain with high revenue.

## I Introduction

Blockchain has been adopted in many applications such as Bitcoin [1], smart grid power systems [2], and finance industry [3]. Recent reports predict that the annual revenue for enterprise applications of blockchain will increase from approximately $2.5 billion worldwide in 2016 to $19.9 billion by 2025, meaning a compound annual growth rate of 26.2% (https://www.tractica.com/research/blockchain-for-enterprise-applications/). Different from the centralized digital ledger approaches, blockchain does not rely on centralized authorities to store transaction data. Instead, data blocks are recorded and shared by blockchain users over the whole blockchain network. Thus, the blockchain achieves high throughput and efficiency of transaction processing while maintaining data security and integrity.

However, deploying blockchain applications in mobile networks faces some critical challenge. This is due to the mining process, i.e., solving the Proof-of-Work (PoW) puzzle, which requires high computing power and energy from mobile devices. To address the challenge, the edge computing paradigm is introduced into the mobile blockchain networks [4], [5] which allows the mining task of mobile users, i.e., the miners, to be offloaded to an Edge Computing Service Provider (ECSP). However, an important issue of how to efficiently allocate the limited edge computing resources to miners still remains.

Auction becomes an appropriate solution which can guarantee that the edge computing resources are allocated to the miners which value the resources most. In a traditional auction, bidders or buyers, which are miners in the mobile blockchain context, compete for the resource units by submitting their prices, i.e., bids, to the ECSP as an auctioneer, i.e., the seller. Given the received bids, the ECSP determines the winning miners and the prices that they pay. However, traditional auctions such as the first-price auction and the second-price auction only guarantee either revenue gain for the ECSP or Incentive Compatibility (IC). The problem of designing an optimal auction in terms of maximizing the revenue for the ECSP and ensuring Dominant-Strategy IC (DSIC) as well as Individual Rationality (IR) is considerably challenging.

In recent years, the deep learning technique which is able to automatically identify relevant features has gained considerable attention. The deep learning, in principle, uses neural networks to encode any mapping from inputs to outputs [6]. Especially, by using stochastic gradient descent, the deep learning succeeds in finding globally optimal solutions. In this regard, the authors in [12] proposed to use the deep learning for the optimal auctions. The deep learning architecture particularly fits for aforementioned setting and problem. In particular, in edge computing resource auction, the inputs to the neural networks are the miners’ bids and the outputs encode the winner determination and payments of the miners. In this paper, we thus use the deep learning architecture which was proposed in [12] for the edge resource allocation for mobile blockchain networks. Specifically, we leverage the analytical solution from [7] to construct the neural network architecture to provide precise fit to the optimal auction. The neural networks first perform monotone transformations of bidding valuations of the miners. Then, they calculate the allocation rule, i.e., winning probabilities of the miners, and the conditional payment rule to the miners. A neural network training is finally implemented to adjust parameters of the neural networks so as to optimize a loss function which is the expected, negated revenue of the ECSP.

Simulation results demonstrate that our proposed scheme can converge quickly to the solution at which the revenue of the ECSP is significantly higher than that obtained by the traditional auction. To the best of our knowledge, this is the first paper that investigates the application of deep learning-based auction for the edge resource allocation in mobile blockchain networks.

The rest of this paper is organized as follows. Section II reviews related work. Section III describes the system model and problem formulation. Section IV presents the deep learning-based optimal auction algorithm for the edge resource allocation. Section V shows the numerical performance evaluation results. Section VI summarizes the paper.

## Ii Related work

There have recently been studies on the applications of game theory and pricing models for blockchain networks. As a pioneer work, the authors in [8] modeled the mining process as a game among the miners. In the game, the strategies of the miners are to determine branches of blockchain to mine. It is then proved that if the miners behave as expected by the Bitcoin designer, there exists a Nash equilibrium in the game. The game approach is also found in [9], but the strategies of the miners are to determine the size of block to broadcast as their responses. Analytical solutions are used to prove the existence of a Nash equilibrium. However, the model has only two miners. Different from [8] and [9], the authors in [10] proposed the cooperative game for the mining pool. Accordingly, the miners form a coalition to accumulate computational power and have steady reward. However, the proposed scheme only considers the internal mining, but not a dynamic environment such as the mobile blockchain network. The reason is from the fact that the mining process with high computing power demand cannot be efficiently implemented at the mobile devices. To address the issue, the authors in [4] introduced an edge computing model into the mobile blockchain network. In the model, the mining process of miners, i.e., mobile users, is offloaded to an ECSP. The allocation of the edge resources to the miners is implemented using a pricing approach based on the combinatorial auction. The proposed scheme maximizes the social welfare while guaranteeing incentive compatibility or truthfulness. However, the revenue of the ECSP is not considered which is the most important factor to incentivize the ECSP to offer its edge computing services. To optimize the revenue, the authors in [12] proposed to use deep learning, an emerging tool for finding globally optimal solutions, for optimal auctions. However, the considered models are general auctions.

The aforementioned approaches motivate us to investigate an optimal mechanism for the edge resource allocation in the mobile blockchain network. Specifically, we employ the deep learning architecture in [12] to design the optimal mechanism which guarantees the revenue maximization for the ECSP while ensuring the DSIC and IR.

## Iii System model and problem formulation

This section introduces the mining process of miners and then presents the system model of the mobile blockhain network as well as the edge resource allocation problem.

### Iii-a Blockchain Mining Process

To create a chain of blocks, a mining process is implemented to confirm and secure transactions to be stored in a block. The mining process actually solves the proof-of-work (PoW). The PoW is a complex mathematical problem [11] in which solving the problem depends on the set of transactions to be included in the block. The mathematical problem is in a form of the hash function to combine the information about the previous block and the set of current transactions. After the problem is solved, the solution has to be propagated to reach consensus, i.e., a certain number of miners agreeing and accepting the solution. Once all these steps are done successfully, the set of transactions proposed by the miner forms a block that is appended to the current blockchain. The first miner which successfully obtains the solution of the PoW and reaches the consensus receives a mining reward. In general, solving the PoW requires high computing power, time, and energy, and thus it cannot be efficiently executed at the mobile devices. As such, we introduce the edge computing model to the mobile blockchain network for offloading the mining process from the mobile devices.

### Iii-B Edge Computing for Blockchain Mining

The edge computing model is shown in Fig. 1 which consists of one ECSP and mobile users, i.e., the miners. The ECSP owns edge computing resources which are distributed across over the network to provide the mobile users computing resource services. We consider a small area of the network including mobile users and one edge computing resource unit of the ECSP. Because the edge computing resource unit is only assigned to a single mobile user, the mobile users compete on buying the unit. Note that each mobile user may already have an initial computing capacity denoted by . If the miner obtains the edge computing resource, it will be combined with the initial computing capacity to speed up the mining process. The size of a block is denoted by , which is the amount of transactions to be included in the block chosen by the miner. In general, when the size of the block is larger, the miner has more incentive to buy the edge computing resource unit to complete mining the block. This means that the miner is willing to pay a high price for the edge computing resource unit. On the contrary, when the initial computing capacity is larger, the miner has the less incentive. In this case, the miner is willing to pay a low price. Let denote the valuation, i.e., the private value, of miner of the edge computing resource unit. Then, of miner can be expressed as .

To obtain the largest revenue gain as well as to guarantee that the edge computing resource unit is allocated to the miner which values the resource unit most, the resource allocation can be modeled as a single-item auction. In the auction, the miners are bidders, i.e., the buyers, and the ECSP is the auctioneer, i.e., the seller. Miner submits price as a bid that the miner is willing to pay the ECSP. Based on the bid profile from all the miners, the ECSP determines the winning miner for the edge computing unit and the corresponding price that the winner needs to pay. The ECSP can employ traditional single-item auctions such as the first-price auction and Second-Price Auction (SPA) to determine the price for the winning miner. However, none of them is an optimal auction. Specifically, the first-price auction guarantees the revenue gain for the ECSP, but cannot ensure the IC. That is, the miners have incentive to submit untruthfully their bids so as to improve their utility , . The SPA can hold the IC, but the revenue improvement for the ECSP is not guaranteed.

Therefore, the ECSP needs to solve the problem of optimal single-item auction. More specifically, the ECSP needs to determine the winner and the corresponding payment so as to maximize the ECSP’s revenue, i.e., the payment received from the winner, while guaranteeing the DSIC and IR. A mechanism is DSIC if the utility of each miner is maximized by submitting truthfully its bid regardless of the other miners’ actions. The IR is to guarantee that the miners have non-negative utility for participating in the auction. The design of such an exactly optimal auction is still open. Therefore, we design the optimal single-item auction using deep learning for the resource allocation which is presented in the next section.

## Iv Optimal auction using deep learning

In this section, we introduce a neural network architecture for the single-item auction as presented in Section III. The neural network architecture is found in [12] which implements allocation and payment rules for the ECSP and guarantees that any auction mechanism learned by the network will be the optimal auction. Again, the optimal auction is in terms of maximizing revenue of the ECSP and ensuring the DSIC and IR. The learned mechanism is expected to provide precise fit to the optimal auction design, and thus we leverage the monotone transform functions, denoted as , from [7] to determine the allocation and payment rules of the neural network architecture. As presented in [7], input bids , of miners are first transformed to . Then, the SPA with zero reserve price (SPA-0) is used on the transformed bids to determine the allocation and conditional payment rules for the miners. Here, the reserve price refers to the lowest price which is acceptable by the ECSP for the resource unit. Let and denote the SPA-0 allocation rule and the SPA-0 payment rule for miner , respectively. Then, we have the following theorem.

Theorem 1 ([7]).For any set of strictly monotonically increasing functions , an auction which is defined by allocation rule and conditional payment rule is DSIC and IR.

Theorem 1 means that if we construct a mechanism with allocation and conditional payment rules, i.e., and , then the mechanism satisfies the necessary and sufficient conditions for DSIC and IR for any choice of strictly monotone transform functions [12]. This is the reason that we use Theorem 1 to constrain our neural network architecture to learn the auction. As such, the auction learned by the neural network will be DSIC and IR. However, instead of specifying the precise functional form of the transform functions, the neural network learns the appropriate transform functions to minimize a loss function, i.e., the expected, negated revenue of the ECSP, which is equivalent to maximizing the expected revenue of the ECSP. The neural network architecture is shown in Fig. 3(a) with multiple layers to perform (i) the monotone transform functions , (ii) the allocation rule , and (iii) the conditional payment rule . The algorithm for implementing these steps are given in Algorithm 1, and the further details are described in the following.

### Iv-a Monotone Transform Functions

Transform function is used to map input bid of miner to its transformed bid . We model each as a two-layer feed forward network with and operators over linear functions as shown in Fig. 3(b). Here, we use groups of linear functions , where , , and are the weights and bias, respectively. Then, the transform function is defined as follows:

(1) |

In fact, the inverse transform can be directly deduced from the parameters for the forward transform as follows:

(2) |

Such a neural network is similar to a general autoencoder neural network which consists of two parts [12], i.e., the encoder and the decoder. The encoder performs transformations of the input bids to a different representation through using (1) and the decoder inverts the transform through using (2).

### Iv-B Allocation Rule

The allocation rule is based on the SPA-0 allocation. Specifically, it assigns the computing resource unit of the ECSP to the miner with the highest transformed bid if this transformed bid is greater than zero, and leaves the computing resource unit unassigned otherwise. In our work, as illustrated in Fig. 3(a), the allocation rule maps the transformed bids , i.e., the input, to a vector of assignment probabilities , i.e., the output. Since there is a competition among the miners, the allocation rule can be approximated by using a softmax function on the transformed bids and an additional dummy input as follows:

(3) |

where is the parameter which determines the quality of the approximation [12]. The higher value of increases the accuracy of the approximation. However, the allocation function may be discontinuous and less smooth which becomes harder to optimize.

### Iv-C Conditional Payment Rule

The conditional payment rule sets price to miner given that the miner is the winner. The conditional payment is implemented by two steps. The first step calculates SPA-0 payment to the miners as shown in Fig. 3(b), and the second step determines conditional payment by using Theorem 1.

Specifically, the SPA-0 payment to miner is the maximum of the transformed bids from the other miners and zero. Thus it can be determined using a activation unit as follows:

(4) |

where is an activation function which ensures that the SPA-0 payment is non-negative. The conditional payment to miner is then calculated as , where is determined according to (2).

In summary, the allocation rule can be seen as a feed-forward network including (i) a layer of linear functions, (ii) a layer of max-min operations, and (iii) a layer of softmax activation functions. The conditional payment rule which has more layers because of using additional inverse transforms can be seen as a network consisting of (i) a layer of linear functions, (ii) a layer of max-min operations, (iii) a layer of ReLU activation functions, (iv) a layer of linear functions, and (v) a layer of min-max operations.

### Iv-D Neural Network Training

The objective of the training is to optimize weights and bias of a neural network so as to minimize a loss function that is defined on the inputs and outputs of the network. In our work, the weights and the bias are and , where , , and , the loss function is defined as the expected, negated revenue function of the ECSP, and the input, i.e., the training data or training set, consists of bidder valuation profiles of the miners. In particular, the bidder valuation profiles of the miners are sampled independently and identically distributed from a known distribution function. Generating the bidder valuation profiles is described as follows.

Let denote bidder valuation profile of the miners, where , is the size of the training data, and is the valuation, i.e., the private value, of miner on the resource computing unit which is drawn from a distribution . As mentioned in Section III, of miner can be expressed through its block size and its initial computing capacity , i.e., . Thus, the distribution can be determined based on the distribution of , denoted as , and that of , denoted by . The distributions and are available, e.g., based on the previous observations. Assume that variables and are independent from each other and follow uniform distributions [13], i.e., and , . Then, is determined as follows.

Let , , and we have and . Given the setting, the Jacobian determinant among and is given by

(5) |

The Probability Density Function (PDF) for the joint distribution is given by

(6) |

The distribution of , i.e., , is determined by

(7) | ||||

where is within .

Let and denote the assignment probability and conditional payment of miner , respectively. w and are the matrices containing weights and bias , , , and , respectively. The objective is to find parameters to minimize the expected, negated revenue function of the ECSP as the loss function:

(8) |

## V Performance evaluation

In this section, we present experimental results to demonstrate that deep learning can be used to improve the revenue for the ECSP in the mobile blockchain network. For comparison, the proposed scheme is named Deep Learning (DL)-based auction. The SPA [14] is used as a baseline scheme. The DL-based auction is implemented by using the TensorFlow deep learning library. The simulation parameters are shown in Table I. Note that the regularization is used in the training step to ensure that the weight parameters are bounded. Also, the training set has 1000 valuation profiles , and samples and are chosen from distributions and , respectively.

Parameters | Values |
---|---|

Number of miners () | 10, 15, and 20 |

Learning rate | 0.0001 |

Regularization parameter () | 0.01 |

Training set size | 1000 valuation profiles |

Number of groups () | 5 |

Number of linear functions () | 10 |

Number of iterations | 4000 |

Approximate quality | 1 and 2 |

Distribution of size of block | |

Distribution of initial capacity |

To evaluate the performance of the DL-based auction, we consider different scenarios by varying the number of miners , the distribution of initial capacity of the miners, and the parameter of approximate quality . Here, we consider the mobile blockchain network with the number of miners of 10, 15, and 20. The simulation results for the revenue versus the number of iterations are provided in Figs. 4, 5, 6, and 7, and those of winning probability of the miners versus their initial capacity are shown in Fig. 8. Note that the baseline scheme is represented by the black and cyan lines.

It can be seen from Figs. 4, 5, and 6 that the DL-based auction converges quickly to the solution which is on a par with the other schemes. Also, for a given number of miners and distribution of initial capacity, the revenue obtained by the DL-based auction is significantly higher than that obtained by the SPA. For example, for and , the revenue obtained by the SPA is 2.8966 while that obtained by the DL-based auction is 3.1460 with . The revenue improvement is clearly achieved in the other scenarios, i.e., Figs. 5 and 6, which confirms the benefit and effectiveness of the proposed scheme.

We next evaluate the impacts of the number of miners on the revenue of the ECSP. From Fig. 7, we find that given the distribution and , the revenue of the ECSP increases with the increase of the number of miners. This is due to the fact that having more miners will intensify the competition, which potentially motivates them to pay higher service prices. As a result, the revenue of the ECSP increases.

Then, we examine the impact of distribution ranges of initial capacity of miners on the revenue of the ECSP. Consider the case of 10 miners, it is observed from Fig. 5 that as is within the small range, i.e., , the expected revenue of the ECSP increases compared with the large range, i.e., . The reason is that the submitted prices, i.e., the bids, of miners are inversely proportional to the initial capacity. Therefore, given the fixed distribution of the sizes of blocks, the submitted prices are higher with the low initial capacity which in turn improves the expected revenue of the ECSP.

Further, we consider the impact of the parameter on the expected revenue of the ECSP. As mentioned in Section IV, is introduced to the softmax function for the winner determination. In general, the large value of results in a more correct decision made by the winner. However, it makes the optimization harder and more complex to solve [12]. This may result in reducing the expected revenue of the ECSP. Indeed, as shown in Fig. 4, for and , the expected revenues of the ECSP obtained from the DL-based auction are 2.7741 and 2.6811 for and , respectively.

At last, it is important to consider the impact of initial capacity of the miners on its winning probability. Without loss of generality, we consider winning probability of miner 1 as its initial capacity is varied from 0.05 to 0.5 and the initial capacity of other miners is , . With 10 miners, i.e., , as shown in Fig. 8, the winning probability of miner 1 decreases as its initial capacity increases. This is due to the fact that the miner 1’s submitted price decreases. As seen, when the number of miners increases, e.g., and , the winning probability of miner 1 further decreases because of more competitive miners.

## Vi Conclusions

In this paper, we have developed an optimal auction based on deep learning for the edge resource allocation in mobile blockchain networks. Specifically, we have constructed a neural network architecture based on an analytical solution. We have designed the data training for the neural networks by using the valuations of the miners. Based on the training data, we have trained the neural networks by adjusting parameters so as to optimize the expected, negated revenue of the ECSP. As illustrated in the simulation results, the proposed scheme can quickly converge to a solution at which the revenue of the ECSP is significantly higher than that obtained by the baseline scheme. For the future work, a general scenario with multiple edge computing resource units should be considered. Also, how to construct the neural network architecture for an optimal auction without using the characterization results of the analytical solution needs to be investigated.

## References

- [1] (2008) Bitcoin: A peer-to-peer electronic cash system. [Online]. Available: https://bitcoin.org/bitcoin.pdf
- [2] J. Kang, R. Yu, X. Huang, S. Maharjan, Y. Zhang, and E. Hossain, “Enabling localized peer-to-peer electricity trading among plug-in hybrid electric vehicles using consortium blockchains,” IEEE Transactions on Industrial Informatics, to apppear.
- [3] Y. Guo and C. Liang, “Blockchain application and outlook in the banking industry,” Financial Innovation, vol. 2, no. 1, p. 24, Dec. 2016.
- [4] Y. Jiao, P. Wang, D. Niyato, and Z. Xiong, “Strategy-proof auction in edge computing resource allocation for mobile blockchain,” submitted.
- [5] Z. Xiong, S. Feng, D. Niyato, P. Wang, and Z. Han, “Optimal pricing-based edge computing resource management in mobile blockchain,” submitted.
- [6] K. Hornik, “Approximation capabilities of multilayer feedforward networks,” Neural networks, vol. 4, no. 2, pp. 251–257, 1991.
- [7] R. B. Myerson, “Optimal auction design,” Mathematics of operations research, vol. 6, no. 1, pp. 58–73, Feb. 1981.
- [8] J. A. Kroll, I. C. Davey, and E. W. Felten, “The economics of bitcoin mining, or bitcoin in the presence of adversaries,” in Proceedings of WEIS, Washington, DC, Jun. 2013.
- [9] N. Houy, “The bitcoin mining game,” Browser Download This Paper, 2014.
- [10] Y. Lewenberg, Y. Bachrach, Y. Sompolinsky, A. Zohar, and J. S. Rosenschein, “Bitcoin mining pools: A cooperative game theoretic analysis,” in International Conference on Autonomous Agents and Multiagent Systems. Istanbul, Turkey: International Foundation for Autonomous Agents and Multiagent Systems, May 2015, pp. 919–927.
- [11] M. Pilkington. (2015) Blockchain technology: principles and applications. [Online]. Available: https://halshs.archives-ouvertes.fr/halshs-01231205
- [12] P. Dütting, Z. Feng, H. Narasimhan, and D. C. Parkes, “Optimal auctions through deep learning,” arXiv preprint arXiv:1706.03459, 2017.
- [13] S. Maghsudi and E. Hossain, “Distributed downlink user association in small cell networks with energy harvesting,” in IEEE ICC, Kuala Lumpur, Malaysia, May 2016, pp. 1–6.
- [14] W. Vickrey, “Counterspeculation, auctions, and competitive sealed tenders,” The Journal of finance, vol. 16, no. 1, pp. 8–37, Mar. 1961.