# Blockchain-Based Resource Allocation Model in Fog Computing
## 1 Introduction  
### Background  
In recent years, with the continuous development of intelligent terminals and wireless network technology, we have entered the new era of the Internet of Everything from the interconnection of people and things, and the interconnection of things and things [1]. More and more data is generated and distributed in this huge and complex network environment, bringing unprecedented pressure on computing services. The traditional cloud computing model cannot meet not only the heterogeneous, low delayed, and dense access networks but also the use of various applications for intelligent terminal users. In order to solve this problem, Cisco's [PERSON] et al. proposed a new computing paradigm in 2011 (i.e., fog computing) [2]. This model deals with the addition of a foglayer between the terminal device and the traditional cloud server to afford computing, storage, and network services. The main aim is to relocate some core functions of the cloud to the \"near\" location of the network edge, to overcome the defects of cloud computing regarding location awareness, mobility support, and real-time interaction [3; 4]. As an enlargement of cloud computing, fog computing is alike to cloud computing, since it is also a network-based computing model that provides data sharing, computing, storage, and other services through fog nodes on the Internet. Fog computing is a processing environment with widely distributed deployment, confronted with relatively concentrated cloud computing. Data storage and processing are more dependent on edge devices, so users of fog computing usually pay a certain fee to get more effective services. The device that provides the computing service can get a particular reward by providing its redundant computing resources [5]. Nevertheless, fog computing, as an emerging computing model, has brought new problems and challenges to the computing service field due to its \"fog node as a resource provider\" [6]. Considering that the fog computing environment has the features of restricted resources, wide distribution, heterogeneous network, and selfish fog computing nodes, the proper management of these characteristics in fog nodes has become one of the main aims focus in the fog computing research field [7]. On the one hand, the income and cost of the fog node when contributing resources are often not excellently balanced; on the other hand, the cloud service provider lacks an effective incentive mechanism to promote the continuous and stable contribution of the fog node. Given the above problems, many scholars have carried out research and discussion [8; 9; 10; 11], and some progress has been made. However, there are still many problems that restrict the extensive application of fog computing. As a consequence, it is necessary to seek emerging technologies and methods to solve the above difficulties. Acknowledging the success and increasing popularity of digital cryptocurrencies such as bitcoin [12], blockchain technology is gradually emerging. Its core advantage can use data encryption, timestamp, distributed consensus, and economic incentives in the node without mutual trust in the implementation of a distributed system based on a point-to-point decentralized credit trading, coordination, and cooperation. These characteristics can solve issues related to the centralized organization, the prevalence of high cost, low efficiency, and data storage [13]. The blockchain system generally consists of a data layer, a network layer, a consensus layer, an incentive layer, a contract layer, and an application layer [14]. The data layer is used to construct data blocks, encrypt and sign data, and add timestamps. The network layer includes distributed peer-to-peer networks for communication and data verification between nodes. The consensus layer implements various consensus algorithms such as Proof of Work (PoW) [15] and Proof of Stake (PoS) [16] or Delegated Proof of Stake (DPoS) [17].