Cost-Effective Optimization for Blockchain-Enabled NOMA-Based MEC Networks

Shaanxi Key Laboratory of Information Communication Network and Security, School of Communications and Information Engineering, Xi’an University of Posts and Telecommunications, Xi’an, China Jiangsu Key Laboratory of Wireless Communications, Nanjing University of Posts and Telecommunications, Nanjing, China State Key Laboratory of Integrated Services Networks, School of Telecommunications Engineering, Xidian University, Xi’an, China


Introduction
In recent years, smart user devices, Internet of ings (IoT) devices, and their running smart applications have been widely popularized, and blockchain technology has also been widely used in various industrial applications [1], such as IoT and healthcare. Blockchain technology uses blockchain data structures to verify and store data, uses distributed node consensus algorithms to generate and update data, and uses cryptography to ensure the security of data transmission and access. Its essence is a decentralized database, and the core problem is to solve mining puzzles. Blockchain users or miners need to run a mining puzzle, that is, to solve the proof of work (PoW) problem, which is a computing process that requires intensive computing resources. However, mobile devices have limited resources and are usually unable to participate in the mining process. Mobile edge computing (MEC) [2] provides an effective solution to address the challenge. It offloads the computing tasks of mobile devices to the edge of the wireless network [3], thereby improving computing efficiency and reducing delay. Meanwhile, the explosively increasing IoT user equipments make the scare wireless resources further strained, which degrades the task offloading performances of MEC. In recent years, nonorthogonal multiple access (NOMA) [4,5] has attracted lot of attention in the MEC domain for enhancing the performance of computation offloading. With NOMA, a group of users can offload their own tasks simultaneously using the same channels, and thus each user can enjoy more wireless channels [6] and/or time slots [7], and the system could be able to accommodate more users [8].
On the one hand, many literature studies have proposed various methods to solve the offloading problem in the mobile blockchain networks, such as the method based on convex optimization. In [9], the authors offloaded some computationally intensive tasks to an untrusted MEC server and proposed a hash computing ordering (HCO) mechanism to enable the untrusted MEC server to provide a fairer distribution of computing resources for all mobile users. In [10], the authors proposed a blockchain-enabled IoT-edgecloud computing architecture that benefits both from mobile cloud computing (MCC) and MEC, where MEC servers offer lower latency computing services, while MCC servers provide stronger computation power. In [11], the authors studied the calculation of moving edges for blockchain mining tasks. Based on Stackelberg theory, the pricing and consumption of computing resources are attributed to leader-follower coupling game, and an efficient offloading algorithm for mining tasks is proposed.
On the other hand, several studies have investigated the NOMA-based MEC system, where energy consumption minimization for user equipment is always the first concern. In [12], the authors formulated a joint user clustering and transmit power control problem and proposed a matchingcoalition approach for problem solving. In [13], the authors applied NOMA to enable massive connectivity to support energy-efficient MEC in IoT networks by joint communication and computation resource allocation optimization. In [14], the authors studied task processing delay minimization issues in a multiuser NOMA-based MEC network by optimizing tasks partition ratios and transmit power control. In [15], the authors studied the energy consumption reduction in a NOMA-based MEC system by jointly optimizing the transmit time and power.
From the above works, we find that there is still a lack of research on the optimal strategy for implementing mining task offloading in mobile blockchain. erefore, this paper considers the joint optimization of data offloading and resource allocation to improve the offloading efficiency in the blockchain network. In addition, user clustering and resource allocation [16,17] optimization are important factors in NOMA-based MEC system, and users' energy consumption minimization is the most general goal of the optimization. e above works only considers user clustering, resource allocation, and power control issues, in which all users offload their tasks to the MEC server, without considering the optimization of task offloading decisions. In most IoT scenarios, this is not reasonable, as the local processing power is not used and the capacity of the MEC server is limited; thus, the task processing fails when the user is not received. Moreover, when the number of IoT devices is too huge, then local and MEC server could not afford, and hence, cloud is necessary. Motivated by the above considerations, we consider the joint optimization of offloading decision, user clustering and admission control, and computation resource allocation and transmit power control in a NOMA-based mixed edge and cloud-enabled blockchain network. We intend to minimize the energy consumption in local and MEC processing, minimize the economical pay in cloud processing mode, and maximize mining profits. Most importantly, we ensure all users' tasks are processed successfully, i.e., no user will fail in task processing. e formulated problem includes binary, integer, and continuous variables, so it is hard to solve.
For this purpose, we devote to propose low-complexity algorithm for easy implementation. First of all, we use two heuristic algorithms to solve binary offload decision and user association, respectively, and then obtain the closed-form solutions of local resource allocation. In addition, the closedform solutions of MEC transmission power control and cloud center power control are solved under the premise of satisfying the delay constraint. Simulation results show that the low-complexity algorithm proposed by us can effectively reduce the system cost compared with other simplified methods. e remainder of this paper is organized as follows. In Section 2, the system model is presented and the problem is formulated. Section 3 provides the offloading decision optimization. Admission control and user clustering are presented in Section 4; the local computation resource allocation is developed in Section 5, and Section 6 presents the transmit power control. Section 7 develops the simulation results and discussion. Section 8 concludes the paper.

