Computational Resource Allocation Strategy in a Public Blockchain Supported by Edge Computing

,


Introduction
Since blockchain was first proposed in 2008, it has gradually expanded from cryptographic digital currencies to innovative applications in all walks of life [1]. Blockchain implements a decentralized system that can reach a consensus of trust in the digital space. By reaching a consensus among peers in the peer-to-peer (P2P) network, nodes jointly maintain a data chain that connects data blocks in a chain way in a chronological order [2]. Each block on the data chain is protected from tampering and forgery by digital signature and other data verification methods [3].
Proof of work (PoW) is an important consensus mechanism in the public blockchain, which is used to prove that a task is completed and the calculation is paid for [4]. The task is to compute a cryptographic security-related nonce value that leads the hash of the nonce and block data to be less than a given upper limit (depending on the mining difficulty). This calculation process is called mining [5], and the nodes that complete tasks to reach consensus are called miners. Miners broadcast transactions on the network after calculating the nonce value. Other nodes immediately verify the consensus after receiving the block containing transactions. After verification, the block will be added to their local node in the chain of block maintenance [4]. Only data which is packaged by the node that calculates the nonce value fastest can be added to the blockchain. In return, the miners can receive a reward as an incentive of mining. The reward consists of a fixed bonus and a variable transaction fee [6].
Unfortunately, solving the PoW puzzle in public blockchain requires sustained high computing power that mobile devices cannot afford [7]. In order to alleviate the problem of insufficient computing power, consensus nodes can offload their mining tasks to edge computing services, supporting applications based on the public blockchain [8]. Edge computing closer to data source is a comprehensive platform that provides network, computing, and storage. It enables data storage and computing power to be deployed closer to the edge of the user, thereby reducing network latency. Edge computing services can support more consensus nodes to mine tasks, which will significantly improve the robustness and security of the public blockchain network, further attracting more developers to join to promote the construction of public blockchain.
Further, edge computing matches the distributed model of blockchain on networking, computing, and storage. On the one hand, when blockchain nodes are deployed in edge node devices, edge computing services provide computing resources and storage capacity to a large number of scattered nodes in the blockchain. To copy with the problem of delay transmission in the case of coexistence of a large number of nodes, edge computing with low latency is a good response to the application demands of blockchain on the edge side. On the other hand, blockchain provides a trusted and secure environment for edge services, which ensure the integrity and authenticity of storage, achieving the collaborative management of resources among multiple subjects.
In this paper, we divide the nodes into full nodes and light nodes in a public blockchain network. Full nodal participation in the consensus process, i.e., miners, light nodes do not participate in the consensus process, in spite of can be rewarded by performing a portion of the computing tasks for full nodes for collaborative mining [9]. We also call light nodes "sharer." We consider the trading between the edge compute provider (ECP) and the full node as well as the trading between the full node and the light node. From a system perspective, our goal is to maximize the social welfare of the public blockchain networks. Social welfare can be understood as system efficiency in [10]. In order to achieve the goal, we propose an edge computing resource market model based on auction for a public blockchain network. In addition, we designed an individual and truthful computing resource allocation mechanism.
The specific contributions of this paper are summarized as follows: (i) In the proposed edge computing resource market model, we consider the competitive relationship between miners in the public blockchain and maximize social welfare under appropriate network effect parameters (ii) Two offloading modes are proposed in a public blockchain network based on edge computing. Miners can offload their mining tasks to ECP or idle nodes, which takes advantage of idle resources in a network and reduces load on an edge server (iii) Two auction algorithms were used to improve network efficiency. The trade between ECP and miners was conducted through the Vickrey-Clarke-Groves (VCG) auction. The trade between miners and sharers was realized through Continuous Double Auction (CDA). Algorithms are designed to meet resource constraints, individual rationality, and authenticity

Related Work
There have been many excellent works studying resource allocation problems among the edge providers and miners in a blockchain network. In [11], authors study the interactions among the cloud/edge providers and miners in blockchain using a multileader multifollower game-theoretic approach, in order to support proof-of-work-based blockchain application. In [12], the authors formulate resource allocation between ECPs and computationally constrained devices as a double auction game. Meanwhile, the experience-weighted attraction (EWA) algorithm is introduced to reach Nash equilibrium. The authors in [13] proposed a novel edge computing offloading framework, which applies decentralized resource management strategy based on auction to perform resource allocation to ECPs. In order to intelligently manage decentralized applications in a blockchain network, Edgence (EDGe + intelligENCE) is proposed by [14] to realize self-governing of the edge devices. In [15], dynamic resource allocation by combinatorial auction is mainly concentrated and the CA-PROVISION algorithm is used for providing pricing strategies. In [16], authors present a two-layer computation offloading paradigm that includes an edge computing provider (ECP) and a cloud computing provider (CCP) to jointly maximize the profits of each service provider and the payoffs of individual miners. In [17], a new model-free deep reinforcement learning-based online computation offloading approach was proposed for blockchainempowered mobile edge computing in which both mining tasks and data processing tasks are considered. In [18], the authors introduced a broker to manage and adjust the trading market. Then, an iterative double-sided auction scheme was proposed for computing resource trading, where the broker solves an allocation problem to achieve the maximum social welfare meanwhile protecting the privacies of the buyers and the sellers. However, the above papers do not make good use of idle computing resources in the network.
In this article, we consider the existence of competition among miners in the computing resource market model and propose two offloading models. Our model supports miners to offload tasks to idle nodes, which improves the utilization of computing resources in the network and reduces the load on edge servers. Further, on the basis of the abovementioned papers, this paper realizes the optimal resource allocation of the public blockchain network through auction competition between miners and ECP.

