# Blockchain-Enabled Intelligent Video Caching and Transcoding in Clustered MEC Networks

Authors: Yan Li; Zheng Wan
Journal: Security and Communication Networks
 (2021)

---

## Abstract

In recent years, the number of smart devices has exploded, leading to an unprecedented increase in demand for video live and video-on-demand (VoD) services. Also, the privacy of video providers and requesters and the security of requested video data are much more threatened. In order to solve these issues, in this paper, a blockchain-enabled CMEC video transmission model (Bl-CMEC) for intelligent video caching and transcoding will be proposed to ensure the transactions’ transparency, system security, user information privacy, and integrity of the video data, enhance the ability of severs in actively caching popular video content in the CMEC system, and realize transcoding function at network edge nodes. Furthermore, we chose a scheme based on deep reinforcement learning (DRL) to intelligently access the intracluster joint caching and transcoding decisions. Then, the joint video caching and transcoding decision smart contract is specially designed to automatically manage the transaction process of the joint caching and transcoding service, which records key information of joint caching and transcoding transactions and payment information on a continuous blockchain. The simulation results demonstrate that the proposed Bl-CMEC framework not only can provide users with better QoE performance for video streaming service but also can ensure the security, integrity, and consistency for the video providers, video requesters, and video data.


---

## Body

## 1. Introduction

People are becoming more and more dependent on network services, especially during the period of COVID-19 pandemic, many activities and works are carried out on the network. Furthermore, the most important network service is the video streaming service. In recent years, because the number of smart devices has exploded, there is an increasing demand for video live and video-on-demand (VoD) services. In video streaming services, higher data rates and larger system capacity are usually required to meet the ever-increasing users’ needs, which has become a more challenging task. According to the summary of the Cisco Visual Network Index [1], mobile smart devices’ videos compose around more than 50% of the total data traffic. And, it is expected to grow further to about 79% of the total data traffic in 2022. Because of the huge demand for mobile smart devices’ videos, the operators of mobile networks are not able to meet the users’ demand for high quality of experience (QoE) in video live and VoD services.In order to solve this issue, the proposal of mobile edge computing (MEC) has brought new opportunities for the optimization of wireless video transmission [2–7]. Utilizing the communication, caching, computing, and control (4C) capabilities of edge devices, it could provide proactive video caching, transcoding, and distribution services at the network edge in the mobile networks. Also, it could reduce the burden of the backbone network and improve the video quality of experience for requested users.At the same time, smart device users may have different needs for specific videos because of the heterogeneity of smart device users’ caching and computing capabilities and changes in network conditions. For example, the smart device users with better network always ask for high QoE videos, while the smart device users with poor network generally prefer the videos with appropriate QoE. To reduce the computational load of the cloud center and transmission cost at different formats and versions of videos in the backbone network, the Content Distribution Network (CDN) is proposed which may only push a certain format and version of the video stream to the network edge and requires intelligent transcoding and distribution for tasks, as well as adaptive allocation of network resources. Especially, the cooperative transcoding decision and task assignment are needed to decide which edge nodes carry out cooperative transcoding and what kind of transcoding task is assigned to each node. The influencing factors of video transcoding and caching decisions include video content popularity, user demand and distribution, the capabilities of each edge node, and bandwidth resources between nodes. Because of this issue, adaptive bitrate streaming (ABR) [8] has been widely proposed to improve the QoE of video data which serve for smart device users in the Internet.In addition, the blockchain has developed rapidly in recent years, which is a new fashion application mode. Its core content includes P2P transmission, encryption algorithm, distributed data storage, and consensus mechanism [9, 10], and the consensus mechanism is the most important content in blockchain. Blockchain has acted as a very effective distributed management framework which has been widely used in many fields. Through the blockchain module integrated under the framework of MEC, the data resource security protection and monitoring can be realized for the processing of video data at network edge.In this paper, a blockchain-enabled framework for Clustered Mobile Edge Computing (CMEC) system is proposed, which can integrate the MEC networks and the CDN networks by setting the CDN tips. The experiments on comparison of QoE and bandwidth cost between CMEC and other schemes have been performed in our own previous paper [11]. The CMEC method can promote intracluster collaboration among the MEC nodes in one cluster. So, it can reduce the additional processing costs and backhaul consumption. Furthermore, the proposed blockchain-enabled CMEC-based video transmission model in this paper can seamlessly enable the blockchain scheme into our Clustered MEC network, connecting with the popular CDN video transmission system. Then, we deploy the blockchain structure into the CMEC system, which can be set at CDN tips or edge clusters. In the proposed scheme, the CDN tip and some edge nodes make the network edge area in the local network area. Then, the proposed model optimizes the entire network transmission of wireless video data by using the collaborative capabilities of edge cluster in communication, caching, computing, and control (4C). Specifically, the main contributions of this paper can be summarized as follows:(i)
Blockchain-enabled CMEC-based video transmission model (Bl-CMEC): a video transmission system framework model with incorporating blockchain technology is designed to actively cache popular video content in the CMEC system and realize transcoding function at network edge nodes. This model is used to improve the allocation of video caching resources and computing resources in edge cluster nodes and also to optimize user QoE from the perspective of mobile users.(ii)
Blockchain empowerment: the joint caching and transcoding transactions between network edge node and smart device users are implemented in blockchain by a smart contract. The smart contract is specially designed to manage the transaction process of the joint caching and transcoding service, which records the joint caching and transcoding transaction and payment information on a continuous blockchain. Furthermore, the smart contract can check the integrity of results returned from the network edge node to achieve adaptive video transmission optimization and make security protection of video data in a blockchain-enabled CMEC-based environment.(iii)
Intelligent scheme design: it can intelligently obtain and implement the decision of allocating the caching and computing resources at the network edge node in one cluster. It has two sections, namely, DQN-Based Video Caching and Transcoding Algorithm (DQN-VCT) (section1) and Implementation of Video Caching and Transcoding Decision Smart Contract (section 2). According to mobile users’ demand changes and network time-varying conditions, each network edge node determines the optimal caching and transcoding price. Then, we use the deep reinforcement learning-based algorithm to acquire the smart device users’ optimal caching and transcoding decision. The decision is to meet the best QoE needs of smart device users and obtain better video services.(iv)
Sufficient performance evaluation: because of extensive and sufficient simulations, we analyze the performance of the proposed intelligent video caching and transcoding scheme in this paper based on blockchain-enabled CMEC system environment.This paper is organized as follows. Section2 presents related work. The system model design is described in Section 3. Furthermore, Section 4 formulates the blockchain empowerment mode. Problem formation and intelligent video caching and transcoding scheme is introduced in Section 5. The analysis of simulation experiments is given in Section 6. Lastly, the conclusions are given in Section 7.


## 2. Related Work

In recent years, the number of smart devices has exploded, leading to an unprecedented increase in demand for video live and VoD services. Also, the privacy of video providers and requesters and the security of requested video data are much more threatened in the mobile edge computing system. Thus, the blockchain technology can help to enable the privacy of video providers and the security of requested video data. Through the distributed storage mechanism of the blockchain, the security of video information is improved, the collection of individual video data is realized through the personal ledger of blockchain, and the authorized use of video data is realized through asymmetric encryption and public and private key design in blockchain [12–15]. It is essential to introduce the blockchain into the adaptive video services in the mobile edge computing system.The integration of blockchain and MEC to solve the corresponding practical problems is currently a hot spot for many scholars, which is a very promising development direction [12, 16–19]. On the one hand, MEC nodes in network edge can provide a low-latency, much more convenient and distributed computing offloading scheme for smart mobile devices with only limited resources. Edge computing devices have powerful computing and storage capabilities compared to general user mobile devices, while blockchain services require powerful computing capabilities. Therefore, MEC provides the possibility for mobile users to enjoy blockchain services. On the other hand, blockchain can be used as an auxiliary framework to manage the provision of mobile edge computing resources and turn the supply of edge computing resources into a blockchain application. This not only enhances the security of MEC resources but also regulates the occupation and purchase of edge computing resources.Based on the literature on the combination of mobile edge computing and blockchain, the recent research mainly focuses on two aspects. First, such research about security and privacy protection mainly lies in how to introduce the blockchain technology into MEC system to achieve the security and safety of cached content. Furthermore, MEC-enabled blockchain-based distributed video system architecture is used to solve the problem about the allocation of decentralized resource for video caching, transcoding, and delivery at blockchain-based video streaming system.


### 2.1. Blockchain-Enabled MEC-Based Caching Strategy

In the process of task offloading, the transmitted information is vulnerable to attacks, resulting in incomplete data. In view of this challenge, Xu et al. [20] proposed a blockchain-enabled computing offloading method which is called BeCome. In BeCome, to ensure the data integrity, they introduced the blockchain technology into the edge computing scheme. To address the issues of data security and users privacy, Feng et al. [21] adopted blockchain technology to ensure the reliability and irreversibility of cache data in the MEC network system. Also, they developed a framework of cooperative computing sharing and resource allocation for the blockchain-enabled MEC-based network system. Guo et al. [22] proposed a blockchain-enabled MEC-based framework for adaptive computing offloading and resource allocation in the future wireless networks. In this method, blockchain is used to provide management and control function. Then, the problem acted as a joint optimization issue and deep reinforcement learning based methods are adopted to address this problem. Because of the possession of very sensitive personal information, the vehicle may be unwilling to cache its content to an untrusted cache provider. Dai et al. [23] integrated DRL and permissioned blockchain into the vehicle network, so as to acquire a secure and smart content caching method, by which a distributed content caching framework based on blockchain has been proposed. Content caching in Mobile Cyber-Physical System also faces some security issues. To address these issues, Xu et al. [24] proposed a new blockchain-based trusted network edge caching solution for mobile smart device users in a Mobile Cyber-Physical System.Applying blockchain to MEC cache system mainly solves the safety problem of cache content, MEC severs, mobile equipment users, etc. In terms of blockchain-enabled MEC-based systems, on the one hand, such research mainly lies in the use of blockchain technology to realize the privacy protection and security of cached content. On the other hand, blockchain technology can be adopted to solve data integrity issues in edge computing and to monitor the resources of edge computing devices.


### 2.2. MEC-Enabled Blockchain-Based Distributed Video Delivery Strategy

