Resource sharing of mobile edge computing networks based on auction game and blockchain

The edge clouds in mobile edge computing networks are isolate which may belong to different companies or organizations, and hence the communication, computation, and storage resources are not efficiently utilized. To solve this problem, we propose the resource-sharing model of edge clouds which is based on blockchain technology and auction game. In this model, the blockchain platform is regarded as the bridge of the resource sharing, composed of edge clouds, clouds, third-party spectrum and computation management, identity authentication institutions, etc. It is used to record the users’ transaction information and broadcast the intelligent terminals’ resource requirements to all edge clouds in the blockchain platform through smart contracts. Then, an optimization problem of the joint allocation of communication and computation resources is formulated to maximize the utility of intelligent terminals. And an efficient improved sealed second-price auction game is proposed to allocate communication and computation resources and determine the optimal price of resources under the intelligent terminals’ QoS constraints. Simulation results show that the model can effectively improve the system resources utilization and the successful transaction rate.


Introduction
Recently with the rapid development of the Internet of Things (IoT), various types of new intelligent terminals continuously emerge and generate huge amounts of data.For example, ubiquitous surveillance cameras generate a huge amount of data every day.Usually, these continuously emerging data with personal privacy will not only increase the risk of privacy leakage but also cause more data to be transferred to the cloud, which occupies more bandwidth and brings higher latency, energy consumption, etc. Besides, some new high real-time applications and privacy protection requirements such as automatic driving and industrial automation require local data processing.Therefore, mobile edge computing (MEC) system that can not only reduce the delay and network burden, but also protect the privacy of users comes into being [1].
Many researchers have been engaged in the research of MEC resources allocation.In [2], a joint multi-user resources allocation of spectrum and computation was proposed, which conclude a resource allocation method for a given unloading strategy and an optimization unloading strategy based on orthogonal frequency division multiplexing Access (OFDMA).[3] proposed an incentive-compatible auction mechanism (ICAM) for the resources transactions between the mobile devices as service users(buyers) and edge clouds as service providers (sellers).However, this model can only allow one to one matching between intelligent terminals and edge clouds.In [4], an improved double auction scheme was investigated based on the break-even and one edge cloud can allocate resources to many intelligent terminals in one auction under the constraints of the edge clouds computation resources.
However, the service capability of a single edge cloud is very limited and each edge cloud belongs to different operators, enterprises, or third parties.Meanwhile, it provides services to different industries and applications.In order to establish a data sharing mechanism of such heterogeneous distributed edge clouds system, three basic issues must be solved.The first is to establish a resource sharing bridge between the autonomous domains.The second is to effectively aggregate and manage the heterogeneous network resources.The last is to ensure the resources sharing execution safe and reliable.Therefore, it is difficult to achieve effective resource sharing in the distributed heterogeneous systems by traditional centralized security management technology.
Blockchain is widely regarded as a promising technology to be used for trusted exchanges in the digital world [5].The immutable ledger, decentralized architecture and identity authentication system of blockchain together ensure the data authenticity and provide a technical support for the resources sharing among the heterogeneous distributed edge clouds.Furthermore, the natural trading attributes of blockchain can provide an incentive mechanism to charge intelligent terminals and rewards edge clouds.
According to the natural transaction attributes and decentralized trusted transaction mechanism of blockchain, [6][7][8][9] have researched the data sharing problem of distributed systems in different fields.[6] used the block-chain-based competitive first-come-firstservice queue to implement spectrum sharing in mobile cognitive wireless networks.Specoins, which is a kind of virtual currency is introduced as a reward while user accessing the spectrum.[7] proposed a system to solve the problem of medical data sharing among medical big data custodians in a non-trusted environment.Kim et al. [8] focused on energy trading using blockchain (mainly household electricity).The households could exchange electric energy using special energy COINS on consortium blockchain platform and buy or sell energy COINS in public blockchain platform.A mechanism was studied to solve the charging and discharging problem of electric vehicles based on blockchain technology in [9], where charging vehicles pay discharging vehicles by energy coins.It also performed energy bidding and trading through an iterative dual auction mechanism.
Recently, more and more researchers pay attention to the investigations of MEC based on blockchain.Christidis K explored the feasibility of the combination of blockchain technology and the IoT to create a service market between devices, so as to promote the sharing of services and resources [10].A blockchain based MEC management was presented in [11] to guarantee service continuity in a secure, timely and efficiently manner.The computation resources allocation problem for mobile devices during the mining process underlying MEC environment based on blockchain was investigated in [12][13][14].
A D2D-assisted MEC computation offloading based on the blockchain was proposed [15].And in [16], a blockchain-based MEC platform was proposed to ensure edge nodes to work in a trustworthy environment.[17] develop a secure and intelligent task offloading framework to reduce task offloading delay, queuing delay, and handover cost with incomplete information while simultaneously ensuring privacy, fairness, and security remains an open issue.It should be noted, there are few researches on the joint resources allocation of communication and computing based on blockchain in the MEC resources sharing system.
To fill this gap, a joint resources allocation of communication and computing in secure MEC resources sharing system is studied based on blockchain and auction game, in this paper.The main contributions of this paper are mainly given as follows: • A bridge of the resources sharing is established using blockchain which is composed of edge clouds, clouds, third-party spectrum and computation management, identity authentication institutions, etc.In the blockchain platform, the intelligent terminals can apply for resources from each cloud and edge cloud using smart contract.
• In order to improve the resources utilization, an efficient and improved auction game is proposed with dynamic pricing and dynamic computation resources under the constraints of intelligent terminals.In the auction game, the intelligent terminals are divided into different priority according to the location of the access network to the edge clouds and the resources will be allocated to terminals with higher priority first.

