# Efficient Resource Allocation in Blockchain-Assisted Health Care Systems
## 1 Introduction  
Smart cities are developing rapidly, as they ease human lifestyles by overcoming the challenges faced by rapidly growing cities. Thus, they are considered the future of urban development. Smart cities offer several benefits, including safe transportation, a green environment, and efficient healthcare [1, 2, 3]. Furthermore, smart cities empower citizen engagement, with sustainable development and increased economic growth. The use of technological advancements such as the Internet of things (IoTs) further augments smart-city applications. Most smart city applications comprise IoT devices that are ubiquitously connected. These IoT devices produce a large amount of data that are forwarded and stored in remotely located cloud servers [4, 5]. Storing and retrieving this data from a remote cloud server is time-consuming and not suitable for time-constrained applications. To meet these limitations, fog computing is emerging rapidly, by placing a single or group of computing nodes at the edge of the network, avoiding the Internet backbone [6, 7, 8, 9]. Transferring IoT node data to these fog computing nodes on the same network is quick compared to transferring data to a multi-hop remote server. That is why fog computing nodes are preferred over the cloud in delay-sensitive applications and for emergency services such as in health care [10, 11]. In smart cities and health care systems, the patient's vital sign data need to be sent to medical consultants for online monitoring, as well as being necessary for online treatment. Unreliable and error-prone transfer of vital sign data may cause loss of human life. Due to wireless data communication, the chances of errors in data increase. This requires a foolproof and secure data transfer mechanism, such as blockchain technology. Blockchain technology is developing rapidly and has been used in many applications over the last decade [12; 13; 14]. It consists of a large number of decentralized and immutable data blocks that are cryptographically secured. Each block is assigned a unique identification number and contains time-stamped data. All blocks are connected and contain the encrypted hash values of the previous and next data blocks [15; 16]. In this way, all blocks are linked together and any change in one of the data blocks is communicated to the whole system and can easily be retrieved, as presented in Figure 1.  
Blockchain technology has immutability features that avoid alteration of data, and the time-stamped data of each block are kept permanently [17; 18]. In addition, it supports secure and swift data storage. A secure hash algorithm (SHA-256) is used to calculate the hash function and achieve the required cryptography. Miners placed in different locations compute a nonce (number only used once) to determine an encrypted hash value that must be within a specific range. Blockchain technology is used in various health care applications, such as in medical equipment procurement and health monitoring [19; 20; 21]. Blockchain technology comprises multiple mining nodes to authenticate a valid block [22; 23]. A data block is validated once the mining node computes a valid SHA-256-based hash value. A mining node uses different nonce values to compute that a certain 256-bit has a value that is within the specified range. In smart cities, fog computing nodes can be placed at different locations to act as mining nodes, as shown in Figure 2. This facilitates quick delivery of patients' data due to their proximity, instead of mining the data block from remotely placed mining servers. At the same time, computing a specific hash value using a different nonce is a time-consuming process and may result in unnecessary delays, which could cause a serious threat to life for patients. The motivation for this work was to improve the nonce computing time through efficient allocation of computing resources to mining nodes. It should be noted that, once the nonce is computed to generate the desired hash function in the blockchain, a block is created and broadcast to the network.