In the blockchain-based video delivery network system, in order to meet the different needs of smart device users, a lot of computing resources are needed to transcoding them into different versions and formats for the heterogeneous quality and format of video streams. To solve this problem, Liu et al. [25] and Liu et al. [26] have proposed a MEC-enabled blockchain-based architecture using MEC technology, with a series of smart contracts that can acquire self-organization at video transcoding and delivery services, especially without a centralized controller. Some emerging video streaming platforms want to build cryptocurrency-based payment systems and p2p content distribution architectures by using the blockchain technology. Liu et al. [27] proposed a novel transcoding framework that supports the MEC network for blockchain-based video delivery scheme, designing an adaptive block size mode for the underlying blockchain. Furthermore, Zhang et al. [28, 29] proposed an incentive mechanism for blockchain-based cache and delivery systems. By this incentive mechanism, the willingness of both MEC network cache nodes and D2D can be guaranteed by meeting their expected rewards for cache sharing. The existing offloading methods based on DRL always suffer from a slow convergence which is caused by the high-dimensional action spaces. Qiu et al. [30] presented a new free-model DRL online computing offloading mode. This method is used to solve the computing offloading of data processing tasks and mining tasks in wireless blockchain networks. Effective computing diversion cannot be achieved in MEC with blockchain because mobile devices do not always have enough tokens to bear the cost of diversion services. Zhang et al. [31] analyzed the combined computing offloading and coin loan problems of blockchain-empowered MEC to optimize the total cost of all smart mobile equipment.Such research mainly focuses on two aspects. The first aspect is to use mobile edge computing to solve the mining tasks and data processing tasks in the wireless blockchain network. In addition, in the blockchain-based video system, it works to implement the distributed resource allocation issues for video transcoding and delivery.


### 2.3. Motivation

Because of the high dynamics of the MEC network system, the data security and privacy protection of network edge service providers are a major challenge. Blockchain technology can construct a decentralized and secure resource sharing scheme, while Artificial Intelligence (AI) can explore and solve issues with time-varying, uncertain and complex characteristics [32–36]. The blockchain technology and MEC system both have the same decentralized characteristics, making their combination natural. Motivated by recent research results, blockchain technology can be introduced into the MEC system to support many management and security services in mobile edge computing. Also, DRL-based video transmission strategy in the MEC environment is extensively studied recently [37–43]. The DRL method can jointly solve the problems of cache content location decision, cache update strategy, and cache content delivery. Deep reinforcement learning is used to analyze and learn network information through deep learning, so as to use reinforcement learning to achieve resource scheduling.Based on the related work, applying blockchain to MEC cache system mainly addresses the safety threat of the cached content, MEC severs, mobile equipment users, etc. In terms of blockchain-enabled MEC-based systems, such research only lies in the use of blockchain technology at the caching strategy, which realizes the security and privacy protection of the cached content. Furthermore, pursuing for the new distributed data management mode of computer technology, such as p2p transmission, distributed data storage, encryption algorithm, and consensus mechanism, the blockchain technology is integrated into the MEC environment architecture. Also, a blockchain-enabled distributed video content caching and transcoding framework is proposed. In this framework, edge nodes perform video content caching and transcoding and the CDN tips maintain a licensed blockchain to ensure the integrity and accuracy of cached video data, leading to design the best video caching and transcoding scheme.


## 2.1. Blockchain-Enabled MEC-Based Caching Strategy

In the process of task offloading, the transmitted information is vulnerable to attacks, resulting in incomplete data. In view of this challenge, Xu et al. [20] proposed a blockchain-enabled computing offloading method which is called BeCome. In BeCome, to ensure the data integrity, they introduced the blockchain technology into the edge computing scheme. To address the issues of data security and users privacy, Feng et al. [21] adopted blockchain technology to ensure the reliability and irreversibility of cache data in the MEC network system. Also, they developed a framework of cooperative computing sharing and resource allocation for the blockchain-enabled MEC-based network system. Guo et al. [22] proposed a blockchain-enabled MEC-based framework for adaptive computing offloading and resource allocation in the future wireless networks. In this method, blockchain is used to provide management and control function. Then, the problem acted as a joint optimization issue and deep reinforcement learning based methods are adopted to address this problem. Because of the possession of very sensitive personal information, the vehicle may be unwilling to cache its content to an untrusted cache provider. Dai et al. [23] integrated DRL and permissioned blockchain into the vehicle network, so as to acquire a secure and smart content caching method, by which a distributed content caching framework based on blockchain has been proposed. Content caching in Mobile Cyber-Physical System also faces some security issues. To address these issues, Xu et al. [24] proposed a new blockchain-based trusted network edge caching solution for mobile smart device users in a Mobile Cyber-Physical System.Applying blockchain to MEC cache system mainly solves the safety problem of cache content, MEC severs, mobile equipment users, etc. In terms of blockchain-enabled MEC-based systems, on the one hand, such research mainly lies in the use of blockchain technology to realize the privacy protection and security of cached content. On the other hand, blockchain technology can be adopted to solve data integrity issues in edge computing and to monitor the resources of edge computing devices.


## 2.2. MEC-Enabled Blockchain-Based Distributed Video Delivery Strategy

In the blockchain-based video delivery network system, in order to meet the different needs of smart device users, a lot of computing resources are needed to transcoding them into different versions and formats for the heterogeneous quality and format of video streams. To solve this problem, Liu et al. [25] and Liu et al. [26] have proposed a MEC-enabled blockchain-based architecture using MEC technology, with a series of smart contracts that can acquire self-organization at video transcoding and delivery services, especially without a centralized controller. Some emerging video streaming platforms want to build cryptocurrency-based payment systems and p2p content distribution architectures by using the blockchain technology. Liu et al. [27] proposed a novel transcoding framework that supports the MEC network for blockchain-based video delivery scheme, designing an adaptive block size mode for the underlying blockchain. Furthermore, Zhang et al. [28, 29] proposed an incentive mechanism for blockchain-based cache and delivery systems. By this incentive mechanism, the willingness of both MEC network cache nodes and D2D can be guaranteed by meeting their expected rewards for cache sharing. The existing offloading methods based on DRL always suffer from a slow convergence which is caused by the high-dimensional action spaces. Qiu et al. [30] presented a new free-model DRL online computing offloading mode. This method is used to solve the computing offloading of data processing tasks and mining tasks in wireless blockchain networks. Effective computing diversion cannot be achieved in MEC with blockchain because mobile devices do not always have enough tokens to bear the cost of diversion services. Zhang et al. [31] analyzed the combined computing offloading and coin loan problems of blockchain-empowered MEC to optimize the total cost of all smart mobile equipment.Such research mainly focuses on two aspects. The first aspect is to use mobile edge computing to solve the mining tasks and data processing tasks in the wireless blockchain network. In addition, in the blockchain-based video system, it works to implement the distributed resource allocation issues for video transcoding and delivery.


## 2.3. Motivation

Because of the high dynamics of the MEC network system, the data security and privacy protection of network edge service providers are a major challenge. Blockchain technology can construct a decentralized and secure resource sharing scheme, while Artificial Intelligence (AI) can explore and solve issues with time-varying, uncertain and complex characteristics [32–36]. The blockchain technology and MEC system both have the same decentralized characteristics, making their combination natural. Motivated by recent research results, blockchain technology can be introduced into the MEC system to support many management and security services in mobile edge computing. Also, DRL-based video transmission strategy in the MEC environment is extensively studied recently [37–43]. The DRL method can jointly solve the problems of cache content location decision, cache update strategy, and cache content delivery. Deep reinforcement learning is used to analyze and learn network information through deep learning, so as to use reinforcement learning to achieve resource scheduling.Based on the related work, applying blockchain to MEC cache system mainly addresses the safety threat of the cached content, MEC severs, mobile equipment users, etc. In terms of blockchain-enabled MEC-based systems, such research only lies in the use of blockchain technology at the caching strategy, which realizes the security and privacy protection of the cached content. Furthermore, pursuing for the new distributed data management mode of computer technology, such as p2p transmission, distributed data storage, encryption algorithm, and consensus mechanism, the blockchain technology is integrated into the MEC environment architecture. Also, a blockchain-enabled distributed video content caching and transcoding framework is proposed. In this framework, edge nodes perform video content caching and transcoding and the CDN tips maintain a licensed blockchain to ensure the integrity and accuracy of cached video data, leading to design the best video caching and transcoding scheme.


## 3. System Model Design

For convenience, the major notations used in this article are summarized in Table1.Table 1
Summary of major notations.
NotationDescriptiontThe time stageMtThe serial number of MEC severs in a clusterUtThe decision of video cache updatingzvThe probability of the requests of videovCbtThe corresponding bandwidth costPn,tThe unit bandwidth priceWn,tThe amount of bandwidth usage in the MEC servernBi,tThe bitrate assigned to useri at time slot tO (t)The video transcoding costLtThe buffer occupancy rateRtThe video rebuffering time of playback bufferqtThe video quality rateCRHtThe video cache hit ratepki,j,ski,jThe public/private key pairs of user mobile devicei connecting to edge node jpkj,skjThe public/private key pairs of edge nodejIDVi,jThe ID of video contentVi,jHIDVi,jThe generated hash value ofIDVi,j


### 3.1. Bl-CMEC System Model Design

