# Towards an Optimized Blockchain-Based Secure Medical Prescription-Management System
## 5 Experimental Results
### Energy Consumption Comparison
obtaining results as precise as possible, and the deviation between executed transactions was about 3 min. The power measured in watts is calculated using Equation (1). \[W=A\times V \tag{1}\]  
where **W** represents power, **A** represents current intensity, and **V** represents voltage (V = 5.21 v in this case). Table 2 includes the acquired readings and calculations of Raspberry Pi power consumption (measured in watts) obtained from the experiments. Figure 8 illustrates also a comparison of both results. \begin{table}
\begin{tabular}{l l l l} \hline \hline
**Transaction** & \multicolumn{2}{l}{**Power Consumption (Watts)**} & \multicolumn{2}{l}{**Improvement**} \\ \cline{2-4}  & **Ethereum** & **Quorum** & \\ \hline Contract deployment & 2.71 & 2.50 & 8.4\% \\ addPharmacist() & 3.03 & 2.92 & 3.77\% \\ addPresc() & 2.92 & 2.81 & 3.91\% \\ updatePresc() & 2.92 & 2.71 & 7.75\% \\ addDrugMA() & 2.71 & 2.61 & 3.83\% \\ newServedQQ & 2.82 & 2.71 & 4.06\% \\ getPresc() & 2.29 & 2.29 & 0\% \\ fakeBlock & 2.71 & 2.61 & 3.83\% \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Energy consumption measurement for Ethereum and Quorum implemented on Raspberry Pi. Figure 8: Energy consumption (measured in watts) comparison between Ethereum and Quorum. Figure 7: Energy consumption measurement using USB voltage- and current-detection module. As shown in Table 2, the improvement of Quorum reached 8%, which is an important value considering that the number of transactions is over a hundred per second for the Quorum blockchain. This experiment validated our expectations that the Quorum blockchain is more energy efficient in IoT devices than Ethereum with a remarkable difference. Quorum consensus eliminates the energy-intensive mining process associated with PoW algorithms, thereby significantly reducing the energy consumption, and consequently, the costs will be reduced. This contribution demonstrates that the energy consumption of blockchain technology varies and depends on the consensus mechanism used and that using blockchain technology with non-PoW consensus, such as QBFT consensus, may substantially mitigate sustainability issues in IoT systems. However, the use of the Quorum blockchain, particularly PBFT consensus, showed better energy efficiency and performance. In addition, PBFT creates a new node faster than PoW consensus, which may indicate that it is more viable for the IoT environment. The outcomes of this experiment also reveal that both the type and number of parameters in a smart contract function have an impact on energy consumption. Indeed, as is shown in Table 2, for example, the energy consumption of the transaction addPrec(), which has nine parameters, was approximately 2.71 w, whereas the addDrugMA() function with only four parameters consumed 2.61 w. A difference of 0.1 w becomes significant when considering the entire blockchain network, particularly in scenarios involving approximately 1000 transactions per second (tps). We can also notice that, the more parameters a function has, the more computational power is required to execute it, and thus, the more energy is consumed, as presented in Figure 9.  
Furthermore, the number of parameters can also affect the size of the data that need to be stored on the blockchain, which can in turn affect the energy consumption. When data are stored on a blockchain, they need to be replicated across all nodes in the network, which, in turn, can increase the energy consumption of the system. Consequently, optimizing the implemented smart contract, particularly in terms of the parameters, can improve the energy consumption in the Quorum network more and more.