In this paper, a multiuser MEC system based on blockchain is adopted as shown in Fig. 1. In this scenario,the intelligent terminal i∈I={1,2,3,...I} which has limited power and computation resources will offload their tasks to the edge cloud k∈K={1,2,3,...K} through the BS j∈J={1,2,3,...J} for saving energy or reducing execution time. Therefore, the intelligent terminal i requests subcarrier n∈N={1,2,3,...N} from BS j and requests MEC (communication and storage) resources from edge cloud k. Theoretically, there exist two competing trading processes for resource allocation such as competing for bandwidth resources from BSs and competing for MEC resources from edge clouds. As a consequence, the auction game is adopted to jointly allocate the bandwidth and MEC resources in the systems based on blockchain.
For an intelligent terminal i, an offloading task with the number of CPU cycles Di and the transmission data size Si is sent to the adjacent BSs. Then, the BSs allocate bandwidth to the intelligent terminal i and send the request to the blockchain for MEC resources. In terms of system utility, the transmission efficiency (saving energy and reducing execution time) and auction benefits are investigated in the paper.
3.1 Transmission efficiency
In the paper, the OFDMA is adopted as the multiple access schemes to avoid the same frequency interference. Correspondingly, the instantaneous rate of the intelligent terminal i in a subcarrier with a bandwidth of W Hz can be expressed as follows:
$$ r_{{ijn}}=c_{{ijn}}W\log_{2}\left(1+\frac{p_{{ijn}}H_{{ijn}}}{W\sigma^{2}}\right). $$
(1)
The total transmission rate provided by BS j for intelligent terminal i can be formulated as:
$$ r_{{ij}}\left(c_{{ijn}},p_{{ijn}}\right)=\sum_{n=1}^{N}{r_{{ijn}}}. $$
(2)
Where define an indicator cijn∈{0,1},cijn=1 if subcarrier n of BS j is allocated to intelligent terminal i, otherwise, cijn=0. pijn represents the transmission power of intelligent terminal i to BS j in subcarrier n, the maximum value of intelligent terminal i is Pi due to the hardware limitations. The channel gain in subcarrier n from intelligent terminal i to BS j is Hijn. And, σ2 is the power of additive White Gaussian Noise [18].
3.1.1 Local computation
fi denotes the local computation capability of the intelligent terminal i in terms of instructions per second. Then, the task completion time locally can be obtained as:
$$ t_{i}=\frac{D_{i}}{f_{i}}. $$
(3)
According to [19], the energy consumption of local task execution is given as:
$$ E_{i}=u_{i}D_{i}. $$
(4)
Where \(u_{i}=10^{-11}f_{i}^{2}\) is the consumed energy by the intelligent terminal i in one computing cycle.
3.1.2 Remote computation
The task offloading time delay is composed of two parts (backhaul link delay and downlink communication delay are ignored): the uplink communication delay \(t_{{ij}}^{ul}=\frac {S_{i}}{r_{{ij}}}\) and data processing delay \(t_{{ik}}^{exe}=\frac {D_{i}}{f_{{ik}}}\) [20]. Where fik is the amount of requested computation resources for the intelligent terminal i from the edge cloud k. Then, the remote computation time delay is defined as:
$$ t_{i}^{M}=t_{{ij}}^{ul}+t_{{ik}}^{exe} $$
(5)
For the intelligent terminal i, the remote energy consumption \(E_{i}^{M}\) is mainly about the upload energy consumption for task execution is saved through offloading. Specifically, the energy consumption can be written as:
$$ E_{i}^{M}=\sum_{n=1}^{N}\frac{c_{{ijn}}p_{{ijn}}S_{i}}{r_{{ij}}} $$
(6)
3.1.3 Transmission efficiency
It should be noted that the intelligent terminals offload tasks to edge clouds for saving energy or reducing execution time. Specifically, the utility of energy and execution time by offloading task to the edge clouds can be described as:
$$ u_{i}^{IT}=\alpha\left(t_{i}-t_{i}^{M}\right)+\beta\left(E_{i}-E_{i}^{M}\right). $$
(7)
Where α+β=1,0≤α≤1 and 0≤β≤1 represent normalization coefficients of time delay and energy consumption. Additionally, if the intelligent terminals put the emphasis on the delay cost, α will be increased. In contrast, if energy consumption is more important, increase β correspondingly.
3.2 Auction benefits
As pointed above, there are two auction processes such as bandwidth, MEC resource allocation. In this paper, the second-price sealed auction is selected to allocate the resources.
3.2.1 Budget balance
The traditional auction scheme meets budget balance when the auctioneer does not lose money in the trade. But in this paper, the buyers and sellers trade through the blockchain and there is no auctioneer exist. Therefore, the auctioneer does not lose money in the trade.
3.2.2 Individual rationality
No winning buyer is charged more than its bid and no winning seller is rewarded less than its ask. In other words, a mechanism is individually rational if, for both participating buyer and seller, the proceeds from the bid is no less than non-participation (at least equal). For buyers, due to the selection of second-price sealed auction, the payment price is lower than the bid, and each buyer who participates in the auction always gains more than zero. For the winning seller, the payment price is more than the cost of the resources, such as \(v_{{ik}}^{S}\geq cs_{k}^{S}, v_{{ik}}^{F}\geq cs_{k}^{F}, v_{{ij}}^{BS}\geq cs_{j}^{BS}\). Where \(v_{{ik}}^{S}, v_{{ik}}^{F}\) and \(v_{{ij}}^{BS}\) are the transaction price of storage, computation, and bandwidth respectively, and the cost of the storage, computation, and bandwidth are \(cs_{k}^{S}, cs_{k}^{F}\) and \(cs_{j}^{BS}\).Hence, the utility of the seller is always greater than zero too. On the other hand, if the seller loses the transaction then the utility is zero. It is obvious that the benefits for both buyers and sellers are not less than zero. Therefore, the action is individually rational.
3.2.3 Incentive compatible
A mechanism is incentive-compatible if both buyer and seller report their actual requests without lying. In the second-price sealed auction, the successful bidder will pay a price independent of his bid. Without collusion, the best strategy for each bidder is to give price according to intelligent terminals’ own valuation of the resources. For the bidder, if the bid price is less than the real valuation price, the chance of winning the auction will reduce. On the contrary, if the bid price is higher than the real valuation price, the bidder may get a non-profitable deal although the chance of winning the auction will increase. As a result, the best strategy for each bidder is to make the bid price equal to the real valuation price.
3.2.4 Auction benefits
The auction benefits are composed of bandwidth and MEC resources allocation. In the bandwidth auction game, intelligent terminals i request bandwidth resources from BS j and have a bid price matrix \(B^{BS}=\left \{b_{{ij}}^{BS},i\in I,j\in J\right \}\). Where \(b_{{ij}}^{BS}\) is to indicate the maximum price how much intelligent terminal i is willing to pay for BS j for per unit of time and per unit of bandwidth. Assume that after auction determination, buyer i wins the bandwidth resource from seller j. Due to the regulation of the second-price sealed auction, the transaction price \(v_{{ij}}^{BS}\) is lower than the bid price \(b_{{ij}}^{BS}\). Therefore, the auction benefits of the bandwidth can be calculated as \(u_{i}^{BS}= m_{{ij}}w_{{ij}}t_{{ij}}^{ul}\left (b_{{ij}}^{BS}-v_{{ij}}^{BS}\right)\). Where mij∈{0,1}, and mij=1 if BS j successfully allocates resources to the intelligent terminal i, otherwise, mij=0. wij represents the amount of bandwidth resources requested by the intelligent terminal i.
As such, in the MEC auction game, the intelligent terminals i request MEC resources from the edge cloud k and have bid price matrixes \(B^{F}=\left \{b_{{ik}}^{F},i\in I,k\in K\right \}, B^{S}=\left \{b_{{ik}}^{S},i\in I,k\in K\right \}\), Where \(b_{{ik}}^{F}\) and \(b_{{ik}}^{S}\) are the maximum price how much intelligent terminal i is willing to pay for edge cloud k for per unit of time and per unit of resources. In the same way with bandwidth auction, the benefits for MEC resources can be written as \(u_{i}^{MEC}=m_{{ik}}\left (f_{{ik}}t_{{ik}}^{exe}\left (b_{{ik}}^{F}-v_{{ik}}^{F}\right)+S_{i}t_{{ik}}^{exe}\left (b_{{ik}}^{S}-v_{{ik}}^{S}\right)\right)\).
Where mik∈{0,1}, and mik=1, if edge cloud k allocates resources to the intelligent terminal i, otherwise, mik=0. The bid price and transaction price per unit of time and per unit of resources are \(b_{{ik}}^{F}\) and \(v_{{ik}}^{F}\) respectively. Simultaneously, \(b_{{ik}}^{S}\) and \(v_{{ik}}^{S}\) are the bid price and transaction price per unit of time and per unit of resource. To summarize, the auction benefits can be defined as
$$ u_{i}^{AU}=\gamma u_{i}^{BS}+\delta u_{i}^{MEC}. $$
(8)
Where the normalization coefficient of auction revenue of BSs and MECs are defined as 0≤γ≤1 and 0≤δ≤1. Additionally, γ+δ=1.
3.3 Problem formulation
As evident from the above, the system utility of edge cloud resources sharing problem consists of transmission efficiency and auction benefits. Then, the optimization problem of system utility is formulated as follows:
$$\begin{array}{*{20}l} &\max\limits_{c_{{ijn}},p_{{ijn}},m_{{ij}},v_{{ij}}^{BS},m_{{ik}},v_{{ik}}^{F},v_{{ik}}^{S}}\sum_{i=1}^{I}{\left(u_{i}^{IT}+u_{i}^{AU}\right)}\\ &\begin{array}{llll} s.t\qquad A:&\sum_{i=1}^{I}{w_{{ij}}}&\leq W_{j}^{BS} &\qquad\forall i\in I,\forall j\in J \notag \\ B:&v_{{ij}}^{BS}&\geq cs_{j}^{BS} &\qquad\forall i\in I,\forall j\in J \\ C:&\sum_{i=1}^{I}{c_{{ijn}}}&\leq 1,c_{{ijn}}\in\{0,1\} &\qquad\forall i\in I,\forall j\in J, \forall n\in N \\ D:&\sum_{n=1}^{N}{c_{{ijn}}p_{{ijn}}}&\leq P_{i},p_{{ijn}}\geq 0 &\qquad\forall i\in I,\forall j\in J,\forall n\in N \\ E:&\frac{D_{i}}{f_{{ik}}}+\frac{S_{i}}{r_{{ij}}}&\leq dl_{i} &\qquad\forall i\in I,\forall j\in J,\forall k\in K \\ F:&\sum_{i=1}^{I}{f_{{ik}}}&\leq F_{k}^{M} &\qquad\forall i\in I,\forall k\in K \\ G:&S_{i}&\leq S_{k}^{M} &\qquad\forall i\in I,\forall k\in K \\ H:&v_{{ik}}^{F} &\leq cs_{k}^{F} &\qquad\forall i\in I,\forall k\in K \\ I:&v_{{ik}}^{S} &\leq cs_{k}^{S} &\qquad\forall i\in I,\forall k\in K. \end{array} \end{array} $$
(9)
Where constraint A indicates that the total amount of allocated bandwidth must be not more than the maximum bandwidth \(W_{j}^{BS}\). Constraints B,H and I show that the transaction price \(v_{{ij}}^{BS}, v_{{ik}}^{F}\) and \(v_{{ik}}^{S}\) should be more than the cost of the resources \(cs_{j}^{BS}, cs_{k}^{F}\) and \(cs_{k}^{S}\) in the auction of bandwidth, computation and storage. According to constraint C, one channel is only allowed to be assigned to one intelligent terminal. Constraint D ensures that uplink transmission power must be positive and must not exceed the maximum transmission power Pi. Constraint E indicates that the system delay should be less than the maximum delay dli acceptable by the intelligent terminal i. Constraints F and G guarantee that the total computation and storage resources assigned by the edge cloud must be less than the maximum edge cloud resources \(F_{k}^{M}\) and \(S_{k}^{M}\). Obviously, this optimization problem is a mixed-integer nonlinear assignment problem, which is a NP-hard problem.