To satisfy the requirements for video distribution across the entire network and maximize the role of edge computing nodes, it is necessary to perfectly integrate edge nodes with the existing wireless network environment and video transmission technology, fully cooperating with cloud center and user terminals [44–50]. At the same time, the blockchain technology can be integrated into the mobile edge computing environment. The blockchain can be used as an auxiliary framework to manage the provision of mobile edge computing resources and turn the supply of edge computing resources into a blockchain application.In Figure1, this paper intends to present a blockchain-enabled CMEC-based video transmission model. The first important aspect is the Clustered Mobile Edge Computing (CMEC) system. In this CMEC system, mobile edge computing is seamlessly connected with CDN tips. Also, the CDN tips and some mobile edge computing nodes make the mobile edge area. Based on the CMEC model, the storage, computing, and communication capabilities in one cluster can be collaboratively used to optimize wireless video streaming transmission quality through the whole network.Figure 1
Blockchain-enabled intelligent video caching and transcoding framework for Clustered Mobile Edge Computing system.In this system, the CDN tip is a central server directly connected to each edge cluster. It can provide the original cached video resources for each edge cluster and the computing power support required for the implementation of deep reinforcement learning algorithms and is also responsible for maintaining the permission blockchain to ensure the transparency, security, privacy, and integrity of cached video data and user information. Also, the proposed blockchain-enabled CMEC-based video transmission model in this paper will seamlessly enable the blockchain scheme into our Clustered MEC network, combining with the popular CDN video transmission system by connecting edge clusters with CDN tips.Furthermore, the second important aspect is the blockchain-enabled intelligent video caching and transcoding framework for CMEC-based video transmission system. In this framework, mobile edge nodes perform joint video caching and transcoding by using the deep reinforcement learning method in one mode (independent or federated) and the CDN tips will maintain a licensed blockchain to ensure the transparency, security, privacy, and integrity of cached video data and user information. The mobile edge nodes in the cluster, which can participate in the task of intelligent video caching and transcoding, will depend on the security model of the blockchain.The security model of the blockchain includes four levels of the encryption guarantee layer, the consensus guarantee layer, the economic guarantee layer, and the social security layer. Encryption guarantee is used to ensure that only safe and legal edge nodes can participate in the task of intelligent video caching and transcoding services. The consensus mechanism layer is to complete the verification and confirmation of the transaction in a short time through the voting of trusted edge nodes to ensure the accuracy of the information. Economic security can reward good behavior (with block rewards and fees) and punish bad behavior (by cutting margin or withholding future rewards). Also, social security is the last guarantee. If the consensus attack exceeds the stage of economic security, the society can still reject it by manually lifting the control of the miner.So, the blockchain designed in this article has four functions as follows:(a)
Transaction Transparency. Any party in this network system (including users, mobile edge nodes, and CDN tips) can choose to download and access this blockchain to obtain information about cached and transcoded video transactions.(b)
System Security. The blockchain uses asymmetric encryption technology, so that the security of the blockchain can be achieved by using private and public keys. Blockchain can provide identity verification function and access control to protect CMEC system.(c)
User Information Privacy. The user privacy in the blockchain is achieved by public key anonymity. Immutability and consensus ensure the privacy of the database stored on the blockchain(d)
Video Data Integrity. As users and edge nodes reach a consensus, edge nodes and users will add blocks of newly completed transactions (smart contracts) broadcasted by honest entities to the blockchain. The consensus mechanism not only ensures the integrity of the video data but also makes the content of the video data transparent in the blockchain network formed by all nodes, that is, unmodifiable means to monitor the integrity and authenticity of data.


### 3.2. Video Caching Model

In the CMEC system, to reduce the delay time of video streaming services, the more popular video content is proactively cached in the network edge node. In our CMEC system, the video content is actively cached in any edge MEC server in one edge cluster. Videos with high video popularity are generally cached at edge MEC servers, while videos with low video popularity are generally cached at CDN tips. In a cluster, the specific location of the video cached with high video popularity needs to be intelligently selected according to users’ needs. In CMEC system, the video cache updating, which means the caching action at each time staget, is denoted as CacheMt,Ut.According to this caching model, the videos are needed to be proactively cached according to the video popularity, which is the user’s preference for the video. Therefore, the popularity of the video content will be requested to be obtained as the basic data information. The important key to solve the video caching problem is videos’ popularity distribution. During the caching process, the video content cached by the MEC server also needs to be updated continuously. In our caching model, we update the caching video by using the first-in-first-out (FIFO) method, selecting the more popular videos at the mean time. Then, the probability of videov is defined as(1)Zv=v−α∑v=1Vv−α,where α>0 is the parameter in Zipf distribution, indicating the skewness degrees [51].In addition, the corresponding bandwidth cost will be generated during the caching process, which is represented by the symbolCbt. Bandwidth cost is one of the main costs that need to be considered. In the CMEC system, we suppose that the price of bandwidth remains constant within a time stage. Then, the bandwidth cost Cbt [52] of MEC servers in one cluster can be defined as follows:(2)Cbt=∑n=1MPn,t⋅Wn,t,where M is the number of MEC severs in one cluster at time stage t. Also, the bandwidth cost in MEC server n can be computed by the following formula:(3)Wn,t=∑i∈UtBui,t⋅Iti,n,n∈0,…,M−1,where qt is the user group in one cluster at time stage qt=βlogBt. The symbol β is an indicator, representing if user CRHt needs be connected to the MEC server T at time stage t.


### 3.3. Video Transcoding Model

To reduce the delay time of video services and improve the QoE of video services, proactive popular video caching has been carried out on the network edge server. However, in real life, different users have different network conditions, which leads to different users’ needs for the same video. That is, users with good network conditions need high-definition video sources, while users with poor network conditions only need video sources with general definition. This requires the network edge server to cache different versions of the video source for the same video, but this requires a huge caching space to satisfy.Therefore, it is considered that the functions of caching and transcoding can be realized at the CMEC network edge server at the same time. Thus, the CMEC network edge server can perform video transcoding in real time according to different user needs and actual conditions to satisfy the needs of different users, improving the efficiency and QoE of video services.In our CMEC system, letBui,t∈B1,B2,…,Bmax be the set of all video layers in video transcoding service. Also, the symbol Bmax represents the original video level cached at the MEC server. So, the video transcoding action is video transcoding layer decision and which MEC server in the cluster will carry out this task of video transcoding at each time stage t.Because the network edge server will implement video transcoding in real time according to different user needs and actual conditions, the video services also need to consider the transcoding cost. Generally, the target video bit-rate, the input video bit-rate, the number of CPU cores, and the video length will closely affect the transcoding cost. These need to be considered in the video pricing model. Then, the video transcoding cost can be defined as(4)Ot=σ∗Lmax−l∗Tv∗Ncpu,l∈L1,L2,…,Lmax,where the symbols l, Ncpu, Tv, and σ represent level of input video data, the number of CPU cores required for transcoding task, the length of video, and an adjustable parameter, respectively.


### 3.4. Rebuffer Model

The video playback buffer is usually set on the user’s smart device to ensure continuous playback of the video, in which the video block will be downloaded to the buffer [53]. Let Wt represent the wireless transmission rate of smart device users. Also, the symbol Bt denotes the bitrate of the chunk of the video data. So, the buffer occupancy rate Lt will be obtained as(5)Lt=buffer occupancybuffer size.Furthermore, in the rebuffer model, the buffered video time and rebuffering time could be usually introduced [54]. The video rebuffering time of playback buffer is denoted as Rt:(6)Rt=maxdt−Tt,0,where Tt denotes the buffered video time at playback buffer at the beginning of time stage t. Also, the total downloading time of one chunk during time stage t is denoted by dt.


### 3.5. Video Quality-Rate and Cache Hit Rate Model

Under normal circumstances, for video quality evaluation, the video quality of a rate-encoded video can be approximated by the following logarithmic function [55]:(7)qt=βlogBt,where the value β will be obtained from the video encoder when encoding in the video source. Furthermore, the high-definition video generally has a higher bit rate, while the standard-definition video generally has a lower bit rate.In addition, the quality of video streaming service can generally be evaluated and analyzed using the cache hit rate. The cache hit rate ofT requests in the time period [51] can be obtained as(8)CRHt=∑i=1T1HiT,where 1Hi is an indicator function.


## 3.1. Bl-CMEC System Model Design

To satisfy the requirements for video distribution across the entire network and maximize the role of edge computing nodes, it is necessary to perfectly integrate edge nodes with the existing wireless network environment and video transmission technology, fully cooperating with cloud center and user terminals [44–50]. At the same time, the blockchain technology can be integrated into the mobile edge computing environment. The blockchain can be used as an auxiliary framework to manage the provision of mobile edge computing resources and turn the supply of edge computing resources into a blockchain application.In Figure1, this paper intends to present a blockchain-enabled CMEC-based video transmission model. The first important aspect is the Clustered Mobile Edge Computing (CMEC) system. In this CMEC system, mobile edge computing is seamlessly connected with CDN tips. Also, the CDN tips and some mobile edge computing nodes make the mobile edge area. Based on the CMEC model, the storage, computing, and communication capabilities in one cluster can be collaboratively used to optimize wireless video streaming transmission quality through the whole network.Figure 1
Blockchain-enabled intelligent video caching and transcoding framework for Clustered Mobile Edge Computing system.In this system, the CDN tip is a central server directly connected to each edge cluster. It can provide the original cached video resources for each edge cluster and the computing power support required for the implementation of deep reinforcement learning algorithms and is also responsible for maintaining the permission blockchain to ensure the transparency, security, privacy, and integrity of cached video data and user information. Also, the proposed blockchain-enabled CMEC-based video transmission model in this paper will seamlessly enable the blockchain scheme into our Clustered MEC network, combining with the popular CDN video transmission system by connecting edge clusters with CDN tips.Furthermore, the second important aspect is the blockchain-enabled intelligent video caching and transcoding framework for CMEC-based video transmission system. In this framework, mobile edge nodes perform joint video caching and transcoding by using the deep reinforcement learning method in one mode (independent or federated) and the CDN tips will maintain a licensed blockchain to ensure the transparency, security, privacy, and integrity of cached video data and user information. The mobile edge nodes in the cluster, which can participate in the task of intelligent video caching and transcoding, will depend on the security model of the blockchain.The security model of the blockchain includes four levels of the encryption guarantee layer, the consensus guarantee layer, the economic guarantee layer, and the social security layer. Encryption guarantee is used to ensure that only safe and legal edge nodes can participate in the task of intelligent video caching and transcoding services. The consensus mechanism layer is to complete the verification and confirmation of the transaction in a short time through the voting of trusted edge nodes to ensure the accuracy of the information. Economic security can reward good behavior (with block rewards and fees) and punish bad behavior (by cutting margin or withholding future rewards). Also, social security is the last guarantee. If the consensus attack exceeds the stage of economic security, the society can still reject it by manually lifting the control of the miner.So, the blockchain designed in this article has four functions as follows:(a)
Transaction Transparency. Any party in this network system (including users, mobile edge nodes, and CDN tips) can choose to download and access this blockchain to obtain information about cached and transcoded video transactions.(b)
System Security. The blockchain uses asymmetric encryption technology, so that the security of the blockchain can be achieved by using private and public keys. Blockchain can provide identity verification function and access control to protect CMEC system.(c)
User Information Privacy. The user privacy in the blockchain is achieved by public key anonymity. Immutability and consensus ensure the privacy of the database stored on the blockchain(d)
Video Data Integrity. As users and edge nodes reach a consensus, edge nodes and users will add blocks of newly completed transactions (smart contracts) broadcasted by honest entities to the blockchain. The consensus mechanism not only ensures the integrity of the video data but also makes the content of the video data transparent in the blockchain network formed by all nodes, that is, unmodifiable means to monitor the integrity and authenticity of data.