Edge Computing Resources Trade Market Model.
As shown in Figure 1, we propose a resources trade market model. There are two types of nodes: full nodes N = f1, 2, ⋯ , ng and light nodes M = f1, 2, ⋯, mg in the public blockchain network with PoW as the consensus strategy. We consider an offload model where the full node could choose to offload the mining calculation task to ECP or to a light node for collaborative mining. In the proposed market model, auction strategy is used to guide trading. The miners submit their resource demands d = fd 1 , ⋯, d i , ⋯, d n g and corresponding bids b = fb 1 , b 2 , ⋯, b n g. After receiving miner's demands and bids, ECP uses different strategies to determine win miners X = f x 1 , x 2 , ⋯, x n g, x i ∈ f0, 1g, and service prices P = fp 1 , p 2 , ⋯, p n g according to different ways of offloading. In the case of task offloaded to edge sever, ECP uses the VCG auction strategy; in the case of task offloaded to light nodes, ECP uses the CDA strategy. This will be covered in detail in Section 3. To

Mining Mechanism Supported by Edge
Computing. The efficiency of blockchain is largely determined by network computing power, so how to ensure the availability of computing resources and the participation of devices will be the driving factors. Chang et al. [19] have discussed the incentive mechanism for edge computing-based blockchain in detail, so the focus of this chapter is on the mining mechanism. In order to balance market prices, optimize resource allocation, and minimize marginal loss, auction theory is applied to the computational resource allocation of the edge blockchain.
In the article, we assume that both the miner and ESP are rational and will bid the computational resources according to their actual needs. Device i's hash capability γ i is represented as where ∑ i∈N γ i = 1, d α i is the computational resource unit required by device i, and α is an exponential parameter of hash power function [20].
In mining competition, miners need to be the first to find the correct nonce to solve the PoW problem and broadcast the block to reach consensus. The process of generating the new block can be described as a Poisson process with intensity 1/λ [21]. Firstly, miners collect unconfirmed transactions represent by S = fs 1 , s 2 , ⋯, s n g into their blocks. Secondly, miner i broadcast its block to a blockchain network to reach consensus. The broadcast delay is affected by the size of transactions s i . Miner i's expected reward R i consists of a fixed bonus T and a variable transaction fee affected by s i . R i can be expressed as equation (2), where P i ðγ i , s i Þ is the probability that miner i reaches consensus and gets rewards.
Through the above mining competition, miners will only be rewarded if they succeed in creating blocks and reaching consensus. However, in the block broadcast process, the block that encapsulates more transactions has a higher latency. So, it may not reach a consensus first because of the high broadcast latency. It has a higher latency that the block encapsulates more transactions. This type of block is called an orphaned block. The miner i's block broadcast latency τ i is linear to the size of the encapsulated transactions, i.e., τ i = ξs i , (ξ is a constant) [22]. As mentioned earlier, the generation process of a block is a Poisson process with intensity 1/λ, so miner i's orphaning probability can be described as P o i = 1 − e −ð1/λÞτ i . Furthermore, the probability that miners will be rewarded P i can be calculated as follows:

Resource Allocation Based on Auction
In this part, we mainly introduce the auction strategy that the system executes when the computing task is offloaded to ECP or light nodes. Regarding how to decide which task is offloaded to ECP and which task is offloaded to light nodes, we have discussed in more detail in the previous study [23].
To rephrase briefly, Lyapunov theory and proposed deviation update decision algorithm (DUDA) are used to solve computation offloading decision-making and offloading update order-making.

Task Are Offloaded to ECP.
When the miners' tasks were offloaded to ECP, the VCG auction strategy was executed to determine winners and trade prices. Assume that c E is the unit cost of computing services provided by ECP. Moreover, in this offloading scenario, the social welfare of a network is the sum of all the miners' rewards minus all the ECP's costs. Therefore, maximizing social welfare can be described as the following optimization problem: where ∑ i∈N d i x i ≤ C is the constraint that needs to be met, and C is the most computing resource unit that ECP can afford.
VCG auction is a method of distribution of goods with the optimization goal of maximizing social welfare. It uses the marginal damage caused by bidders to others as the bidding pricing rule. Therefore, VCG ensures that the best strategy for each bidder is to bid according to actual needs and value. Then, the auction system considers all possible bid combinations and reserves the bid combination that maximizes the total amount of bids. It should be noted that the price they pay P = fp 1 , p 2 , ⋯, p n g is not the price they originally bid, but the marginal damage p i = ∑ j∈W′ t S t − ∑ j∈W t \i S ′ t they cause to other bidders (at most as high as the original bid).
At the end of the auction, if the agent is completely rational and there is no collusion, we can assume that the willingness to pay has been truthfully reported, because each participant will only be accused of marginal damage to other bidders.
We solved this integer programming problem through a VCG auction using the following algorithm: first, determine the list of winning miners and then determine the final trade price based on marginal damage [24].