System Model
We consider a NOMA-based MEC and cloud-enabled blockchain network, consisting of M access points (APs), N randomly distributed users, and a remote cloud center. Each AP is equipped with a MEC server by wired link, as shown in Figure 1. In the following, the MEC server m and AP m are used interchangeably. Denote N � 1, 2, . . . , N { } is the set of users and M � 1, 2, . . . , M { } is the set of APs. We assume that the users who offload their tasks to a MEC server m via NOMA [18,19] form a group because of each user can offload its task to a MEC server. Let G � G 1 , G 2 , . . . , G m denotes the set of groups, and the maximum number of users in each group that can be served by an AP is K. So, all APs could accommodate at most MK users. In particular, we assume that each group is assigned an orthogonal subchannel with bandwidth B. e same group of users offloads their tasks to the AP over the same subchannel. Lastly, we assume that the MEC servers and the APs have complete channel status information (CSI).
Especially, there is a remote cloud center, and users can also offload tasks to the cloud center. e cloud has enough computing resources and wireless bandwidth for users, but when a user chooses to offload the task to it, it charges for the use of bandwidth and computing resources.
Each user acts as a miner, running a blockchain application to record transactions performed in the network [20]. Denote Λ n � D n , λ n , T max n as the task of miner n. Each task is characterized by the input size D n [21], i.e., the number of bits that must be transferred from the user to the AP, and the workload λ n , i.e., the processing density (in CPU cycles per bit). T max n is the deadline to complete the task. en, we have C n � D n * λ n , where C n is the size of processing workload (in CPU cycles). We assume that all APs and miners in the blockchain network supported by NOMA-based MEC have the computing power to provide task execution services. Mining tasks that cannot be calculated locally by the miner can be offloaded to nearby access points. erefore, each miner can execute tasks locally or offload to the MEC server m (AP m) or cloud center for execution. We use x n , y n , and z n to denote the task of miner n is processed by miner n itself, or by MEC server m, or the cloud center, respectively [3,22].

Local Processing.
When the task is processed locally, denote the local processing capability of user n is f max n , we have where f loc n is the local computation resource allocation, which is constrained by f max n , and c n depends on the nature of application, e.g., computational complexity of application. α is a coefficient.

MEC Processing.
In the area, there are M MEC servers providing services for users. us, in the MEC processing model, each user could offload its task to any one of them. Suppose user n offloads its task to MEC server m, the task transmit rate is given by where p mec n is the transmit power of user n when offloading to MEC server and the binary variable v n,m is the access control, where v n,m � 1 indicates user n is served by MEC m and v n,m � 0 otherwise. Based on r n,m , the transmit delay and the energy consumption of user n are given by When the task is processed by the MEC server, the user will wait for the result. e task processing delay and the energy consumption of user n in the process are given by