Methods
As depicted in Fig. 1, the system has three layers, such as clouds, edge clouds and terminal access.Clouds are the core and the central resources provider in the network, which is composed of a group of large servers.Edge clouds mainly include MEC Server, resources proxy server (RPS), etc. MEC server is a small cloud computation resources pool deployed by telecom operators at the edge of the network near or inside the base station (BS) to supplement the central server.Therefore, the tasks of intelligent terminals can be carried out in local sever.RPS is a new equipment addition to the system, which can be placed near or inside the MEC server.Assume that one MEC server corresponds to one RPS.The terminal access layer is composed of BSs and intelligent terminals, such as smart home equipment, smart cars, smart phones, sensors, etc.
The bridge of resource sharing among the edge clouds is built by blockchain, which includes RPS, third-party spectrum and computation management, identity authentication institutions, etc.The most important part of the blockchain platform is RPS, which is the key device to share resources among the heterogeneous distributed edge clouds.It has two main functions.Primarily, it stores the external resources information of edge clouds and BSs.Then, the terminals can request resources from the RPS to achieve resources sharing.Secondly, it runs the smart contract, which provides an interface for applications to access the blockchain and writes global ledger.In the system, intelligent terminals can broadcast resources application message through RPS in blockchain platform using smart contract.Edge clouds or clouds in the blockchain network will receive the smart contract of resources application.Then, the edge clouds or clouds provide services to the intelligent terminals according to their requirements.Thus, the resources sharing among heterogeneous distributed edge clouds is completed.Then, in order to improve the resources utilization rate, an efficient and improved auction game is proposed based on auction by maximizing user's benefit under the intelligent terminals' Quality of Service (QoS) constraints.After that, the implementation of data sharing among edge clouds using blockchain is narrated.

Problem formulation based on auction
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 D i and the transmission data size S i 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.

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: The total transmission rate provided by BS j for intelligent terminal i can be formulated as: Where define an indicator c ijn ∈ {0, 1}, c ijn = 1 if subcarrier n of BS j is allocated to intelligent terminal i, otherwise, c ijn = 0. p ijn represents the transmission power of intelligent terminal i to BS j in subcarrier n, the maximum value of intelligent terminal i is P i due to the hardware limitations.The channel gain in subcarrier n from intelligent terminal i to BS j is H ijn .And, σ 2 is the power of additive White Gaussian Noise [18].