## 3.2. Video Caching Model

In the CMEC system, to reduce the delay time of video streaming services, the more popular video content is proactively cached in the network edge node. In our CMEC system, the video content is actively cached in any edge MEC server in one edge cluster. Videos with high video popularity are generally cached at edge MEC servers, while videos with low video popularity are generally cached at CDN tips. In a cluster, the specific location of the video cached with high video popularity needs to be intelligently selected according to users’ needs. In CMEC system, the video cache updating, which means the caching action at each time staget, is denoted as CacheMt,Ut.According to this caching model, the videos are needed to be proactively cached according to the video popularity, which is the user’s preference for the video. Therefore, the popularity of the video content will be requested to be obtained as the basic data information. The important key to solve the video caching problem is videos’ popularity distribution. During the caching process, the video content cached by the MEC server also needs to be updated continuously. In our caching model, we update the caching video by using the first-in-first-out (FIFO) method, selecting the more popular videos at the mean time. Then, the probability of videov is defined as(1)Zv=v−α∑v=1Vv−α,where α>0 is the parameter in Zipf distribution, indicating the skewness degrees [51].In addition, the corresponding bandwidth cost will be generated during the caching process, which is represented by the symbolCbt. Bandwidth cost is one of the main costs that need to be considered. In the CMEC system, we suppose that the price of bandwidth remains constant within a time stage. Then, the bandwidth cost Cbt [52] of MEC servers in one cluster can be defined as follows:(2)Cbt=∑n=1MPn,t⋅Wn,t,where M is the number of MEC severs in one cluster at time stage t. Also, the bandwidth cost in MEC server n can be computed by the following formula:(3)Wn,t=∑i∈UtBui,t⋅Iti,n,n∈0,…,M−1,where qt is the user group in one cluster at time stage qt=βlogBt. The symbol β is an indicator, representing if user CRHt needs be connected to the MEC server T at time stage t.


## 3.3. Video Transcoding Model

To reduce the delay time of video services and improve the QoE of video services, proactive popular video caching has been carried out on the network edge server. However, in real life, different users have different network conditions, which leads to different users’ needs for the same video. That is, users with good network conditions need high-definition video sources, while users with poor network conditions only need video sources with general definition. This requires the network edge server to cache different versions of the video source for the same video, but this requires a huge caching space to satisfy.Therefore, it is considered that the functions of caching and transcoding can be realized at the CMEC network edge server at the same time. Thus, the CMEC network edge server can perform video transcoding in real time according to different user needs and actual conditions to satisfy the needs of different users, improving the efficiency and QoE of video services.In our CMEC system, letBui,t∈B1,B2,…,Bmax be the set of all video layers in video transcoding service. Also, the symbol Bmax represents the original video level cached at the MEC server. So, the video transcoding action is video transcoding layer decision and which MEC server in the cluster will carry out this task of video transcoding at each time stage t.Because the network edge server will implement video transcoding in real time according to different user needs and actual conditions, the video services also need to consider the transcoding cost. Generally, the target video bit-rate, the input video bit-rate, the number of CPU cores, and the video length will closely affect the transcoding cost. These need to be considered in the video pricing model. Then, the video transcoding cost can be defined as(4)Ot=σ∗Lmax−l∗Tv∗Ncpu,l∈L1,L2,…,Lmax,where the symbols l, Ncpu, Tv, and σ represent level of input video data, the number of CPU cores required for transcoding task, the length of video, and an adjustable parameter, respectively.


## 3.4. Rebuffer Model

The video playback buffer is usually set on the user’s smart device to ensure continuous playback of the video, in which the video block will be downloaded to the buffer [53]. Let Wt represent the wireless transmission rate of smart device users. Also, the symbol Bt denotes the bitrate of the chunk of the video data. So, the buffer occupancy rate Lt will be obtained as(5)Lt=buffer occupancybuffer size.Furthermore, in the rebuffer model, the buffered video time and rebuffering time could be usually introduced [54]. The video rebuffering time of playback buffer is denoted as Rt:(6)Rt=maxdt−Tt,0,where Tt denotes the buffered video time at playback buffer at the beginning of time stage t. Also, the total downloading time of one chunk during time stage t is denoted by dt.


## 3.5. Video Quality-Rate and Cache Hit Rate Model

Under normal circumstances, for video quality evaluation, the video quality of a rate-encoded video can be approximated by the following logarithmic function [55]:(7)qt=βlogBt,where the value β will be obtained from the video encoder when encoding in the video source. Furthermore, the high-definition video generally has a higher bit rate, while the standard-definition video generally has a lower bit rate.In addition, the quality of video streaming service can generally be evaluated and analyzed using the cache hit rate. The cache hit rate ofT requests in the time period [51] can be obtained as(8)CRHt=∑i=1T1HiT,where 1Hi is an indicator function.


## 4. Blockchain Empowerment Mode

### 4.1. Integration of Blockchain and Video Streaming Service Network

Blockchain is a layered architecture, which includes data layer, network layer, consensus layer, incentive layer, contract layer, and application layer. Also, it is a decentralized system composed of P2P networks. In our CMEC system, the CDN tip and some mobile edge computing nodes make the mobile edge area. Because of the large difference in capabilities among mobile edge nodes, a clustered mobile edge computing model is introduced to cluster edge nodes at the network local area. Then, there are also some mobile edge nodes in one cluster, and one cluster head is selected based on the storage, computing, and communication capabilities of the network edge node. The users can also be divided into some different user groups in one mobile edge area, according to user preferences for videos. Generally speaking, users in the same group often have the same type of edge nodes to provide video streaming services.As shown in Figure2, the detail of blockchain-enabled process for intelligent video streaming service has been given as follows:(a)
Requesting and making decision: when there is a request, the requested edge node uses the deep reinforcement learning method to make a video caching and transcoding decision based on the user’s request content and the actual network environment and also returns the decision result to the user(b)
Create smart contract: according to the decision, the video caching and transcoding smart contracts are created based on user requests and task requests in the edge cluster(c)
Execute smart contract: the smart contract will be executed to realize the edge nodes in the edge cluster to cache the video, complete the video transcoding task, and provide the transcoded requested video to the user(d)
Record and release the smart contract: finally, put the smart contract transaction data on the blockchain and release the smart contractFigure 2
Blockchain-enabled process for intelligent video streaming service.In the CMEC system, video streaming services can be implemented by P2P connection between edge nodes and user equipment. All the edge nodes and user equipment are made to be consensus nodes. Only the trusted consensus nodes are able to access CMEC video streaming service system, in which the consensus nodes should have passed authorization in blockchain. In the CMEC system, we need to consider where to cache the requested video and choose which version of the requested video should be transcoded for the users. However, in real life, different users have different network conditions, which leads to different users’ needs for the same video.Therefore, selecting the appropriate video resolution according to the user’s real-time network conditions is a relatively complex decision-making problem in the high-dimensional state space.To solve this problem, we use a framework based on deep reinforcement learning to automatically acquire intracluster collaborative caching and transcoding decisions. These decisions are executed on real time based on user demand predictions, video data popularity, and the capabilities of the MEC server. Based on the blockchain technology, we use smart contracts to implement edge collaborative caching and transcoding applications. Then, the packaging node uploads the key information of the edge collaborative cache and transcoding application to the blockchain to save the certificate and ensure efficiency and accuracy. Through the smart contract, the video streaming service transaction between the edge node and the user is realized. The user pays a certain token, and the edge node that provides the service can receive the token reward.By blockchain-enabled framework for CMEC-based video transmission system, the blockchain technology is introduced into the CMEC system to ensure the transactions’ transparency, system security, user information privacy, and integrity of the video data. Also, the intelligent video streaming service has been provided, which has a series of smart contracts to acquire self-organization at video caching and transcoding services, especially without a centralized controller, only based on real-time DRL decision results.In this system model, deep reinforcement learning is generally performed at the edge nodes in the cluster. Also, in blockchain-enabled CMEC-based video transmission system, the edge nodes are generally macro base station or small base station which is equipped with servers. Their computing power is strong enough to quickly implement learning algorithms and give decisions. The delay time of this process is much shorter, which can be ignored in comparison. Furthermore, the real-time computing power required for video caching and transcoding is not high. Even when the required computing power is higher, the CDN tip directly connected to the edge cluster can help to complete the task and quickly return the calculation result. Therefore, we need not consider the latency of the process of deep reinforcement learning in the experiments.


### 4.2. Joint Video Caching and Transcoding Decision Smart Contract Design