Security and Communication Networks
where p idle n is the power consumption of user n when waiting and F m is the computation resource allocated by MEC server m, which is a constant in this paper. e delay and energy consumption in MEC processing model are given by Users who have tasks offloaded to the MEC server will get extra profit. e profit for completing the mining task is given by where ζ ($) is mining rewards and η (in $/J) is the unit price of energy consumption.

Cloud Processing.
When user n offloads its task to the cloud center, it will be allocated with exclusive bandwidth B 1 , and processing resource F cloud n . e transmit rate of user n in cloud processing mode is given by e delay in cloud processing mode can be given by e cloud operator will charge users for using communication and computation resources, where the prices are λ ($/bps) and ω ($/(CPU cycles per second)), respectively. erefore, the cost paid by user n in communication and task processing are given by 2.4. Total Delay and Total Cost. Based on the above delays in different modes, the total delay of user n is given by e total cost of user n is defined as Cost n � μ e x n E loc n + y n E mec n + μ pay z n Pay n − y n ϕ n , (11) where μ e (in $/J) and μ pay (a dimensionless number) are the weight parameters.

Problem Formulation.
In this paper, we intend to minimize the total system cost, i.e., the energy consumption for local and MEC processing, economic payments in cloud processing mode, and additional profits from mining tasks for miners. In particular, minimizing economic payments has a higher priority. We achieve the purpose by jointly optimizing the offloading decision Π � x n , y n , z n , the access control and user clustering V � v n,m , the local computation resource allocation f loc � f loc n , and the transmit power control in MEC and cloud processing modes, i.e., p mec � p mec n and p cloud � p cloud n , respectively. e problem is formulated as : x n + y n + z n ≤ 1, ∀n ∈ N, : where (C1) is the task completion deadline; (C2) is the constraint on local computation resource allocation; (C3) and (C4) are the constraints on transmit power control in MEC and cloud processing, respectively; (C5) and (C6) require that each user task can only be processed in one place, i.e., local, or a certain MEC server, or the cloud center; (C7) is the binary constraint on access control, and (C8) requires that the maximum number of users per AP service should not exceed K. Problem (P 1 ) contains binary, integer, and continuous variables, which is generally nonconvex and hard to solve. In the following sections, we will propose lowcomplexity algorithms to solve it.

Offloading Decision Optimization
In this section, we propose a low-complexity algorithm to obtain the offloading decision-making Π � x n , y n , z n , n ∈ N, as shown in Algorithm 1.
Since the tasks processed on cloud will be charged for fees, so we encourage users as much as possible to process their tasks either locally by themselves or offload their tasks to the MEC servers. Moreover, for the noncloud processing tasks, we encourage as many users to offload their tasks to the MEC servers for energy saving. Our main idea can be briefed as the following steps: (i) We divide all the users in N into two subsets, local feasible set N 0 and local infeasible set N 1 . (ii) Next, we judge whether N 1 ≤ MK. If yes, this means the number of local infeasible users is smaller than the capacity that the MEC servers can afford. erefore, let all the users in N 1 offload their tasks to MEC processing and there's no need to offload tasks to the cloud server. Moreover, in order to save energy for users and thus to decrease the system energy consumption while guaranteeing latency requirement, it is necessary to saturate the number of users of the MEC servers as much as possible. e MEC server with the best channel gain, i.e., g n , will reduce the data transmission delay, the user with a larger workload, i.e., C n , means that the task is more complex and less suitable for local processing, users with smaller data transmission, i.e., D n means lower transmission delay. Combining these three factors, we define a new parameter G n � (g n C n /D n ). e larger G n , the less suitable the task of user n is to be processed locally. erefore, according to the size of G n , move MK − N 1 users from local feasible set N 0 out to MEC processing. (iii) If N 1 > MK, this means some tasks have to be offloaded for cloud processing, and users have to pay some fees for task processing. We should pick out MK users to MEC processing, and the rest N 1 − MK tasks will be offloaded to the cloud.
Performing the above steps, the offloading decision can be obtained. e proposed offloading decision-making algorithm is summarized in Algorithm 1.