Local computation
f i 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: According to [19], the energy consumption of local task execution is given as: Where u i = 10 −11 f 2 i is the consumed energy by the intelligent terminal i in one computing cycle.

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 ul ij = S i r ij and data processing delay t exe ik = D i f ik [20].Where f ik 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: For the intelligent terminal i, the remote energy consumption E M i is mainly about the upload energy consumption for task execution is saved through offloading.Specifically, the energy consumption can be written as:

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: 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.

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.

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.

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 Where v S ik , v F ik and v BS ij are the transaction price of storage, computation, and bandwidth respectively, and the cost of the storage, computation, and bandwidth are cs S k , cs F k and cs BS j .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.

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.

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 Where b BS ij 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 BS ij is lower than the bid price b BS ij .Therefore, the auction benefits of the bandwidth can be calculated as Where m ij ∈ {0, 1}, and m ij = 1 if BS j successfully allocates resources to the intelligent terminal i , otherwise, m ij = 0. w ij 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 ik and b S ik 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 Where m ik ∈ {0, 1}, and m ik = 1, if edge cloud k allocates resources to the intelligent terminal i, otherwise, m ik = 0.The bid price and transaction price per unit of time and per unit of resources are b F ik and v F ik respectively.Simultaneously, b S ik and v S ik 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 Where the normalization coefficient of auction revenue of BSs and MECs are defined as 0 ≤ γ ≤ 1 and 0 ≤ δ ≤ 1.Additionally, γ + δ = 1.

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: Where constraint A indicates that the total amount of allocated bandwidth must be not more than the maximum bandwidth W BS j .Constraints B,H and I show that the transaction price v BS ij , v F ik and v S ik should be more than the cost of the resources cs BS j , cs F k and cs S k 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 P i .Constraint E indicates that the system delay should be less than the maximum delay dl i 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 M k and S M k .Obviously, this optimization problem is a mixed-integer nonlinear assignment problem, which is a NP-hard problem.

Joint resource allocation of communication and computing based on auction
Obviously, in order to maximize the utility of resource allocation, we only need to make the bandwidth auction benefits maximum, the transmission benefits maximum and the MEC auction benefits maximum.Therefore,the optimization problem is divided into three dependent sub-problems.P BS : The first problem is auction-based resources allocation of bandwidth, which can determine the allocation strategy of bandwidth and the transaction price of bandwidth.The benefit function can be described as U BS = I i=1 u BS i .P IT : Based on the result of the allocation strategy of bandwidth, the joint allocation of subcarrier and power is decided by U IT = I i=1 u IT i , in which the request computation f * ik , sub-carrier, and power strategy will be confirmed.P MEC : The problem of auction-based resources allocation of MEC, which can determine the allocation strategy and the transaction price of MEC resources, can be described as , due to the result of the request computation f * ik concluded in problem U IT .

Bandwidth allocation
Intelligent terminals apply for bandwidth from all accessible BSs, and the BSs allocate bandwidth according to the received applications.The optimization problem can be expressed as: From an implementation point of view, the ultimate goal of a business is to get the maximum benefit.Therefore, choosing the user with the highest price is the most satisfying choice for merchants.From the auction point of view, the buyers will give the maximum price that they are willing to pay for the resources to win the auction.As a consequence, a greedy algorithm is appropriate to be adopted in the auction, which allocates the highest price user first, then the second-highest price user, and so on.
As shown in Algorithm 1, for all intelligent terminals i ∈ I, the winning user set is I ac ⊆ I, B BS i is the set of bidding prices of bandwidth, the winning transaction price set of bandwidth is P ac i , W i is the set of the number of bandwidth resources requested, W ac i is the allocated bandwidth.δ : {i : i ∈ I ac } → i : p ac i ∈ P ac i is the mapping between I ac and P ac i .For all BS j, W BS j is the maximum bandwidth, and the cost of unit bandwidth is cs BS j .First, sort all the bidding prices of the bandwidth B BS i in descending order.If the second highest bidding price is greater than the cost price of the BS request, and the rest of the resources are enough, then, the terminal who give the highest bidder obtain the resources, and the bidding price is the second highest price.On the contrary, there is nobody to obtain the resources and the next round of bidding will carry out until the resources is zero or all the terminals obtain the request resources.

Subcarrier and power allocation
The optimization problem of the joint allocation of subcarrier and power can be mathematically formulated as P IT : max f ik ,c ijn ,p ijn U IT (11)

s.t C, D, E.
It is obvious that for a given c ijn and p ijn , P IT is a concave function of f ik , correspond to the constraints E the optimal solution of f ik can be obtained as After the calculation of resources allocation, the problem of P IT can be transformed into: Where is a convex function of c ijn and r ij c ijn , p ijn is a concave function of c ijn .Thus, P IT1 is a convex function of c ijn .Nevertheless, the problem P IT1 is mixed-integer nonlinear programming and NP hard.
To solve this problem, decompose it into two dependent sub-problems, subcarrier and power allocation problem.