In the blockchain-enabled video streaming service, we use tokens to realize the video streaming service transaction [11]. Since the video streaming service interaction between network edge nodes and smart mobile device users is not supervised by other parties, malicious users will deliberately refuse to pay the caching and transcoding service fees of edge nodes. Based on this, first, we plan to use the blockchain technology to supervise the video caching and transcoding transactions between network edge nodes and smart mobile device users in a distributed mode. In this paper, we use blockchain to realize collaborative caching and transcoding transactions among network edge nodes and smart mobile device users. The joint caching and transcoding transaction between network edge nodes and smart device users is implemented in blockchain by a smart contract. The smart contract is specially designed to manage the transaction process of the joint caching and transcoding service, which records the joint caching and transcoding transaction and payment information on a continuous blockchain. In particular, the smart contract can check the integrity of results returned from the network edge node to achieve adaptive video transmission optimization and make security protection of video data in the blockchain-enabled CMEC-based environment.The detail of the joint video caching and transcoding decision smart contract construct is shown in Algorithm1.(a)
Initialization: the initialization is the setup function of the joint video caching and transcoding service, where the user’s smart mobile devicei interacts with the network edge node j. The initialization formulates smart contracts for the joint video caching and transcoding service. The user smart mobile device i and network edge node j both generate public and private key pairs, which are represented by pki,j,ski,j and pkj,skj, respectively. Every smart contract contains a set of variables, including cached video location Mi,j, cache update decision Ui,j, cached video content size Si,j, service user video version Bui,t, network edge node transcoding price pj, deployment time dTime, timestamp tStamp, and contract service period time cTime. Finally, in this function, the user smart mobile device i and the network edge node j will both sign the contract by using their own private keys signIDi,j and signIDj.(b)
Create: after the user smart mobile devicei and the network edge node j reach an agreement, they will deploy a new smart contract by using the creating function on the blockchain. The output of the creating function is the contract address on the blockchain, which is public to all network edge nodes and smart device users. To ensure the execution of the smart contract and prevent malicious behavior, both the user smart mobile device i and the network edge node j must submit certain deposits from their own accounts to the smart contract. The paid deposits can be represented by depositi,j and depositj, respectively.(c)
Transaction execution: if a specific smart contract has been set on the blockchain, the transaction function is executed. When the user smart mobile devicei requests a video streaming from the network edge node j, based on the user network environment and the load of the nodes at the cluster in CMEC system, using the deep reinforcement learning algorithm, the user mobile device Qs,a;θ should generate a cooperative caching and transcoding token with the help of the edge device; its value is δi,j=IDVi,j,Mi,j,Ui,j,Bui,t,hi,j, where IDVi,j is the ID of video content Vi,j and hi,j is HIDVi,j, the generated hash value, where the symbol H is the public hash function. After that, the user smart mobile device signs δi,j by signδi,j. The user smart mobile device sends the signature signδi,j and δi,j to the network edge node j. Once the network edge node j receives δi,j, it will firstly use the public key pki,j of the user smart mobile device to verify δi,j. Simultaneously, verify hi,j and implement collaborative caching and transcoding in δi,j. After completing the above process, network edge node j generates the following joint video caching and transcoding transaction:(9)Transaction⟶hi,j,signδi,j,Mi,j,Ui,j,Bui,t,pj.(d)
Recording: after the transaction is completed, the network edge nodej in cluster sends the transaction to the selected smart contract. The network edge node of cluster heads and user group leaders in the network will use the DPoS consensus protocol to record transactions on the blockchain.(e)
Penalty and settlement: at this stage, because the smart contract can monitor the video content transmission service between the user’s smart mobile device and the network edge node, if any of them does not abide by the signed agreement, the penalty function will be called to implement the penalty. Finally, when the smart contract is completed and reaches the service period, financial settlement will be performed and all assets owned by the smart contract will be released.Algorithm 1:Joint video caching and transcoding decision smart contract algorithm.
(1)
Initialization:(2)
Initialize the input dataIDi,j,IDj,Mi,j,Ui,j,Si,j,Bui,t,pj(3)
Initialize statepki,j,ski,j,pkj,skj,dTime,tStamp,cTime(4)
signIDi,j and signIDj on the selected smart contract(5)
Creat:(6)
Output the smart contract address(7)
Input:depositi,j,depositj(8)
Verify:depositi,j≥pj,depositj(9)
Transaction Execution:(10)
Verify the state:t>dTime(11)
Edge cluster asks the video for caching(12)
The selected edge node in edge cluster implements the transcoding task(13)
Edge cluster sends the appreciate video to users(14)
Edge cluster broadcasts collaborative caching and transcoding transaction(15)
Transaction as:(16)
Transaction⟶hi,j,signδi,j,Mi,j,Ui,j,Bui,t,pj(17)
Recording:(18)
Edge node in cluster sends the transaction to the selected smart contract(19)
Edge cluster and users in the network use the DPoS consensus protocol to record transactions on the blockchain(20)
Penalty and Settlement:(21)
Verify the state:t>cTime(22)
Penalty execution:penaltyi,j,penaltyj(23)
Settlement:(24)
IDi,j,depositi,j−pj+penaltyi,j,IDj,depositj+pj+penaltyj


## 4.1. Integration of Blockchain and Video Streaming Service Network

Blockchain is a layered architecture, which includes data layer, network layer, consensus layer, incentive layer, contract layer, and application layer. Also, it is a decentralized system composed of P2P networks. In our CMEC system, the CDN tip and some mobile edge computing nodes make the mobile edge area. Because of the large difference in capabilities among mobile edge nodes, a clustered mobile edge computing model is introduced to cluster edge nodes at the network local area. Then, there are also some mobile edge nodes in one cluster, and one cluster head is selected based on the storage, computing, and communication capabilities of the network edge node. The users can also be divided into some different user groups in one mobile edge area, according to user preferences for videos. Generally speaking, users in the same group often have the same type of edge nodes to provide video streaming services.As shown in Figure2, the detail of blockchain-enabled process for intelligent video streaming service has been given as follows:(a)
Requesting and making decision: when there is a request, the requested edge node uses the deep reinforcement learning method to make a video caching and transcoding decision based on the user’s request content and the actual network environment and also returns the decision result to the user(b)
Create smart contract: according to the decision, the video caching and transcoding smart contracts are created based on user requests and task requests in the edge cluster(c)
Execute smart contract: the smart contract will be executed to realize the edge nodes in the edge cluster to cache the video, complete the video transcoding task, and provide the transcoded requested video to the user(d)
Record and release the smart contract: finally, put the smart contract transaction data on the blockchain and release the smart contractFigure 2
Blockchain-enabled process for intelligent video streaming service.In the CMEC system, video streaming services can be implemented by P2P connection between edge nodes and user equipment. All the edge nodes and user equipment are made to be consensus nodes. Only the trusted consensus nodes are able to access CMEC video streaming service system, in which the consensus nodes should have passed authorization in blockchain. In the CMEC system, we need to consider where to cache the requested video and choose which version of the requested video should be transcoded for the users. However, in real life, different users have different network conditions, which leads to different users’ needs for the same video.Therefore, selecting the appropriate video resolution according to the user’s real-time network conditions is a relatively complex decision-making problem in the high-dimensional state space.To solve this problem, we use a framework based on deep reinforcement learning to automatically acquire intracluster collaborative caching and transcoding decisions. These decisions are executed on real time based on user demand predictions, video data popularity, and the capabilities of the MEC server. Based on the blockchain technology, we use smart contracts to implement edge collaborative caching and transcoding applications. Then, the packaging node uploads the key information of the edge collaborative cache and transcoding application to the blockchain to save the certificate and ensure efficiency and accuracy. Through the smart contract, the video streaming service transaction between the edge node and the user is realized. The user pays a certain token, and the edge node that provides the service can receive the token reward.By blockchain-enabled framework for CMEC-based video transmission system, the blockchain technology is introduced into the CMEC system to ensure the transactions’ transparency, system security, user information privacy, and integrity of the video data. Also, the intelligent video streaming service has been provided, which has a series of smart contracts to acquire self-organization at video caching and transcoding services, especially without a centralized controller, only based on real-time DRL decision results.In this system model, deep reinforcement learning is generally performed at the edge nodes in the cluster. Also, in blockchain-enabled CMEC-based video transmission system, the edge nodes are generally macro base station or small base station which is equipped with servers. Their computing power is strong enough to quickly implement learning algorithms and give decisions. The delay time of this process is much shorter, which can be ignored in comparison. Furthermore, the real-time computing power required for video caching and transcoding is not high. Even when the required computing power is higher, the CDN tip directly connected to the edge cluster can help to complete the task and quickly return the calculation result. Therefore, we need not consider the latency of the process of deep reinforcement learning in the experiments.


## 4.2. Joint Video Caching and Transcoding Decision Smart Contract Design

In the blockchain-enabled video streaming service, we use tokens to realize the video streaming service transaction [11]. Since the video streaming service interaction between network edge nodes and smart mobile device users is not supervised by other parties, malicious users will deliberately refuse to pay the caching and transcoding service fees of edge nodes. Based on this, first, we plan to use the blockchain technology to supervise the video caching and transcoding transactions between network edge nodes and smart mobile device users in a distributed mode. In this paper, we use blockchain to realize collaborative caching and transcoding transactions among network edge nodes and smart mobile device users. The joint caching and transcoding transaction between network edge nodes and smart device users is implemented in blockchain by a smart contract. The smart contract is specially designed to manage the transaction process of the joint caching and transcoding service, which records the joint caching and transcoding transaction and payment information on a continuous blockchain. In particular, the smart contract can check the integrity of results returned from the network edge node to achieve adaptive video transmission optimization and make security protection of video data in the blockchain-enabled CMEC-based environment.The detail of the joint video caching and transcoding decision smart contract construct is shown in Algorithm1.(a)
Initialization: the initialization is the setup function of the joint video caching and transcoding service, where the user’s smart mobile devicei interacts with the network edge node j. The initialization formulates smart contracts for the joint video caching and transcoding service. The user smart mobile device i and network edge node j both generate public and private key pairs, which are represented by pki,j,ski,j and pkj,skj, respectively. Every smart contract contains a set of variables, including cached video location Mi,j, cache update decision Ui,j, cached video content size Si,j, service user video version Bui,t, network edge node transcoding price pj, deployment time dTime, timestamp tStamp, and contract service period time cTime. Finally, in this function, the user smart mobile device i and the network edge node j will both sign the contract by using their own private keys signIDi,j and signIDj.(b)
Create: after the user smart mobile devicei and the network edge node j reach an agreement, they will deploy a new smart contract by using the creating function on the blockchain. The output of the creating function is the contract address on the blockchain, which is public to all network edge nodes and smart device users. To ensure the execution of the smart contract and prevent malicious behavior, both the user smart mobile device i and the network edge node j must submit certain deposits from their own accounts to the smart contract. The paid deposits can be represented by depositi,j and depositj, respectively.(c)
Transaction execution: if a specific smart contract has been set on the blockchain, the transaction function is executed. When the user smart mobile devicei requests a video streaming from the network edge node j, based on the user network environment and the load of the nodes at the cluster in CMEC system, using the deep reinforcement learning algorithm, the user mobile device Qs,a;θ should generate a cooperative caching and transcoding token with the help of the edge device; its value is δi,j=IDVi,j,Mi,j,Ui,j,Bui,t,hi,j, where IDVi,j is the ID of video content Vi,j and hi,j is HIDVi,j, the generated hash value, where the symbol H is the public hash function. After that, the user smart mobile device signs δi,j by signδi,j. The user smart mobile device sends the signature signδi,j and δi,j to the network edge node j. Once the network edge node j receives δi,j, it will firstly use the public key pki,j of the user smart mobile device to verify δi,j. Simultaneously, verify hi,j and implement collaborative caching and transcoding in δi,j. After completing the above process, network edge node j generates the following joint video caching and transcoding transaction:(9)Transaction⟶hi,j,signδi,j,Mi,j,Ui,j,Bui,t,pj.(d)
Recording: after the transaction is completed, the network edge nodej in cluster sends the transaction to the selected smart contract. The network edge node of cluster heads and user group leaders in the network will use the DPoS consensus protocol to record transactions on the blockchain.(e)
Penalty and settlement: at this stage, because the smart contract can monitor the video content transmission service between the user’s smart mobile device and the network edge node, if any of them does not abide by the signed agreement, the penalty function will be called to implement the penalty. Finally, when the smart contract is completed and reaches the service period, financial settlement will be performed and all assets owned by the smart contract will be released.Algorithm 1:Joint video caching and transcoding decision smart contract algorithm.
(1)
Initialization:(2)
Initialize the input dataIDi,j,IDj,Mi,j,Ui,j,Si,j,Bui,t,pj(3)
Initialize statepki,j,ski,j,pkj,skj,dTime,tStamp,cTime(4)
signIDi,j and signIDj on the selected smart contract(5)
Creat:(6)
Output the smart contract address(7)
Input:depositi,j,depositj(8)
Verify:depositi,j≥pj,depositj(9)
Transaction Execution:(10)
Verify the state:t>dTime(11)
Edge cluster asks the video for caching(12)
The selected edge node in edge cluster implements the transcoding task(13)
Edge cluster sends the appreciate video to users(14)
Edge cluster broadcasts collaborative caching and transcoding transaction(15)
Transaction as:(16)
Transaction⟶hi,j,signδi,j,Mi,j,Ui,j,Bui,t,pj(17)
Recording:(18)
Edge node in cluster sends the transaction to the selected smart contract(19)
Edge cluster and users in the network use the DPoS consensus protocol to record transactions on the blockchain(20)
Penalty and Settlement:(21)
Verify the state:t>cTime(22)
Penalty execution:penaltyi,j,penaltyj(23)
Settlement:(24)
IDi,j,depositi,j−pj+penaltyi,j,IDj,depositj+pj+penaltyj


