Ming Kong,Junhui Zhao,2,*,Xiaoke Sun,Yiwen Nie
1 School of Electronic and Information Engineering,Beijing Jiaotong University,Beijing 100044,China
2 School of Information Engineering,East China Jiaotong University,Nanchang 330013,China
Abstract:In vehicular fog computing(VFC),the resource transactions in the Internet of Vehicles (IoV)have become a novel resource management scheme that can improve system resource utilization and the quality of vehicle services.In this paper,in order to improve the security and fairness of resource transactions,we design a blockchain-based resource management scheme for VFC.First,we propose the concept of resource coin(RC)and develop a blockchain-based secure computing reource trading mechanism in terms of RC.As a node of the blockchain network,the roadside unit(RSU)participates in verifying the legitimacy of transactions and the creation of new blocks.Next,we propose a resource management scheme based on contract theory,encouraging parked vehicles to contribute computing resource so that RSU could complete proof of work (PoW) quickly,improve the success probability of block creation and get RC rewards.We use the gradient descent method to solve the computing resource utilization that can maximize the RC revenue of RSUs and vehicles during the block creation.Finally,the performance of this model is validated in simulation result and analysis.
Keywords:blockchain;vehicular fog computing;resource management;contract theory
With the development of the Internet of Vehicles(IoV)technology and the rapid increase in the number of vehicle terminals(VTs),the requirement of vehicle services for IoV are becoming more and more stringent,such as the need for a large amount of computing resource and lower service delay.
Because of the higher service delay,vehicular cloud computing (VCC)has been unable to meet the growing service demand of the connected vehicles,so mobile edge computing(MEC)is proposed in IoV[1,2],where VTs generate computing tasks,MEC places roadside unit (RSU) with a certain computing power near the VT and the VT offload the computing tasks generated by themselves to the RSU for processing.Due to the short distance between the VTs and RSU,there is a lower service delay to handle the tasks of the VTs.Therefore,MEC has been more applied in the early research of IoV[3].
In recent years,with the development and application of 5G technology,a variety of new vehicle applications and services have emerged,such as augmented reality(AR)and autonomous driving(AD)[4–6].As the quality of service(QoS)of these vehicles becomes more stringent and the number of vehicles on the road continues to increase,VTs will generate more and more computing tasks to be processed.MEC with limited computing resource is gradually unable to support the realization of these vehicle services and the processing of computing tasks generated by VTs during the peak time of computing tasks.Therefore,vehicular fog computing(VFC)is proposed and used to meet new vehicle services and the demand for connected vehicle resource during the peak time[7].
In VFC,each vehicle is regarded as a vehicular fog node (VFN) with computing power.VFC improves the computing power of IoV by utilizing the available computing resource of this VFN.The computing tasks will be offloaded to these VFN for processing,further reducing the computing delay and significantly alleviating the load pressure of RSU[8–10].
For MEC and VFC,researches mainly improve the utility of the IoV system through the reasonable offloading of computing tasks and the efficient allocation of IoV resources,which are mainly reflected in improving system bandwidth utilization,reducing task processing delays and system energy consumption.In[11],the optimization objective is to minimize the system energy consumption and utilization of computing resource,and the optimization objectives in [12–17]are to minimize the delay and energy consumption of all users.
Recently,for resource management and task offloading,more and more researches focus on combining it with the theory of machine learning,optimizing management strategies and achieving optimal system efficiency in complex environments.In [18–22],the author used the method of deep reinforcement learning to optimize the resource allocation under different application scenarios.In [23],the author used reinforcement learning to solve the problem of resource allocation in IoV,so that resources can be dynamically allocated to maximize the long-term network performance of the system and prevent myopic decisions.
However,VFC still faces many challenges.In[24],the vehicles with available computing resource contributed computing resource to the connected vehicle system unconditionally.However,in actual scenarios,vehicles are owned privately and need to be rewarded with certain incentives.RSU should reward vehicles that contribute resources,and increase the motivation of vehicles to contribute resources[25–27].However,there is still a lack of a reasonable incentive mechanism,in which vehicles could be encouraged to contribute resources and use these rewards in exchange for IoV resources to improve the QoS of their own service.
In previous work[28],we have proposed a resource management and task offloading optimization scheme based on contract theory.In addition to awarding certain resources to vehicles that contribute computing resource,vehicles can also use these rewards in exchange for IoV resources,such as transmission bandwidth and computing resource,and improve the QoS of its own services.We also use deep reinforcement learning methods to dynamically adjust resource management and task offloading strategies to optimize system performance.However,this scheme faces some security challenges:dishonest vehicles may illegally obtain these rewards through deception,and compete with other vehicles for resources,in which system resources will be overloaded and the QoS of vehicle services will be worse.Eventually,there would be less enthusiasm for vehicles to contribute their computing resource.So we need to design a security mechanism to solve these problems in the resource management process.
Blockchain,as a distributed shared database,can significantly improve the security of the system.It has some significant advantages,including immutability,decentralization and security [29,30].It records each legal transaction in a verifiable way permanently,which is important for establishing a distributed,secure and transparent transaction environment.Blockchain 1.0 and 2.0 are mainly related to the transfer of bitcoin,contracted property and cryptocurrencies.Blockchain 3.0 extends this application from the financial field to a wider range of fields,including energy,education,government,health,etc [31].At present,most of the blockchain application scenarios related to IoV are focused on the application of blockchain technology in energy transactions of electric vehicles to improve transaction security[32].[33]represented a blockchain-based model,which is called Energy-Chain,to enable secure energy transactions between smart grids and smart homes.Although the combination of blockchain and energy transactions can improve transaction security,the creation of blocks requires a large amount of computing resource,so this type of blockchain cannot be implemented in networks with a limited computing resource.Therefore,when applying the blockchain,the distribution of computing resource and the reasonable allocation of resources must also be considered.In IoV scenario,there are many vehicles with computing resource driving on the road,and many vehicles are driving slowly or being parked.We consider combining available huge computing resource in these vehicles with blockchain technology.
Figure1.Blockchain-based Internet of vehicles system.
In this paper,we propose a computing resource management scheme based on blockchain technology in VFC.First,we define the resource reward mentioned in the previous work as resource coin (RC),a type of cryptocurrency.Resource transactions among vehicles and RSU are carried out in a blockchainbased network.As a node in the blockchain network,each RSU can not only verify the legitimacy of the transaction,but also use the rich computing resource in the parked vehicle to compete for the opportunity to add a new block to blockchain and obtain RC reward.In order to increase the enthusiasm of parked vehicles to contribute resources,we propose a computing resource management scheme based on contract theory and establish a utility function related to the required computing resource.We use the gradient descent method to optimize the utility function and find out the optimal required computing resource to maximize system utility.The main contributions of these works are as follows:
• Blockchain-based RC transactions.We propose a blockchain-based vehicle networking and the resource reward in VFC is defined as RC,a type of digital cryptocurrency,and traded on this network to enhance the security and fairness of RC transactions.
• VFC based Block creation.As a node in the blockchain network,RSU participates in the creation of the block by using the computing resource of the parked vehicle to increase the computing power of RSU and increase the probability of successful block creation.
• Contract-based incentive mechanism.We propose an incentive mechanism based on contract theory to pay vehicles that contribute computing resource for RC as rewards.Vehicles can use RC for IoV resources required for vehicle services,such as computing resource and transmission bandwidth.
The remaining parts of the paper are summarized as follows.The system model is introduced in Section II.In Section III,a contract theory-based incentive mechanism is presented.System formulation and optimization is elaborated in Section IV.Section V shows the simulation results.Conclusions and future work are drawn in Section VI.
The system IoV computing resource management based on the blockchain is shown in Figure1.In this system,RSU is placed on the roadside,and its computing power iscRSU;vehicles have computing powercveh.These vehicles fall into two categories:one on the road and the other on the side of the road or in the parking lot.
As the vehicle travels,vehicle services will generate computing tasks.When the vehicle’s local computing resource can meet the QoS of the computing task,the task will be processed locally,otherwise,the vehicle will need to offload the task to other computing nodes for processing,such as RSU and other VFNs with available computing resource.During the task offloading process,in order to meet the QoS of the computing task better,the vehicle will use its own RC in exchange for the communication resource of IoV,such as cache,transmission bandwidth,and computing resource.Therefore,the vehicle RC-related transactions will occur among the vehicles and RSU[28].
In order to ensure the security of the transaction and prevent the vehicle from deceiving,causing the fairness problems of IoV resource allocation,RC transactions will be completed in a network based on blockchain technology,where RSU is a node of the blockchain network and has Blockchain of the entire network.
In addition,the blockchain network also includes three main components:1) Memory server;2) Account server;3) Transaction server.The transaction information in this network is stored in memory server,and RC accounts of the vehicles and RSUs are stored in the account server as digital wallets.To protect privacy,the digital wallet address will be replaced by public key.The account server maintains the mapping relationship between the digital wallet address and the corresponding transaction account.The transaction server is responsible for coordinating RC transactions between nodes in the network.
In order to ensure the security of transactions and prevent tampering,many cryptographic algorithms,such as Boneh–Boyen short signature,SHA-256 and elliptic curve digital signature algorithm (ECDSA),are employed in blockchain-based network.First,each vehicle/RSU registers with a legitimate authority and gets public/privacy keys and certificate.The public/privacy keys will be generated by the authority and distributed to each vehicle/RSU.The certificate is denoted as a unique identity for the vehicle/RSU by binding the registration information.Each vehicle/RSU has its wallet addresses issued by the authority.After initializing,a vehicle/RSU finds the address of digital wallet that is used by the nearest account server and verifies the integrity of digital wallet.Next,it can get its data from memory server[32].
The secrecy of privacy key is maintained by the vehicle/RSU for signing transactions,and the public key can be obtained by other blockchain nodes to check the signatures of transactions[34].The public/privacy key could be generated by utilizing some algorithms,such as ECDSA [35],the lattice-based signature scheme[36]and the anti-quantum transaction authentication scheme[37],etc.
After completing the resource transactions,if the corresponding contract project is successfully performed,the vehicle/RSU will receive the corresponding reward and RC will be transferred to the vehicle/RSU wallet address.The transaction is signed by the transaction server digitally to guarantee its authenticity and integrity.Then the transaction will be broadcasted to the bolckchain-based network.Other blockchain nodes not only check the transaction by verifying the digital signature,but also check whether the transaction server that issued the transaction is authorized to consume the corresponding RC.The fake transaction will be deserted,and valid transactions will be added in new block.
The distributed consensus mechanism is used to determine which nodes have the opportunity to create new blocks to the blockchain and get corresponding rewards.In order to be able to add a new block,all blockchain nodes start the mining process,in which they will compete with each other to find a valid Proof of Work(PoW),which is similar to Bitcoin[38].
PoW needs to search for a random numberα,combined with the hash of the previous block header Φ showed in Figure2,and the hash of transactions satisfiesα+Φ<βand represents the level of computing difficulty [39].When a blockchain node finds a valid PoW,it will broadcast this result to other nodes.After getting this result,the other nodes will check it and determine whether to adopt it or not.If most of nodes agree with this result,which means that a consensus is reached,next a new block will be created to the blockchain,and the node which creates this block will be rewarded with RC.Finally,the amount of RC reward will be received in this node’s digital wallet.
Figure2.The structure of the Blockchain.
Completing PoW requires a lot of computing resource.If a node wants to build an effective fake block,it needs to control more than half of the computing resource in the entire network to ensure the validity of the fake block.In addition,each verified block is connected to the previous block through a secure encryption method,so transaction information can be prevented from being tampered.The change of a transaction will influence the block which contains it and succeeding blocks.
As a node of the blockchain network,computing resource of RSU is limited.In order to be able to compete with other RSUs and complete PoW faster,RSU needs to make full use of available computing resource in VFNs within their communication range.Because the vehicle generates computing tasks during the driving process,it has limited free computing resource.Therefore,we assume that the RSU will use the available computing resource of the vehicles parked on the roadside or in the parking lot.As mentioned in our previous work,vehicles are privately owned,and RSU needs to incentivize vehicles to contribute computing resource with certain rewards.Therefore,we need to design a scheme to increase the enthusiasm of parked vehicles to contribute their available computing resource and enable the IoV subsystem composed of RSU and vehicles to obtain more revenues in the process of blocks creation.
In this section,we design an incentive mechanism based on contract theory to encourage parked vehicles to provide their computing resource to RSU for proof of work.
We use vehicle type to quantify the positivity of a vehicle toward resource contribution,which is only known by the vehicle.A higher type of vehicle is more willing to contribute computing resource to RSU and get more reward.It is intuitive that vehicles with higher types are more preferred by RSU.To simplify the model,We assume that the vehicle type is a discrete finite set.The vehicle type is defined as follows.
Definition 1.The M vehicles can be sorted in an ascending order according to their preferences and divided into K types.We define the set of vehicle types as K={1,...,k,...,K},and the set of corresponding resource contribution capability as θ={θ1,...,θk,...,θK},which is given by
Remark 1.Because the vehicle is parked,there is no vehicle service generation and other energy consumption.So the type of vehicle is proportional to the computing resource of the vehicle.For example,a higher type of vehicle represents that it has more computing resource.
Because of the information asymmetry,RSU only knows that there areKtypes of vehicles,and the amount of resource that vehicles can contribute is not clear.So the probability of belonging to the typeθkcontract isρk,Next,we will create the utility functions for RSU and vehicles and set the optimization objective.
RSU could design up toKcontract items forKvehicle types,instead of providing all vehicles with the same contract item,i.e.,one contract item per type.For example,the contract item dedicated for typekvehicle is denoted as (δk,πk),whereδkdenotes the required computing resource,andπkis a specific RC reward.The whole contract is denoted as C={(δk,πk),∀k∈K},whereK={1,...,k,...,K}.
Considering theKtypes of vehicles,we establish the expected utility of RSU that is calculated as
whereRRSU({δk})represents the expected reward of RC obtained by vehicles with required computing resourceδkafter creating block.The specific formula expression will be elucidated in Section IV.
Remark 2.A contract item(δk=0,πk=0)represents that the type k vehicle is not willing to share its resources.Besides,the contract item must ensure that the utility of RSU is nonnegative,i.e.,URSU({δk},{πk}) ≥0.Otherwise,RSU has no motivation to allocate the contract to type k vehicle.
The utility function of type k vehicle which selects the contract item(δk,πk)is given by
whereµrepresents the energy consumed by a unit of computing resource,and we use the corresponding RC to represent its energy consumption.
The utility of IoV subsystem is the total sum utility of RSU andMvehicles,which is expressed as
The objective of IoV subsystem is to maximize its utility under the scenario of asymmetric information via the optimization of each contract item.The optimization problem can be formulated as
where C1,C2 represent the IR and IC,respectively.
Definition 2.The IR,IC can be defined as follows respectively:
•The constraint of individual rationality(IR):The type k vehicle,∀k ∈K,will get a nonnegative reward if it accepts the contract item(δk,πk)
•The constraint of incentive compatibility (IC):The constraint of IC guarantees the self-revealing property of the contract.For example,type k vehicle,∀k ∈K,will get the maximum reward if and only if it accepts the contract item(δk,πk)which is designed for its own type.
In this section,we will further combine the optimization objective proposed above with the blockchainbased IoV computing resource management scenario,and use the gradient descent method to optimize to obtain the best computing resource utilization plan.
For purpose of winning the competition of block mining,RSU will buy computing resource from vehicles to extend its own computational power.We assume that there areNRSUs.The computing resource demand of thenthRSU is denoted as ∆nwhere ∆n=andδn,kis denoted as the computing resource of the typekvehicle innthRSU.For thenthRSU,the successful probability of block creationPndepends mainly on its relative hash power[40].
The relative hash power of thenthRSU is denoted as the ratio of its computational power with respect to the total computational power,i.e.,the successful probability of block creationPnis represented as
In order to reach a consensus,after finding a valid PoW,thenthRSU will broadcast the created block to the other RSUs.
Therefore,the mathematical expectation of getting rewards after RSU creates a block successfully is as follows:
whereRrepresents the RC rewards obtained after RSU successfully creates the block.
The utility of RSU can be expressed as
The utility of thenthIoV subsystem composed of RSU and vehicles is formulated as:
In order to ensure that the subsystem can get revenues,We should guaranteeUn,s(∆n,Πn)>0.So we can get:
Next,we will solve ∆nwhich can maximizeUn,S(∆n) from the above function.We make ∆∗n=and the gradient ofUn,S(∆n) is as follows:
Then we will use the gradient descent method to solve for the optimal ∆nof the utility function.According to the optimization objective of the utility function,we know that the efficiency function is a convex function.So we can use the gradient descent method to find the maximum value.
We initialize ∆nso that ∆n=0.The method of gradient descent is as follows:
In this section,we will show the simulation results of the optimization objective of the subsystem utility function and the simulation of the optimal resource utilization performance using the gradient descent method.
In terms of the subsystem ofRSU1in our proposed blockchain-based vehicle networking system,we assume that there areM=10 parked vehicles within its communication range,and the computing resource of each vehicle 1<δ1,k <2,then the total amount of computing resource owned byRSU1isWhen the vehicle contributes its computing resource to the RSU to complete the PoW,energy is consumed to complete the computing task,and the energy cost of its unit energy consumption isµ.The total amount of computing power owned by RSUs other thanRSU1is
Figure3.Utility of system related to(a)Reward;(b)Computational power;(c)Unit cost.
Figure4.Required computing resource related to(a)Reward;(b)Computational power;(c)Unit cost.
Figure3 show the simulation results of the relationship between the subsystem utility function and the RC rewardR,the total amount of computing power of other RSUs ∆∗1,the energy consumptionµper unit computing resource,respectively.
In Figure(3a),∆∗1=10,µ=2,we assumeR={15,20,25,30},and bringRinto the formulaU1,S(∆1).We can see that asRdecreases,the utility of the system gradually decreases.In Figure(3b),R=20,µ=2,we assume ∆∗1={6,8,10,12},and bring ∆∗1into the formulaU1,S(∆1).We can get that,as ∆∗1decreases,the utility of the system gradually decreases.Combining these two figures we can verify the conclusion:whenthere is a maximum value for the utility function;whenthe system utility function decreases monotonically andU1,S(∆1)<0,which means thatRSU1will not participate in the competition for creating blocks in this case.
In Figure(3c),R=20,∆∗1=10,we assumeµ={0,1,2,3},and bringµin the formulaU1,S(∆1).We can see that whenµ=0,it means that the vehicle does not have to pay for the energy consumption when computing tasks,and the system utility function is monotonically increasing,which means thatRSU1will use the computing resource of all vehicles to complete the PoW.Whenµ/=0,asµdecreases,the utility of the subsystem gradually decreases,and the same conclusion as above can be reached.andU1,S(∆1)>0,
Figure5.The required computing resource related to learning rate.
Figure4 show that we use the gradient descent method to solve the optimal solution ∆1that maximizes the utility functionU1,S(∆1),and their simulation parameters are similar to those in Figure3,respectively.
In Figure4,the gradient descent learning rateη=0.005.From these figures,we can see that after around 2000 episodes,the computing resource ∆1required by the system can converge to the optimal solution ∆'1,and it corresponds to the optimal solution in Figure3,respectively.∆'1<0 means that RSU will not use the computing resource of the vehicle to participate in the competition for creating blocks in this case.
Figure5 show the effect of different learning rates on the optimal solution convergence.In this scenario,R=20,∆∗1=10,µ=1,ηa={0.01,0.005,0.003,0.001},ηb={1,2,3}.From Figure5(a),it can be concluded that when the learning rate is smaller,the convergence rate is slower,and the smaller learning rate will take more time to find the optimal solution.It can be concluded from Figure(5b)that the learning rate affects the accuracy of the results.A larger learning rate will cause the results to fluctuate near the optimal solution.The larger the learning rate,the greater the fluctuation range.
In the previous work,we proposed a solution for vehicle networking resource management based on resource transactions in terms of VFC.Because it only involves resource management and lacks the corresponding security and privacy guarantee measures,in this paper,we mainly study the computing resource management scheme in IoV based on blockchain.
First,we define resource transactions as RC-based transactions,and design a blockchain-based vehicle networking.RSU,as a node in the blockchain network,not only verifies the resource transactions in the vehicle networking to ensure the authenticity of the transaction,but also uses the computing resource of parked vehicles within the coverage of the RSU to complete the PoW,and competes with other RSUs for the opportunity to add a new block to blockchain and obtain RC rewards.Next,we design a resource management mechanism based on contract theory.Vehicles can obtain corresponding RC rewards by contributing computing resource.This rewards can be used in exchange for vehicle networking resources(communication bandwidth,storage space,etc.)to improve the QoS of its own vehicle services.
In the process of block creation,RSUs will compete with each other to obtain a higher probability of adding block.In addition,due to the mobility of vehicles,the scenarios of IoV resource management will be more complicated.To cope with the complex scenarios of blockchain-based IoV resource management in the future,we will consider using machine learning-based methods to deal with corresponding problems.
ACKNOWLEDGEMENT
This work was supported in part by the National Natural Science Foundation of China (U2001213,61971191 and 61661021),in part by the Beijing Natural Science Foundation under Grant L182018 and L201011,in part by National Key Research and Development Project(2020YFB1807204),in part by the open project of Shanghai Institute of Microsystem and Information Technology (20190910),in part by the Key project of Natural Science Foundation of Jiangxi Province(20202ACBL202006).