Admission Control and User Clustering
After offloading decision-making, MK users are picked out, and their tasks will be processed by the M MEC servers. Next, we will allocate the MK users to the M MEC servers.
Since we intend to minimize the energy consumption of MEC processing, a new parameter Γ n,m � g n,m F m is defined. e MEC server M with the best channel gain, i.e., g n,m , will reduce the data transmission delay, and the server with the most computation resource, i.e., F m , will reduce the task processing delay. us, the larger the Γ n,m , the user n is more would like to access MEC server m, the smaller the delay in processing its tasks, and the smaller the power consumption. Based on the above idea, our admission control and user clustering algorithm are detailed in Algorithm 2.
After Algorithms 1 and 2 are performed, the offloading decision, admission control and user clustering are obtained, i.e., the user set is divided into several subsets, including (i) the local processing set N loc , where the offloading decision of tasks n is x n � 1; (ii) M MEC processing subsets, and in each subset G m , the offloading decision y n � 1, and the admission control v n,m � 1, and all users in each subset G m will offload their tasks to MEC server m sharing the same bandwidth via NOMA; (iii) the cloud processing set N cloud , where each user in this set will offload their tasks for cloud processing.
For the users in N loc , we need to perform local computation resource allocation optimization f loc � f loc n ; for the users in each G m and in N cloud , we need to perform transmit power control optimization, i.e., we need to determine p mec � p mec n and p cloud � p cloud n , respectively.

Local Computation Resource Allocation
For the users in N loc , we need to perform local computation resource allocation for local task processing energy consumption minimization, and we have For user n, given the data input size D n , a coefficient α and computational complexity of application c n , the energy consumption is only affected by the local computing resource allocation. In order to minimize the energy consumption while ensuring the delay requirements, let T loc n � T max n , so that we only need the minimum computing resources that meet the latency requirements, and get f loc n .

Transmit Power Control
After offloading decision-making, access control and user clustering, and local computation resource allocation are obtained, problem (P 1 ) degrades into the transmit power control optimization in MEC processing and cloud processing, respectively. For the users who choose MEC processing, we need to perform transmit power control among the users in a same cluster as follows: Security and Communication Networks 5 (11) for n ∈ N 0 do (12) g n � m∈M g n,m /M (13) G n � g n C n /D n (14) end for (15) Sort the N 0 users in ascending order according to G n (16) Remove the end N gap users from N 0 to N MEC , and we set y n � 1, n ∈ N mec (17) Remove the rest users in N 0 to N loc , and we set x n � 1, n ∈ N loc (18) else (19) Among the users in N 1 , perform Algorithm 2 for access control, where MK users are selected for MEC processing, and put the MK users into N MEC , and set y n � 1, n ∈ N mec (20) Remove the N 1 − MK users to N cloud , and set z n � 1, n ∈ N cloud (21) end if (22) Output: Π � x n , y n , z n , n ∈ N.
ALGORITHM 2: Admission control and user clustering. 6 Security and Communication Networks For cloud processing users, we have In order to enable tractable solutions, we use the following simple method to obtain a closed-form solution.
For cloud processing users, it can be known that each user is allocated with the same bandwidth, so the fees is only affected by r cloud n . However, under the given channel gain, the uplink transmit rate r cloud n is only affected by the transmit power p cloud n .
e larger the p cloud n , the higher the r cloud n . erefore, in order to minimize the total fees while guaranteeing the delay requirement, we take the transmit power that could satisfy T cloud n � T max n . For MEC processing users in each cluster, we take the following strategy: (i) For the end user, i.e., user K, we take the transmit power p mec K that could satisfy T mec K � T max K . (ii) After p mec K is determined, the transmit rate of user K − 1, i.e., r K−1,m in (3) is only affected by its transmit power p mec K−1 , so we can also take the transmit power that could satisfy T mec K−1 � T max K−1 . (iii) When p mec K and p mec K−1 are determined, p mec K−2 can be obtained using the same method, and then p mec K−3 . . .p mec 1 can be determined one after another following the same way.