## 5. Problem Formulation and Intelligent Video Caching and Transcoding Scheme

To use deep reinforcement learning algorithm for network resource optimization at the Bl-CMEC system, we used the DQN method to address the joint video caching and transcoding optimization problem.


### 5.1. Problem Formulation

In this paper, the objective function of the joint video caching and transcoding issue is to maximize the expected average reward. Therefore, we model the dynamic optimization problem as a Markov Decision Process, which is(10)maxMt,Ut,Bui,tJt=E∑t=0T−1γtrt,s.t.C1:Mt∈0,1,…,M,∀t,C2:Ut∈0,1,∀t,C3:Bui,t∈B1,B2,…,Bmax,∀t,where γ∈0,1 is a discount factor and rt is the reward at the time stage t in this optimization problem.In general, it is difficult to solve optimization problems with a large number of states in the state space. However, for large-scale optimization problems that do not require any prior knowledge of state transition probability, the DRL algorithm has been proven to be a very effective mathematical tool.


### 5.2. DQN for Intelligent Video Caching and Transcoding Decisions

The basic idea of many reinforcement learning algorithms is to gradually estimate the Q value function by using the Bellman equation as an iterative update, so that this value iterative algorithm converges to the optimalQ value function. Since the advent of the deep Q network [56–58] in 2013, many scholars have chosen to use the DQN algorithm as an algorithm and method to solve practical application problems. The value iteration algorithm to solve the optimal Q value function is as follows:(11)Qi+1s,a=Er+γmaxa′Qis′,a′|s,a.In DQN, Mnih et al. refer to a neural network function approximator with weightsθ as a Q-network, which can be trained by minimizing a sequence of loss functions Liθi that changes at each iteration i.(12)Liθi=Es,a∼ρ⋅yi−Qs,a;θi2,yi=r+γmaxa′Qs′,a′;θi−1|s,a,where yi is the target for iteration i and ρ⋅ is a probability distribution over sequences and actions which we refer to as the behavior distribution.In deep reinforcement learning of DQN method, there are three basic elements, which are the action, state, and reward of the optimization issue. In our joint video caching and transcoding optimization issue, they can be obtained as follows:(13)St=Cbt,Lt,Rt,qt,At=Mt,Ut,Bui,t,rt=ω1CRHslt+λqt−ω2qt−qt−1−ω3Rt−ω4Cbt−ω5Ot,where in the state St, Cbt is the current bandwidth cost, Lt is the current buffer occupancy rate, Rt is the current playback buffer, and qt is the current video quality downloaded during time stage t. Also, the action is selected from the action set At. Lastly, at the reward, the weighted sum of the short- and long-term cache hit rate CRHslt for each step is obtained as(14)CRHslt=CRHst+μ∗CRHlt,where μ is the weight to balance the short- and long-term cache hit rate.In the reward, it is consists of video quality, video quality variation, video playback rebuffering time, and two penalty. Furthermore, the user perceived QoE in video streaming service is directly depended by the total cache hit rate, video quality variation, video quality, and video playback rebuffering time. Symbolsω1,λ1,ω2,ω3,ω4,andω5 are the weighting parameters in the formula.


### 5.3. Intelligent Video Caching and Transcoding Scheme

Our proposed intelligent video caching and transcoding scheme has a series of smart contracts which can acquire self-organization at video caching and transcoding services, especially without a centralized controller. The proposed intelligent video caching and transcoding scheme has two sections, namely, DQN-Based Video Caching and Transcoding Algorithm (DQN-VCT) (section1) and Implementation of Video Caching and Transcoding Decision Smart Contract (section 2).In section1, there are two major factors that support DQN and make it extremely powerful. The two major factors are experience replay and fixed Q-targets. Through these two factors, the correlation between the learning samples is removed, and the learning efficiency of DQN is getting higher and higher.In DQN-Based Video Caching and Transcoding Algorithm (DQN-VCT), the inputs of the deep neural network are the video service system statesSt, which are listed in equation (13), and the outputs of the network are the Q value function, Qs,a;θ for each action are listed in equation (11). Based the method in our previous article [59], we illustrate the details of the DQN-based video caching and transcoding algorithm in section 1 in Algorithm 2.Algorithm 2:Intelligent video caching and transcoding scheme.
(1)
Section 1: DQN-Based Video Caching and Transcoding Algorithm (DQN-VCT)(2)
Initialization:(3)
Initialize the replay memoryD to capacity N(4)
Initialize theQ network and the target Q network with random weights(5)
Initialize MEC network service matrixV of requests(6)
for episode = 1, Mdo(7)
Generate the smart device users’ requests data(8)
Observe initial state s1 as illustrated in equation (13)(9)
fort = 1, Tdo(10)
Give a random probabilityς∈0,1(11)
Choose actionA (t) which listed in equation (13) as At=a∗t=argmaxaQs,a;θ,ς>ε,at≠a∗t,randomly selectat,others.(12)
Observe the rewardr (t), state s (t + 1)(13)
Store the transition (s (t), A (t), r (t), s (t + 1)) into Buffer pool D(14)
Update MEC network service matrixV of requests(15)
Sample random minibatch of transitions (s (t), A (t), r (t), s (t + 1)) from Buffer pool D(16)
Setyj=rj,forterminals′,rj+γmaxa′Qs′,a′;θi−1|s,a,onon-terminals′.(17)
Implement a gradient descent step according to equation (12)(18)
Update the parameters within theQ network(19)
Reset the parameters within the targetQ network every G time stages(20)
end for(21)
end for(22)
Section 2: Implementation of Video Caching and Transcoding Decision Smart Contract(23)
Create SC:(24)
Trigger the smart contract according to the user’s request based on the actionA (t) from Section 1(25)
Execute the SC: carry out the smart contract for managing the transaction process of the intelligent caching and transcoding service(26)
Record the SC: record transactions on the blockchain(27)
Release the SC: the smart contract is released.Then, based on the decision of video caching and transcoding in section1 by the algorithm, the selected edge node in cluster will execute automatically the implementation of video caching and transcoding decision smart contract. The smart contract will be strictly executed according to Algorithm 1.


## 5.1. Problem Formulation

In this paper, the objective function of the joint video caching and transcoding issue is to maximize the expected average reward. Therefore, we model the dynamic optimization problem as a Markov Decision Process, which is(10)maxMt,Ut,Bui,tJt=E∑t=0T−1γtrt,s.t.C1:Mt∈0,1,…,M,∀t,C2:Ut∈0,1,∀t,C3:Bui,t∈B1,B2,…,Bmax,∀t,where γ∈0,1 is a discount factor and rt is the reward at the time stage t in this optimization problem.In general, it is difficult to solve optimization problems with a large number of states in the state space. However, for large-scale optimization problems that do not require any prior knowledge of state transition probability, the DRL algorithm has been proven to be a very effective mathematical tool.


## 5.2. DQN for Intelligent Video Caching and Transcoding Decisions

The basic idea of many reinforcement learning algorithms is to gradually estimate the Q value function by using the Bellman equation as an iterative update, so that this value iterative algorithm converges to the optimalQ value function. Since the advent of the deep Q network [56–58] in 2013, many scholars have chosen to use the DQN algorithm as an algorithm and method to solve practical application problems. The value iteration algorithm to solve the optimal Q value function is as follows:(11)Qi+1s,a=Er+γmaxa′Qis′,a′|s,a.In DQN, Mnih et al. refer to a neural network function approximator with weightsθ as a Q-network, which can be trained by minimizing a sequence of loss functions Liθi that changes at each iteration i.(12)Liθi=Es,a∼ρ⋅yi−Qs,a;θi2,yi=r+γmaxa′Qs′,a′;θi−1|s,a,where yi is the target for iteration i and ρ⋅ is a probability distribution over sequences and actions which we refer to as the behavior distribution.In deep reinforcement learning of DQN method, there are three basic elements, which are the action, state, and reward of the optimization issue. In our joint video caching and transcoding optimization issue, they can be obtained as follows:(13)St=Cbt,Lt,Rt,qt,At=Mt,Ut,Bui,t,rt=ω1CRHslt+λqt−ω2qt−qt−1−ω3Rt−ω4Cbt−ω5Ot,where in the state St, Cbt is the current bandwidth cost, Lt is the current buffer occupancy rate, Rt is the current playback buffer, and qt is the current video quality downloaded during time stage t. Also, the action is selected from the action set At. Lastly, at the reward, the weighted sum of the short- and long-term cache hit rate CRHslt for each step is obtained as(14)CRHslt=CRHst+μ∗CRHlt,where μ is the weight to balance the short- and long-term cache hit rate.In the reward, it is consists of video quality, video quality variation, video playback rebuffering time, and two penalty. Furthermore, the user perceived QoE in video streaming service is directly depended by the total cache hit rate, video quality variation, video quality, and video playback rebuffering time. Symbolsω1,λ1,ω2,ω3,ω4,andω5 are the weighting parameters in the formula.