Subcarrier allocation
For given p ijn , relax the integer constraint of c ijn ∈ {0, 1} into 0 < c ijn < 1 [21].With relaxing c ijn the problem can be rewritten into [22], the Lagrangian of P IT2 is Then, according to the Karush-Kuhn-Tucker (KKT) conditions, there have According to condition (17), μ i can be calculated as From condition ( 18) and ( 22), γ i is Substituting ( 22)( 23) into ( 16), there has According to KKT condition, if ξ in = 0, then c ijn > 0. If ξ in > 0, then c ijn = 0.The KKT condition λ n can be concluded as In order to solve the problem, the Lagrange multipliers λ n should be maximum, therefore The detailed procedure is given in Algorithm 2. For all intelligent terminals i ∈ I, the successful allocated intelligent terminal set is I ac ⊆ I, The set M i = {m 1 , m 2 , ..., m I } is the number of the requested subcarrier of the intelligent terminal i and M ac i ⊆ M i is the allocated subcarrier.The total number of channels is N.The total number of successful allocated channel set of the intelligent terminal i is N ac i ⊆ N. C ijn is the channel capacity set of intelligent terminal i and BS j and is a two-dimensional array with rows represent intelligent terminals and columns represent channels, which is defined as

., c i I jn N
The mapping of C ijn , I ac and N ac i is defined as σ : i, n : First, select the maximum subcarrier capacity in C ijn .If the terminal i with the largest subcarrier capacity has not been allocated enough channels, allocate the channel to teminal i, otherwise all the subcarrier capacity in C ijn associated with terminal i will be removed from C ijn until all the terminals have been allocated enough channels or all the subcarriers have been allocated.

Algorithm 2: Subcarrier allocation
Sort all capacity of intelligent terminal i in c ijn to obtain an ordered list

Power allocation
After subcarrier allocation, the constraints of each intelligent terminal is independent.Therefore, the optimization problem can be decomposed into I sub-problems.Each sub-problem optimizes one intelligent terminal power allocation to minimize intelligent terminals, own delay.In this paper, for each intelligent terminal, power allocation is solved via water-filling.Then the power allocation optimization problem of the intelligent terminal i can be mathematically formulated as max Obviously, the problem is convex optimization and the Lagrange multiplier method can be employed to solve the problem, such as According to the KKT conditions, the optimal solution p * ijn can be calculated as () + means a positive value.

Resources Allocation of Computation and Storage
The intelligent terminal i requests MEC resources from the adjacent RPS via the BS.The RPS receives and broadcasts the application in the blockchain platform using the smart contract.Each RPS who receives the smart contract will deal with the corresponding application according to the optimization problem as follow

s.t F, G, H, I.
Intelligent terminals will require MEC resources from all the edge clouds or clouds in the blockchain platform.However, the access network latency, overhead, etc. will be different due to the different locations of the access network and the edge clouds.Therefore, this paper proposes an improved greedy algorithm, which divides intelligent terminals into three priorities according to the location of the access network to the edge clouds.Set the intelligent terminals in the LAN as level 1, in the MAN as level 2, and level 3 in the WAN (the same intelligent terminal has a different priority in different edge clouds).The resources will be allocated to intelligent terminals with higher priority firstly.

Algorithm 3: Edge clouds resources allocation auction
As shown in Algorithm 3, an improved sealed second-price auction is selected.The intelligent terminal who has the highest bid price will be the successful bidder.The highest price with both the computation and storage bid price less than the successful bidder's price will be defined as the transaction price.For all intelligent terminals i ∈ I, the winning intelligent terminal set is I k ⊆ I, set B F i and B S i are bidding prices of computation and storage resources, f i and s i are the amount of applied resources of computation and storage, the wining transaction price set of computation and storage resources are P F i and P S i respectively.For each edge cloud, F M k and S M k are the maximum provide resources of computation and storage.F ac k and S ac k are the allocated resources of computation and storage, cs F k and cs S k are the cost of computation and storage resources.The priority of the intelligent terminal i is defined as π ik = 1, 2, 3 π ik ∈ ik .First, calculate the average price of computing resources and storage resources B i .Then, sort all the average bidding prices with different priority π k i = m in descending order.Then, judge the average bidding price successively except the highest one, if the computing resources bidding price and the storage resources bidding price are both greater than the cost price of MEC request, the price of the computing resources and storage resources will be the transaction price.
Meanwhile, if the rest of the resources are enough, then, the terminal who give the highest bidder obtain the resources.On the contrary, there is nobody to obtain the resources and the next round of bidding will carry out until the resources is zero or all the terminals obtain the resources.

