# OpticalTrust: A Sensor-to-Blockchain Framework Using Free-Space Optical Communication
## 3 Methodology
### Decentralized Storage System  
A decentralized storage system is employed for the purpose of storing and overseeing data by utilizing the combined storage capabilities of a network of storage devices rather than relying on a single server or control centre [38; 39]. The primary goal of the decentralized storage system is to deliver resilient and secure methods of data storage by harnessing the capabilities of blockchain technology [40]. The primary constituents of the decentralized storage system for this study are:  
* Blockchain Network: Blockchain is a decentralized system that combines numerous nodes to collectively maintain a database of transactions occurring within the network [41]. The blockchain network possesses essential qualities such as decentralization, immutability, transparency, and enhanced security in comparison to traditional systems. * Smart Contract: A self-executing protocol, colloquially termed a \"smart contract\", is a digitally encoded covenant inscribed within a distributed ledger infrastructure [42]. It is designed to be self-executing without the involvement of any other entity. The primary objective of smart contracts in decentralized storage is to achieve autonomous execution, ensuring that data remain tamper-proof once deployed on the network, and facilitating secure and transparent transactions [43]. * IPFS: To manage and store a huge amount of data in a decentralized manner, the Interplanetary File System (IPFS) is utilized. IPFS facilitates the storage and sharing \begin{table}
\begin{tabular}{c c} \hline \hline
**Design Parameters** & **Values** \\ \hline Laser Power & 34.1 dBm \\ Frequency & 1552.52 nm \\ Attenuation & 0.2 dB/km \\ Bit Rate & 8 GB/s, 12 GB/s, 16 GB/s, 20 GB/s \\ Range & 5, 10, 15, 20 and 25 km \\ EDFA Length & 10 m \\ \hline \hline \end{tabular}
\end{table} 
Table 1: FSOs configuration parameters. of files through a peer-to-peer network [44]. IPFS has been implemented in diverse industries, such as creating offline-native productivity tools, ensuring restrictions for files, accelerating activity, providing an eternal home for digital artwork, releasing scientific findings, facilitating data transparency in Web3, and even storing data beyond Earth. According to the architecture shown in Figure 1, the image obtained from the optical spectrum analyzer is stored in the system. The user transmits images to the backend system for processing. The backend obtains the image and uploads it to IPFS, a decentralized storage system that enables the storage and retrieval of files across a distributed network of nodes. Once the image is posted to the IPFS, it is given a distinct content identifier (CID), which functions as a hash of the image data. This CID serves as an enduring and unchangeable identifier for the image stored on the IPFS. Once the image is successfully uploaded to the IPFS, the backend engages with a smart contract that has been established on the blockchain. The smart contract is tasked with storing the metadata linked to the uploaded image. The backend transmits a transaction to the smart contract, encompassing pertinent information such as the IPFS CID, user information, timestamp, and any more essential metadata. It also verifies the transaction and records the metadata on the blockchain. Subsequently, the transaction that encompasses the image metadata is extracted and incorporated into a block on the blockchain. In this specific instance, Ganache serves as the blockchain network. Ganache [45] is a decentralized application development environment that emulates the functionality of an actual blockchain network. After the transaction is processed and included in a block, the image metadata becomes a permanent and unchangeable part of the blockchain record. During the process of retrieving an image, a user submits a request to the system along with image metadata using a smart contract. The smart contract provides the IPFS CID linked to the image. By utilizing the IPFS CID, the user can retrieve the authentic picture data from the IPFS network.