## 5.3. Intelligent Video Caching and Transcoding Scheme

Our proposed intelligent video caching and transcoding scheme has a series of smart contracts which can acquire self-organization at video caching and transcoding services, especially without a centralized controller. The proposed intelligent video caching and transcoding scheme has two sections, namely, DQN-Based Video Caching and Transcoding Algorithm (DQN-VCT) (section1) and Implementation of Video Caching and Transcoding Decision Smart Contract (section 2).In section1, there are two major factors that support DQN and make it extremely powerful. The two major factors are experience replay and fixed Q-targets. Through these two factors, the correlation between the learning samples is removed, and the learning efficiency of DQN is getting higher and higher.In DQN-Based Video Caching and Transcoding Algorithm (DQN-VCT), the inputs of the deep neural network are the video service system statesSt, which are listed in equation (13), and the outputs of the network are the Q value function, Qs,a;θ for each action are listed in equation (11). Based the method in our previous article [59], we illustrate the details of the DQN-based video caching and transcoding algorithm in section 1 in Algorithm 2.Algorithm 2:Intelligent video caching and transcoding scheme.
(1)
Section 1: DQN-Based Video Caching and Transcoding Algorithm (DQN-VCT)(2)
Initialization:(3)
Initialize the replay memoryD to capacity N(4)
Initialize theQ network and the target Q network with random weights(5)
Initialize MEC network service matrixV of requests(6)
for episode = 1, Mdo(7)
Generate the smart device users’ requests data(8)
Observe initial state s1 as illustrated in equation (13)(9)
fort = 1, Tdo(10)
Give a random probabilityς∈0,1(11)
Choose actionA (t) which listed in equation (13) as At=a∗t=argmaxaQs,a;θ,ς>ε,at≠a∗t,randomly selectat,others.(12)
Observe the rewardr (t), state s (t + 1)(13)
Store the transition (s (t), A (t), r (t), s (t + 1)) into Buffer pool D(14)
Update MEC network service matrixV of requests(15)
Sample random minibatch of transitions (s (t), A (t), r (t), s (t + 1)) from Buffer pool D(16)
Setyj=rj,forterminals′,rj+γmaxa′Qs′,a′;θi−1|s,a,onon-terminals′.(17)
Implement a gradient descent step according to equation (12)(18)
Update the parameters within theQ network(19)
Reset the parameters within the targetQ network every G time stages(20)
end for(21)
end for(22)
Section 2: Implementation of Video Caching and Transcoding Decision Smart Contract(23)
Create SC:(24)
Trigger the smart contract according to the user’s request based on the actionA (t) from Section 1(25)
Execute the SC: carry out the smart contract for managing the transaction process of the intelligent caching and transcoding service(26)
Record the SC: record transactions on the blockchain(27)
Release the SC: the smart contract is released.Then, based on the decision of video caching and transcoding in section1 by the algorithm, the selected edge node in cluster will execute automatically the implementation of video caching and transcoding decision smart contract. The smart contract will be strictly executed according to Algorithm 1.


## 6. Simulation and Analysis

This section contains two parts. First, the experiment settings were illustrated. Then, the experimental simulations were carried out to prove the performance of the proposed scheme.


### 6.1. Experimental Settings

#### 6.1.1. Data Generation

In the experiments, the smart device user data of requests will be generated randomly. The video data of smart device users’ requests were generated under the Zipf function distribution. Different numbers of requests in one episode have been adopted as the testing data, such as 50, 70, and 100. The video data in smart device users’ different numbers of requests were obtained by unchanged popularity distribution, in which the Zipf function parameter is set as 1.3.


#### 6.1.2. Parameters Setting

In the experiments, we deploy 7 MEC network nodes in one cluster, which will serve 30 smart device users in this region and also provide about 50 videos for smart device users’ requests. There are four video layers of the video in the experiment, with the original layer at the MEC node in the cluster asBmax. The video transcoding from Bmax to B1, B2, and B3 will need, respectively, 2, 4, and 6 CPU cycles. Then, we set the parameter in the experiments as given in Table 2.Table 2
Summary of major parameter values.
ParameterValueParameterValueD10 sω30.1β6.5ω40.1α1.3ω50.1μ0.6Bmax10 Mbpsσ1.2B11 Mbpsω11.2B22 Mbpsλ1.2B34 Mbpsω20.9CPU cores2,4,6,8


#### 6.1.3. Deep Neural Network Setting for DQN

In the experiments, a fully connected neural network was adopted, which consists of 2 hidden layers, 256 and 512 in size, respectively. The loss function we used was the mean square error function. The naiveε-greedy strategy was adopted for exploration, in which the probability of randomly choosing an action during the training stage was ε. The degree of exploration continues to shrink when the learning progresses. The size of experience replay in DQN and the learning rate were adopted as 2000 and 0.01. Also, the number 0.90 was chosen as the attenuation parameter which is used to update the target Q network. Then, the batch size in stochastic batch gradient descent was 32. Finally, the experiment simulations were carried out by using Python.


#### 6.1.4. Environment Setting for Blockchain

To assist the simulation experiment, in the simulation implementation of the blockchain, we use Ganache to simulate the operating environment of Ethereum and deploy smart contracts through Truffle. When using Truffle to deploy a smart contract, the network address and network number of the current simulation environment will be used so that Truffle can deploy the smart contract to Ganache’s Ethereum test environment through this interface.


### 6.2. Experimental Simulation Results

In this section, we perform intelligent video caching and transcoding by deep reinforcement learning method in the independent mode. Also, we compare the proposed Bl-CMEC scheme (called Bl-CMEC method) with the CMEC scheme without blockchain technology (called CMEC method). Because of the characteristics of DRL, for the proposed algorithm and compared method, all the reported results would be acquired from the average of 20 algorithm executions.Figure3 shows the convergence performance of DQN-VCT algorithm, which is with the set of full weight at different learning rates. From Figure 3, we can see that the performance of learning rate 0.01 is the best among the three different learning rates. It is better than the performance with learning rate 0.1 and 0.001. Because a large update step will lead the average reward converging to a local optimal solution, convergence performance in learning rate 0.1 becomes worse. Generally, the appropriate learning rate always depends on the real-time state of the environment at the current optimization step.Figure 3
The convergence performance of DQN-based joint video caching and transcoding algorithm with the different learning rates.Figure4 shows the comparison of the QoE value on video streaming service performance with and without blockchain empowerment. It can be seen from Figure 4 that the QoE value of the Bl-CMEC method empowered by the blockchain is slightly worse than that of the CMEC method. This is because the blockchain empowerment introduces a consensus mechanism, which causes a certain time delay, reducing the QoE value of video streaming. Comparing to the CMEC method, blockchain empowerment brings security and privacy protection to video streaming service systems based on edge computing in the Bl-CMEC method. Based on blockchain-enabled framework for CMEC-based video transmission system, the blockchain technology is introduced into CMEC system to ensure the transactions’ transparency, system security, user information privacy, and integrity of the video data.Figure 4
The QoE performance between the Bl-CMEC method and CMEC method with blockchain at CDN tip and 50 requests in an episode.It can be seen from Figure5 that the bandwidth cost performance between the Bl-CMEC method and CMEC method is much similar. At the beginning, the service cost of the two methods is relatively high, but as the learning process continues to advance, the service cost slowly decreases. Although the Bl-CMEC method enabled by blockchain has a higher service cost than the CMEC method in the later stage, overall, the service cost of the Bl-CMEC method enabled by the blockchain is very similar to that of the CMEC method. This is because there is no other cost load that is introduced in the Bl-CMEC method, except time delay comparing to the CMEC method.Figure 5
The bandwidth cost performance between the Bl-CMEC method and CMEC method with blockchain at CDN tip and 50 requests in an episode.In order to better analyze the experimental effect, we give a comparison of the bandwidth cost and the average QoE when the blockchain is placed in different locations. From Figure6, we can see that when the blockchain is set in the CDN tip, the bandwidth cost is slightly higher than that of the other two locations, namely, cluster head and cluster element. This is because when many clusters’ blockchains are set in the CDN tip compared to the cluster head and cluster element, it will cause more bandwidth consumption. Then, it can be easily seen in Figure 7 that as the learning process continues, the position of the blockchain has less impact on the video QoE and tends to be similar.Figure 6
The bandwidth cost performance in the Bl-CMEC method with blockchain at different positions.Figure 7
The QoE performance in the Bl-CMEC method with blockchain at different positions.Then, we analyzed the experimental results when there are different numbers of user requests in an episode. In Figure8, overall, in order to pursue higher video quality at the beginning, the bandwidth cost is higher. When the number of smart device users’ requests in a time slot is 100, the bandwidth cost generated is the largest. With continuous learning, the bandwidth cost is slowly reduced and the balance between bandwidth cost and video QoE is desired. Similarly, it can be directly seen in Figure 9 that different numbers of user requests in an episode have almost no effect on the QoE value. Based on the above experimental results, we can find that the Bl-CMEC method we proposed has better robustness to the Internet environment.Figure 8
The bandwidth cost performance of the Bl-CMEC method in different requests’ numbers at an episode.Figure 9
The QoE performance of the Bl-CMEC method in different requests’ numbers at an episode.Furthermore, the framework and algorithm of this article can withstand the attacks that blockchain technology can withstand, such as encryption cracking, consensus mechanism challenges, 51% attacks, and N@S (nothing at stock) attacks. The discussion of these attacks is well documented in the blockchain theory and technology related literature. Also, the topic of this article is blockchain-enabled intelligent video caching and transcoding in clustered MEC networks, which integrates blockchain technology and applies it into video streaming services based on edge computing to ensure user information privacy and video data security through the distributed storage structure of blockchain. The core point in our paper is how to effectively integrate blockchain technology into intelligent video services in the clustered edge computing environment, on the basis of improving security performance and ensuring the high quality of intelligent video services. Therefore, the discussion of these attacks will not be repeated here.