Transaction process based on blockchain
It is can be seen from section III that the resource allocation has been completed.In general, the edge clouds will inform the intelligent terminals' success in the action to start transaction processing which will run in the consortium blockchain network.The blockchain platform architecture of MEC resources sharing is shown as Fig. 2.
The blockchain is composed of RPS, third-party spectrum and computation management, identity authentication institutions, etc.It is running by smart contracts and adopt the Solo ordering service to attain a consensus.And there are four layers in the system such as the application layer, interface layer, blockchain layer, and PHY layer.Where the application layer is the applications that the blockchain platform applied to the intelligent terminals, and the intelligent terminals call the code of the interface layer to access the blockchain database.The blockchain layer takes the charge of member management, transaction management, and contract management.Specifically, the member management mainly focuses on the identity authentication and permission management of resources proposer to ensure the security and credibility of access users, including the registration, authentication, authorization, cryptography and mathematical signature, etc. Transaction management mainly guarantees the secure and orderly transactions between the two parties of resources allocation and records the transaction data to the global ledger, including the content of block management and consensus mechanism.Furthermore, contract management mainly refers to adding the involved resources request, resource allocation, delivery monitoring, etc. into the network in the form of code and running automatically.Ultimately, the PHY layer consists of edge clouds RPS and clouds RPS.As evident from above, the transaction information will be written to the global ledger in the blockchain platform.According to the trading characteristics, there are two methods to deal with the transactions: offline and online trading model.For some real-time and high-frequency trading, the offline trading model is selected, otherwise, online.In the following content, the online and offline trading models are described in detail.Finally, a delivery monitoring module is designed to detect the nodes which are unable to provide service due to attack or other reason.

Online trading model
The online transaction model process is shown in Fig. 3.The seller uses a different account for each transaction to protect the privacy and sends the intelligent terminals' account to the buyer.Then, the buyer creates a transaction via RPS, and eventually sends the transaction to the blockchain platform.The blockchain platform will verify the transaction and write the legal transaction into the global ledger.Once the corresponding transaction is recorded in the global ledger the payment is completed.The buyer will receive information about the complement of writing the global ledger from the blockchain.Then, the buyer sends the transaction ID to the seller.If the transaction with the accurate account and amount is notarized by the seller, the seller will begin to provide services [23].
In the proposed payment mechanism, the payment execution is actually the process of writing transactions into the global ledger as shown in Fig. 4 based on Hyperledger Fabric 1.0.The buyer creates and sends transactions to the SDK (Software Development Kit).Then, the transactions will be sent to the endorser to execute and the output will be recorded in the response.Once, the SDK has collected enough correct responses of the proposal, the transactions will be submitted to the order peer.The order peer uses a pluggable consensus protocol to produce a totally ordered sequence of endorsed transactions in blocks and broadcasts the blocks to the committer peer.The committer peer will write the block to the global ledger and inform all other peers to synchronize the new block.

Offline trading model
In this paper, the offline payment mechanism is designed using the lightning network.
The idea of the lightning network is the establishment of the trading management system using smart contracts, but it does not belong to the blockchain system [24].Both counterparts in the executive system will store and manage the deposit until they want to close the account.The offline payment process is shown in Fig. 5.The buyer and seller create a ledger entry (bidirectional payment channels) in the blockchain, which requires both participants to sign off on any spending of funds.Both participants pre-deposit a certain amount of money in the ledger entry.If a transaction comes up, the buyer creates a transaction to reallocate the money in the ledger entry and sends the transaction to the seller with the signature itself without broadcasting them to the blockchain.In the same way, the seller who receives the transaction sends the corresponding reallocated transaction to the buyer with the signature of the seller and does not broadcast the transaction to the blockchain too.Then, the seller will provide services to the buyer.They can update their reallocated transactions in the ledger entry when another payment occurs.This entry can be closed out by broadcasting the most recent version transaction to the blockchain at any time by either party without any trust.

