# Towards an Optimized Blockchain-Based Secure Medical Prescription-Management System
## 5 Experimental Results
### Energy Consumption Comparison  
Choosing the appropriate consensus algorithm to achieve efficient energy consumption in IoT devices is crucial for several reasons such as the energy constraint, the scalability, the resource constraints, and the latency consideration. As mentioned in Section 4.1, both Quorum and Ethereum are based on the Ethereum blockchain, but there are several key differences between them. Ethereum is a more general-purpose blockchain platform with a larger developer community and more established ecosystem and currently uses a Proof of Work (PoW) consensus mechanism. In comparison, Quorum is a specialized platform with enhanced privacy features and a modified version of the practical Byzantine fault tolerance (PBFT) consensus mechanism. The difference in the network architectures between these two blockchains can lead to differences in energy consumption. However, the energy consumption of a blockchain network depends on many factors, including the number of nodes in the network, the computing power of each node, and especially, the specific implementation of the consensus algorithm. It is important to mention here that, in a blockchain network, a node refers to any device or computer that is connected to the network and participates in the validation and propagation of transactions and blocks. In this paper, the energy consumption measurement of a node implemented in the IoT system (Raspberry Pi) is addressed for two different types of consensus mechanisms, namely the PoW and QBFT, to decide which one is more appropriate for IoT applications. Hence, this comparison test consisted of three phases:  
1. Measuring the Raspberry Pi power while the DApp is implemented with the Ethereum blockchain based on PoW consensus. 2. Measuring the Raspberry Pi power while the DApp is implemented with the Quorum blockchain based on QBFT consensus. 3. Comparing the power consumption between both cases. The energy consumption of a transaction in a blockchain network can vary based on a number of factors such as the complexity of the transaction, the gas price, the network congestion, and the network size. The scale of deployment used for this comparison test was 3 nodes for the Ethereum network, as well as for Quorum, since QBFT consensus requires a threshold of 2/3 of the total validator nodes to reach consensus. So, the minimum scale was used here, but it is important to mention that having more nodes in the Quorum network increases fault tolerance and makes the network more resistant to attacks or failures. For the Ethereum network, we conducted experiments using a mining difficulty set to 0x2000, representing a moderately challenging level for miners in the network. Figure 6 presents the nodes' implementation in each case. The distribution of the nodes is as follows:  
* Two nodes were implemented on a PC, with the processor features of an Intel(R) Core(TM) i5-7200U CPU @ 2.50 GHz 2.70 GHz with 8 GB of RAM;
* The third, which is the node dedicated to testing, was implemented on a Raspberry Pi 3 model B+ with a 64-bit OS and 1 GB of RAM. To measure energy consumption in IoT devices, which is the Raspberry Pi in this DApp, a USB voltage- and current-detection module was used, as presented in Figure 7. It is a simple tester displaying the voltage present on the USB connector and showing the current consumption of the attached USB devices. The voltage measured by the USB power detector can be in the range of 3-9 V, while the intensity is measured in the range of 0-5 A. In this experiment, the Raspberry Pi is powered by 5.21 V/2.5 A, and its consumption is estimated to be 500 mA on average. After implementing the three nodes, each scenario begins with the first transaction, which involves deploying the smart contract. Subsequently, the different functions presented in Table 2 are executed while measuring the power consumption of the Raspberry Pi for each operation. The procedure was repeated 10 times for each transaction to ensure  
Figure 6: Implementation of three-node blockchain network.