# Efficient Resource Allocation in Blockchain-Assisted Health Care Systems
## 4 Proposed Technique
### Allocation of Data Blocks to Mining Machines
#### 4.2.1 Algorithm for Load Balancing
The patient data were divided into three types as per their sensitivity. These data blocks were assumed to be of the same size and generated at different time intervals. The initiated data blocks were time-stamped and increased every second.The LBM manages the allocation of data to the fog mining nodes. The number of fog mining nodes and the capacity of their cache is variable. Similarly, the frequency of the data blocks that are sent to the fog mining nodes is also variable. The parameters used in the simulation are presented in Table 4.

The proposed \(ESM_{HCS}\) for the LBM allocates the received nonce requested blocks of data to the associated mining nodes. The performance of \(ESM_{HCS}\) was evaluated with the state-of-the-art Delay Sensitive Patients' Data for Smart Cities Healthcare System (\(DPS_{HCS}\)) technique [33] and the well-known round-robin algorithm. The performance analysis considered a wide variety of scenarios with different frequencies and sizes of data, as well as different numbers of mining nodes. The caching capacity of all the mining machines was considered to be the same and each mining node was assumed to cache three data blocks in its memory pool before computing its hashing values. Figures 3 and 4 show the data successfully assigned to the fog nodes for the different data block requests received and fog mining nodes. For comparison, the performance of the \(DPS_{SHS}\) and round-robin algorithms is also presented. \begin{table}
\begin{tabular}{c c} \hline
**Simulation Parameter** & **Used Value** \\ \hline Coverage area of fog mining nodes & 1500 m \\ \hline Fog mining node to patient sensor distance & 50-1500 \\ \hline Number of blocks of data requests for LBMs & 5:5:30 \\ \hline Number of LBMs & 1 \\ \hline Number of mining machines associated with each LBM & 2–4 \\ \hline Number of mining nodes & 3:2:9 \\ \hline caching capacity of each mining machine to cache data block (MBs) & 3000 \\ \hline data block size (MBs) & 200-1000 \\ \hline Number of blocks of data with high sensitivity & 2:2:10 \\ \hline Number of blocks of data with medium sensitivity & 2:2:10 \\ \hline Number of blocks of data with low sensitivity & 2:2:10 \\ \hline \end{tabular}
\end{table} 
Table 4: Values of the parameters used in the simulation. \begin{table}
\begin{tabular}{c c c c c c c c c} \hline \hline \multirow{3}{*}{**Data Blocks**} & \multicolumn{8}{c}{**Maximum Caching Capacity (7)**} \\ \cline{2-9}  & **0** & **1** & **2** & **3** & **4** & **5** & **6** & **7** \\ \cline{2-9}  & **0** & **0** & **0** & **0** & **0** & **0** & **0** & **0** \\ \hline \(A\) & 0 & 200 & 200 & 200 & 200 & 200 &



The results shown in Figure 3 were obtained at different intervals when the number of data block requests received by the LBM had an incremental trend of 5 requests from 0 to 30 requests. The LBM had to forward these block requests to only one mining machine. The results show that the LBM allocated more data blocks to mining machines compared to the other two schemes when the number of data block requests was more than 20 and it did not allocate data blocks at any stage from its competitors. The same trend was observed when the number of fog mining nodes was variable, as shown in Figure 4. The results were observed for varying sizes of 30 data blocks. The results showed that the proposed \(ESM_{HCS}\) always allocated a greater number of blocks of data in comparison to the other techniques. As the number of fog mining nodes was increased to 6, all three schemes allowed the LBM to allocate all data blocks, because the caching capacity increased due to the increased number of mining nodes. This was because the LBM in the proposed scheme allocated data blocks by applying the 0/1 knapsack algorithm and through an optimal assignment of data to the fog mining nodes. To observe the data block allocation according to the sensitivity levels, results were generated for different numbers of data requests and different numbers of fog mining nodes.