Simulation Results
In this section, we evaluate the system performance of NOMA-based MEC-enabled blockchain network. e simulation parameters are listed in Table 1.
We compare our proposed algorithm with the following algorithm. (i) Random computing offloading algorithm: users randomly offloaded their tasks to the local or MEC serves or cloud center. In addition, it will use our proposed algorithm for local computing resource allocation, cloud center power control, and MEC power control. (ii) Random power algorithm: the power is generated randomly, and other resource allocation schemes use our proposed algorithm. Figure 2 shows how the number of users' access affects the total cost of the system. As the number of access users in each APs increase, the energy consumption of AP processing tasks also increase, and so does the total cost of the system. e trends of the three curves in Figure 2 are consistent with our analysis. But our algorithm has the lowest cost. Since our algorithm has power optimization processing in both MEC and cloud center, the energy consumption of our algorithm is lower than that of the random power algorithm. Similarly, our algorithm also optimizes random offloading and users access, so with the increase of access point users, the cost of random offloading algorithm is higher than our algorithm.
In Figure 3, we plot the effect of the weight parameter μ e on the system cost. As the weight parameter μ e regulates the local energy consumption and MEC energy consumption, the local and MEC costs are on the same order of magnitude as the cloud center costs. When the weight parameter μ e is 0, only the cost of users in the cloud center is included in the total cost. In the three curves of Figure 3, since the offloading decision and user access in the random offloading algorithm are random, the cost of users in the cloud center is the highest, that is, the total cost is also the highest. With the increase of weight parameter μ e , the proposed algorithm has the lowest cost compared with other baseline algorithms through joint optimization of various factors. Figure 4 plots how local processing capacity f max n affects the total cost of the system. With the increase of local processing capacity f max n , the number of users processing tasks locally increases, the local processing energy consumption increases, and the total system cost also increases. As can be seen from the figure, all three curves increases as local processing capacity increases. Since the local users of the random offloading algorithm are randomly generated, while our algorithm is the local users generated by the optimization algorithm, the total cost of the random offloading is higher than our proposed algorithm due to the two different offloading methods. In addition, another factor that determines cost is transmit power. Since the transmit power allocation of our algorithm is optimized, while the power allocation of the random power algorithm is random, the cost of our algorithm is lower than the random power algorithm.
In Figure 5, we show how the unit price of MEC energy consumption η affects the system cost. It can be seen that, as the unit price of MEC energy consumption η increases, the cost of all algorithms increases.
is is in line with our intuition. As the unit price increases, the additional net income from mining will decrease. According to formula (11), the total cost of the system will increase. In addition, since our proposed algorithm is optimized in all aspects, our total cost is the least compared to other algorithms.

Conclusions
In this paper, we have considered the joint optimization of offloading decision, local computation resource allocation, user clustering and admission control, and transmit power control, subjecting to the task execution deadline in a NOMA-based MEC-enabled blockchain network for minimizing the system cost. To solve the problem effectively, we propose heuristic algorithms with low complexity. In our problem solution process, the offloading decision is solved  Local processing capability f n max (CPU cycles/s)  based on heuristic Algorithm 1, and the user clustering and admission control are solved through Algorithm 2, and then closed-form solutions of local resource allocation and transmit power control are obtained under the required delay constraints. Simulation results show that the proposed algorithms have a good effect on cost reduction.

Data Availability
No data were used to support this study.

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