## 6.1. Experimental Settings

### 6.1.1. Data Generation

In the experiments, the smart device user data of requests will be generated randomly. The video data of smart device users’ requests were generated under the Zipf function distribution. Different numbers of requests in one episode have been adopted as the testing data, such as 50, 70, and 100. The video data in smart device users’ different numbers of requests were obtained by unchanged popularity distribution, in which the Zipf function parameter is set as 1.3.


### 6.1.2. Parameters Setting

In the experiments, we deploy 7 MEC network nodes in one cluster, which will serve 30 smart device users in this region and also provide about 50 videos for smart device users’ requests. There are four video layers of the video in the experiment, with the original layer at the MEC node in the cluster asBmax. The video transcoding from Bmax to B1, B2, and B3 will need, respectively, 2, 4, and 6 CPU cycles. Then, we set the parameter in the experiments as given in Table 2.Table 2
Summary of major parameter values.
ParameterValueParameterValueD10 sω30.1β6.5ω40.1α1.3ω50.1μ0.6Bmax10 Mbpsσ1.2B11 Mbpsω11.2B22 Mbpsλ1.2B34 Mbpsω20.9CPU cores2,4,6,8


### 6.1.3. Deep Neural Network Setting for DQN

In the experiments, a fully connected neural network was adopted, which consists of 2 hidden layers, 256 and 512 in size, respectively. The loss function we used was the mean square error function. The naiveε-greedy strategy was adopted for exploration, in which the probability of randomly choosing an action during the training stage was ε. The degree of exploration continues to shrink when the learning progresses. The size of experience replay in DQN and the learning rate were adopted as 2000 and 0.01. Also, the number 0.90 was chosen as the attenuation parameter which is used to update the target Q network. Then, the batch size in stochastic batch gradient descent was 32. Finally, the experiment simulations were carried out by using Python.


### 6.1.4. Environment Setting for Blockchain

To assist the simulation experiment, in the simulation implementation of the blockchain, we use Ganache to simulate the operating environment of Ethereum and deploy smart contracts through Truffle. When using Truffle to deploy a smart contract, the network address and network number of the current simulation environment will be used so that Truffle can deploy the smart contract to Ganache’s Ethereum test environment through this interface.


## 6.1.1. Data Generation

In the experiments, the smart device user data of requests will be generated randomly. The video data of smart device users’ requests were generated under the Zipf function distribution. Different numbers of requests in one episode have been adopted as the testing data, such as 50, 70, and 100. The video data in smart device users’ different numbers of requests were obtained by unchanged popularity distribution, in which the Zipf function parameter is set as 1.3.


## 6.1.2. Parameters Setting

In the experiments, we deploy 7 MEC network nodes in one cluster, which will serve 30 smart device users in this region and also provide about 50 videos for smart device users’ requests. There are four video layers of the video in the experiment, with the original layer at the MEC node in the cluster asBmax. The video transcoding from Bmax to B1, B2, and B3 will need, respectively, 2, 4, and 6 CPU cycles. Then, we set the parameter in the experiments as given in Table 2.Table 2
Summary of major parameter values.
ParameterValueParameterValueD10 sω30.1β6.5ω40.1α1.3ω50.1μ0.6Bmax10 Mbpsσ1.2B11 Mbpsω11.2B22 Mbpsλ1.2B34 Mbpsω20.9CPU cores2,4,6,8


## 6.1.3. Deep Neural Network Setting for DQN

In the experiments, a fully connected neural network was adopted, which consists of 2 hidden layers, 256 and 512 in size, respectively. The loss function we used was the mean square error function. The naiveε-greedy strategy was adopted for exploration, in which the probability of randomly choosing an action during the training stage was ε. The degree of exploration continues to shrink when the learning progresses. The size of experience replay in DQN and the learning rate were adopted as 2000 and 0.01. Also, the number 0.90 was chosen as the attenuation parameter which is used to update the target Q network. Then, the batch size in stochastic batch gradient descent was 32. Finally, the experiment simulations were carried out by using Python.


## 6.1.4. Environment Setting for Blockchain

To assist the simulation experiment, in the simulation implementation of the blockchain, we use Ganache to simulate the operating environment of Ethereum and deploy smart contracts through Truffle. When using Truffle to deploy a smart contract, the network address and network number of the current simulation environment will be used so that Truffle can deploy the smart contract to Ganache’s Ethereum test environment through this interface.


## 6.2. Experimental Simulation Results

In this section, we perform intelligent video caching and transcoding by deep reinforcement learning method in the independent mode. Also, we compare the proposed Bl-CMEC scheme (called Bl-CMEC method) with the CMEC scheme without blockchain technology (called CMEC method). Because of the characteristics of DRL, for the proposed algorithm and compared method, all the reported results would be acquired from the average of 20 algorithm executions.Figure3 shows the convergence performance of DQN-VCT algorithm, which is with the set of full weight at different learning rates. From Figure 3, we can see that the performance of learning rate 0.01 is the best among the three different learning rates. It is better than the performance with learning rate 0.1 and 0.001. Because a large update step will lead the average reward converging to a local optimal solution, convergence performance in learning rate 0.1 becomes worse. Generally, the appropriate learning rate always depends on the real-time state of the environment at the current optimization step.Figure 3
The convergence performance of DQN-based joint video caching and transcoding algorithm with the different learning rates.Figure4 shows the comparison of the QoE value on video streaming service performance with and without blockchain empowerment. It can be seen from Figure 4 that the QoE value of the Bl-CMEC method empowered by the blockchain is slightly worse than that of the CMEC method. This is because the blockchain empowerment introduces a consensus mechanism, which causes a certain time delay, reducing the QoE value of video streaming. Comparing to the CMEC method, blockchain empowerment brings security and privacy protection to video streaming service systems based on edge computing in the Bl-CMEC method. Based on blockchain-enabled framework for CMEC-based video transmission system, the blockchain technology is introduced into CMEC system to ensure the transactions’ transparency, system security, user information privacy, and integrity of the video data.Figure 4
The QoE performance between the Bl-CMEC method and CMEC method with blockchain at CDN tip and 50 requests in an episode.It can be seen from Figure5 that the bandwidth cost performance between the Bl-CMEC method and CMEC method is much similar. At the beginning, the service cost of the two methods is relatively high, but as the learning process continues to advance, the service cost slowly decreases. Although the Bl-CMEC method enabled by blockchain has a higher service cost than the CMEC method in the later stage, overall, the service cost of the Bl-CMEC method enabled by the blockchain is very similar to that of the CMEC method. This is because there is no other cost load that is introduced in the Bl-CMEC method, except time delay comparing to the CMEC method.Figure 5
The bandwidth cost performance between the Bl-CMEC method and CMEC method with blockchain at CDN tip and 50 requests in an episode.In order to better analyze the experimental effect, we give a comparison of the bandwidth cost and the average QoE when the blockchain is placed in different locations. From Figure6, we can see that when the blockchain is set in the CDN tip, the bandwidth cost is slightly higher than that of the other two locations, namely, cluster head and cluster element. This is because when many clusters’ blockchains are set in the CDN tip compared to the cluster head and cluster element, it will cause more bandwidth consumption. Then, it can be easily seen in Figure 7 that as the learning process continues, the position of the blockchain has less impact on the video QoE and tends to be similar.Figure 6
The bandwidth cost performance in the Bl-CMEC method with blockchain at different positions.Figure 7
The QoE performance in the Bl-CMEC method with blockchain at different positions.Then, we analyzed the experimental results when there are different numbers of user requests in an episode. In Figure8, overall, in order to pursue higher video quality at the beginning, the bandwidth cost is higher. When the number of smart device users’ requests in a time slot is 100, the bandwidth cost generated is the largest. With continuous learning, the bandwidth cost is slowly reduced and the balance between bandwidth cost and video QoE is desired. Similarly, it can be directly seen in Figure 9 that different numbers of user requests in an episode have almost no effect on the QoE value. Based on the above experimental results, we can find that the Bl-CMEC method we proposed has better robustness to the Internet environment.Figure 8
The bandwidth cost performance of the Bl-CMEC method in different requests’ numbers at an episode.Figure 9
The QoE performance of the Bl-CMEC method in different requests’ numbers at an episode.Furthermore, the framework and algorithm of this article can withstand the attacks that blockchain technology can withstand, such as encryption cracking, consensus mechanism challenges, 51% attacks, and N@S (nothing at stock) attacks. The discussion of these attacks is well documented in the blockchain theory and technology related literature. Also, the topic of this article is blockchain-enabled intelligent video caching and transcoding in clustered MEC networks, which integrates blockchain technology and applies it into video streaming services based on edge computing to ensure user information privacy and video data security through the distributed storage structure of blockchain. The core point in our paper is how to effectively integrate blockchain technology into intelligent video services in the clustered edge computing environment, on the basis of improving security performance and ensuring the high quality of intelligent video services. Therefore, the discussion of these attacks will not be repeated here.


## 7. Conclusions

In this paper, we firstly proposed a blockchain-enabled CMEC-based video transmission system model (Bl-CMEC) that could ensure the transactions’ transparency, system security, user information privacy, and integrity of the video data, enhance the ability of severs in actively caching popular video content in the CMEC system, and realize transcoding function at network edge nodes. In addition, we proposed an intelligent video caching and transcoding scheme. A smart contract is specially designed which can acquire self-organization at video caching and transcoding services, especially without a centralized controller. Furthermore, we adopted a DQN-based framework to automatically obtain the intracluster joint video caching and transcoding decisions. Finally, the experimental results were presented to validate the effectiveness of the proposed method.Based on the model of Bl-CMEC system, this paper mainly focuses on ensuring video data security and user privacy protection and also encouraging the collaboration among MEC network nodes in one cluster. In this model, the DPoS consensus protocol was used in video transmission application scenarios. In the future work, we will perform intelligent video caching and transcoding by using the deep reinforcement learning method in the federated mode, and more efficient consensus mechanism algorithms need to be proposed to meet the special needs of video transmission application scenarios.



---

*Source: 7443260-2021-09-08.xml*