# IoT Blockchain Data Vercity with Data Loss Tolerance
## 2 Materials and Methods
### Overview of IoT with Edge Computing and Blockchain
#### 2.2.1 Peer-to-Peer (P2P) Network and Secured Distributed Storage in IoT Blockchain
The IoT blockchain transaction data publishing, storage and replication are evaluated with the edge computing modeled by Raspberry Pi. A unique address identification that is valid within the IoT blockchain is assigned to an IoT blockchain node when it is connected to the IoT blockchain P2P network. IoT blockchain node addresses are unique in ensuring data authenticity. When transaction data is collected, the IoT blockchain node must be granted permission to publish it to the data stream. The publisher ID is the transaction owner's unique node address on the IoT blockchain stream. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Component** & **Type** & **Description** \\ \hline Publisher & String & \begin{tabular}{c} Node address of the transaction owner. \\ Unique identifier of the transaction owner. \\ \end{tabular} \\ \hline Key & String & \begin{tabular}{c} IoT transaction key between 1–256 bytes. \\ Unique key identifier for transaction index, \\ reference and retrieval \\ \end{tabular} \\ \hline Data & String & \begin{tabular}{c} IoT transaction data \& datetime. \\ Actual transaction data and its timestamp. \\ Size up to 64 MB minus item’s overhead. \\ \end{tabular} \\ \hline Confirmations & Integer & \begin{tabular}{c} Depth of the transaction sitting in the blockchain. \\ Default parameter \\ \end{tabular} \\ \hline Blocktime & Integer & \
\begin{tabular}{c} Block time stamp number. \\ Default parameter. \\ \end{tabular} \\ \hline Txid & String &
\begin{tabular}{c} Transaction ID. Unique identifier of \\ the transaction \\ \end{tabular} \\ \hline \hline \end{tabular}
\end{table} 
Table 5: IoT blockchain stream item format. The IoT blockchain stores the transaction key in the \"key segment\" of the stream. Likewise, the IoT transaction value is stored in the \"data segment\". Figure 4 depicts transaction data flow in the IoT blockchain. Transaction data collected are formatted into a stream format. Each row of the IoT blockchain transaction data is no more than the maximum characters in length, so it first has to convert each transacted data into an individual string using the literal characters and then publish each string to the data stream with its own key, followed by the data value. Appendix A Algorithm A2 depicts the publishing transaction data into an existing IoT blockchain data stream consisting of the following steps: (i) convert each transacted data that complies with the stream item format and (ii) publish each transacted data as a separate transaction with key and data value as an item. This algorithm was tested with the Raspberry Pi. Evaluation was conducted in publishing, storing and replication of transaction data. It is briefly described in the following steps:  
1. Create an IoT blockchain named upt-stream01, to store sensors' transaction data;
2. Ubuntu sh script to capture Raspberry Pi core processor temperature (simulate temperature sensor) and publish to upt-stream01;
3. Convert the transaction data into IoT blockchain stream item format;
4. Publish transaction data with command: multichain utp-stream01, replication will be autocratically done to IoT blockchain nodes;
5. Traverse nodes, compare the transacted data in the node traversed and ensure the transacted data is secured in nodes. Figure 5 shows the process flow of transaction data secured in distributed IoT blockchain nodes. All nodes have the same replication of the transaction data, creating secured distributed storage and redundancy. Figure 4: IoT blockchain transaction data flow.