Delivery monitoring module
The authentication mechanism of blockchain ensures that the intelligent terminals joining the blockchain platform are reliable.However, when some nodes are attacked and cannot provide services normally, a detection mechanism is needed to find the wicked nodes and inform other nodes in the blockchain.Then, the node should be removed from the blockchain system.If the node wants to rejoin the system, it needs to apply for Fig. 5 The offline payment process authentication again.The process of the resource delivery detection mechanism is shown in Fig. 6.
If both actors (intelligent terminals and edge clouds) have completed their task, they will send a proof of activity to the delivery monitoring blockchain.For example, the delivery monitoring blockchain will receive three proofs in one transaction.First, the intelligent terminals will publish a proof of payment completion, when the payment is accomplished.In a similar way, proof of the service completion will be published, when intelligent terminals receive the processing results of the applied task.Meanwhile, the edge clouds will publish a proof of data processing completion to the delivery monitoring blockchain also.Once all the proofs are collected, the transaction will be closed.If the contract detects that any party has not fulfilled its duty, the node will be removed.Fig. 8 The number of intelligent terminals successfully allocated in one auction blockchain platform, and adopt the Solo ordering service to attain a consensus with 2MB block size to implement the payment mechanism.There are ten peers, one order peer, and a CA (Certificate Authority) in the environment as shown in Fig. 7.The peer represents the cloud and the order peer uses a Solo consensus protocol to produce a totally ordered sequence of endorsed transactions in blocks and broadcasts the blocks to the other peer.The Simulation environment parameter is shown in Table 1.
Fig. 9 The resources utilization rate in one auction In addition, the performance of the proposed algorithm is evaluated in terms of the successfully allocated number of intelligent terminals and the resource utilization rate in one auction compared with DPDA which is dynamic pricing based on the double auction.Figure 8 compares the number of successfully allocated intelligent terminals in one auction with 10 edge clouds and 100 intelligent terminals.The number of intelligent terminals allocated successfully in one auction using the proposed algorithm is much higher than that using the DPDA algorithm.Because the resources of intelligent terminals applied aren't enough locally.In the proposed algorithm, intelligent terminals can apply for resources from all other edge clouds instead of applying for resources from a few of edge clouds.Hence, the successful number of allocated intelligent terminals using the proposed algorithm is significantly higher than using DPDA.Figure 9 compares the resources utilization rate using the proposed algorithm and DPDA with 100 intelligent terminals and 10 edge clouds.Figure 9 illustrates that the resource utilization rate using the proposed algorithm is much higher than using DPDA under the condition of lacking resources locally.Both Figs. 8 and 9 illustrate that the resources are fully shared and the utilization rate of the resources is effectively improved in the resources shortage scenario.
To verify the individually rational of the proposed algorithm in Definition 3.1, Fig. 10a compares the bid and transaction prices of winning buyers, and Fig. 10b shows the transaction prices and costs of winning sellers under the constraint of 10 edge clouds and 10 intelligent terminals.Clearly, each winning buyer receives a transaction price less than its bid and each winning seller receives a transaction price higher than its cost.Therefore, the proposed algorithm is individually rational.

Conclusion
In this paper, we propose a sharing model of computation and storage resources among edge clouds based on blockchain and auction game.Instead of having to apply for resources from the cloud when local edge clouds cannot meet the demand of intelligent terminals, the intelligent terminals will apply for resources from all the edge clouds participate in the blockchain platform.Therefore, the resources among the edge clouds are efficient sharing, and the resource utilization rate can be significantly increased.In the follow-up work, depth research on resource sharing of the edge cloud will be researched combining with the benefit of intelligent terminals and edge clouds using the transaction information stored in the blockchain.

Fig. 1
Fig. 1 System mode I ac , N ac i Zhang et al.EURASIP Journal on Advances in Signal Processing (2021) 2021:26 Page 12 of 23

Fig. 6 of 23 Fig. 7
Fig.6 The mechanism of delivery detection

Fig. 10
Fig. 10 Individually rationale of the proposed algorithm

Table 1
Simulation environment papameters