Task
Are Offloaded to Light Nodes. In our scenario, there are some light nodes (sharers) M = f1, 2, ⋯, mg in the blockchain network that have computing resources cr = f cr 1 , cr 2 , ⋯, cr m g but do not participate in mining; they only help the full nodes (miners) N = f1, 2, ⋯, ng perform computing tasks. When the miners' tasks were offloaded to light nodes, the Continuous Double Auction (CDA) strategy was executed to determine winners and trade price [25].
In the CDA strategy, the miner's (buyer) resource demand is d = fd 1 , ⋯, d i , ⋯, d n g, and corresponding bids are b = fb 1 , b 2 , ⋯, b n g, assuming the trade price for the buyer is P = fp 1 , p 2 , ⋯, p n g. The sharers (sellers) will also bid for the computing resource asa = fa 1 , a 2 , ⋯, a m g. Let us define the seller's trade price as Q = fq 1 , q 2 , ⋯, q m g. ECP acts as an auctioneer, and his income φ is that the seller's trade price subtracted from the buyer's.
Then, we discuss the validity of the CDA algorithm. Similar to Zhang et al. [26], we try to prove the validity from the following: (1) Individual rationality: both sellers and buyers need to make a profit Input: d = fd 1 , ⋯, d i , ⋯, d n g; b = fb 1 , b 2 , ⋯, b n g Output: P = fp 1 , p 2 , ⋯, p n g;X = fx 1 , x 2 , ⋯, x n g 1. For each i ∈ N 2.
For each j ∈ W; 11.
End for Algorithm 1: VCG auction algorithm.
Input: fa 1 , ⋯a j , ⋯a m g;fb 1 , ⋯b i , ⋯b n g;fd 1 , ⋯d i , ⋯d n g ;fcr 1 , ⋯cr j , ⋯cr m g Output: matching relationship i ⟷ j; trading price p i 1. Sort bids of buyers a j with decreasing value.

Wireless Communications and Mobile Computing
(2) Resource constraints: if both seller j and buyer i agree to trade, equations (7) and (8) need to be met (3) Truthful: the seller j's profit is defined as χ M j , and the buyer i's profit is defined as χ N i . In the CDA process, the highest profits occur when participants compete based on the true price of the resource. In other words, the constraints of equations (11) and (12) have to be satisfied: In the process of CDA in this paper, we set φ = 0 and used equation (13) to determine the trade price, with δ = 0:5.

Experiment Results and Analysis
In this chapter, the auction strategy we proposed is simulated to verify the effectiveness and rationality. Simulation result proves that the strategy proposed has better system profits. According to Figure 2, the value of reward factor also affects the system's profits. It can be clearly seen that, with increasing of the reward factor in the number of different devices, the system's profits have increased significantly. This is because the grown of reward factor incentivizes devices to   The profits of different network roles are shown in Figure 3. Under the same circumstances, device-sharing computing resources have lower profits. Devices acting as a miner can get higher profits. Meanwhile, edge server provider can also get higher profits. It should be noted that as the number of devices increases, the profits to all roles in the system increased.
In Figure 4, we analyze the gap between demands and supplies in different cases. It is obvious that as the number of iterations increases, the gap gradually approaches zero. This shows that the strategy we proposed can meet the demand dynamically.
We compared the proposed strategy with mode A (offloading all tasks to ECP) and mode B (offloading all tasks to adjacent idle devices) in Figure 5. In (a), the convergence performance of the three models is compared. The system profit increases sharply in the first 20 iterations and then reaches a stable state, indicating that our mechanism has a faster convergence than the other two modes. This is because our model can offload mining tasks to idle devices, improving the utilization of computing resources. Moreover, because there are offloading decisions to be made, the plateau is reached relatively late. In (b), we compare the system profit of the three modes. With the increase of time, the system profit of all three modes will increase, but our strategy has higher returns. Offloading all mining tasks to idle devices causes longer delays, so mode B (offloading all tasks to adjacent idle devices) has the lowest return. In (c), we compare the average delay of the three modes. Since the miners who choose mode   Wireless Communications and Mobile Computing B are closer to the provider, the average delay is lower. Taken as a whole, our strategy performs better.

Conclusions
In this paper, we offload computing tasks to ECP or light nodes to alleviate the PoW problem in a public blockchain network. When miners offload tasks to the ECP, the VCG auction strategy is adopted to maximize the social welfare of resource allocation; when tasks are offloaded to light nodes, the CDA strategy is adopted to realize efficient allocation of computing resources. The authenticity, individual rationality, and effectiveness of the strategy are also proved in this paper. The simulation results prove that the proposed strategy can improve the profits of the system, as well as providing reference significance for the administrators of the public blockchain network.

Data Availability
Data are available upon request.

Conflicts of Interest
The authors declare that there is no conflict of interest regarding the publication of this paper.