## 4 System Methodology
### Proposed System Workflow
#### 4.2.2 Phase 2: Registration and Key Generation
#### 4.2.4 Phase 4: Release Block Data

In the blockchain network, the nodes keep a distributed ledger in which meters' public keys and hashed identities are recorded. Each data entry in the ledger represents the association between meters and their hash values. In addition, nodes on the blockchain replicate the ledger among themselves so that any node can verify if a public key belongs to a specific meter. With the continuous transaction, the shared ledger becomes progressively larger. Hence, after a specific period, the block data are transferred to the MDMS along with the corresponding \(HID_{SMi}\). MDMS verifies \(HID_{SMi}\) and decrypts it using its private key \(Pr_{MS}\) to obtain the original meter data. ## 5 Implementation and Performance Analysis

The purpose of this section is to assess the effectiveness and improvements of the proposed blockchain-enabled distributed AMI secure communication scheme, in comparison with other cryptography and blockchain-based studies. The performance is analyzed numerically by computing the communication cost (bits) and the time cost (ms). Section 5.3 \begin{table}
\begin{tabular}{l} \hline \hline
**Transaction Header** \\ \hline Encrypted usage report, E(UD) = \(\{Pr_{SMi}\) (UD \(|\ |\ \tau\))\(\}\); \\ Hash of E(UD); \\ Sender’s hash identity, \(HID_{SMi}\); \\ ECDSA signature, \(Sig_{SMi}\); \\ Timestamp, \(\tau\); \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Transaction format of smart meter’s electricity usage data. discusses in detail the estimating of these two parameters, which are essential to determining whether the proposed system is lightweight or not. Additionally, a discussion of some informal security properties was also provided to assess the proposed system's security risk. ### Experimental Environment

We conducted the experiments on an HP ProBook 440G7 with 1.60 GHz Intel Core i5-102100U processor, Intel HD UHD Graphics, 8 GB RAM, and Windows 10 operating system. We set up the blockchain platform HyperLedger Fabric using Docker Engine and Docker Compose. The smart contract code snippets are written using JavaScript programming language in Visual Studio Code. ### Dataset Description

We used the \"Smart Meter in London\" dataset from Kaggle [30] to evaluate the performance. This dataset contains electricity usage records collected from 5567 households in London from November 2011 to February 2014. ### Communication and Time Cost Analysis

#### 5.3.1 Communication Cost

Each smart meter only stores its corresponding asymmetric ECC key pairs, public key of MDMS, and generates ECDSA signature in the proposed system. For this purpose, the secp256k1 curve was chosen to produce ECC keys, which have a length of the 256-bit private key (\(L_{Pt}\)) and 257-bit public key (\(L_{Pt}\)). Similarly, the generated ECDSA signature has a size of 512-bits (\(L_{sign}\)) [31]. Moreover, a timestamp of 64-bits (\(L\tau\)) was also appended while performing the corresponding operations. Therefore, the total communication bit cost (\(Bit_{tot}\)) for each smart meter is:

\[Bit_{tot}=L_{sign}+(L_{PtSMi}+L_{PtSMi})+L_{PtMS}+L\tau\]

\[=[512+(257+256)+257+64]\,\mathrm{bits}\]

\[=1346\,\mathrm{bits}\,\,(\equiv\!\!0.16825\,\mathrm{Kb})\]

Generally, a smart meter has a maximum storage of 3 Kb [17], where the proposed scheme requires only 0.168 Kb, which is acceptable. #### 5.3.2 Time Cost

To analyze the time cost of each smart meter, from the collected dataset archive, \"halfhourly_dataset\" was chosen. This file has 112 blocks of electricity usage data of 112 unique smart meters. Each of these blocks contains a total record of 10,48,576 rows and three columns, namely, LCLid (meter ID), tstp (timestamp), and energy (measured in kWh/hh). For convenience, we took the first five blocks: Block1, Block2, Block3, Block4, and Block5 for the experiment, which collected a total record of 424,552 kWh, 365,857 kWh 252,237.9 kWh, 244,846.1 kwH, and 290,359.9 kWh, respectively, over a period of 30 min.