# FODIT: A Filter-Based Module for Optimizing Data Storage in B5G IoT Environments
## 2 Background
### Filters
Query algorithm (\(Q_{a}\)): This algorithm performs the data query operation in the FODIT module. Let \(z\) be the data item to be retrieved from \(SP\). The algorithm takes \(z\) as input and invokes the search function \(SF\), as described in Algorithm 2, to check for the presence of \(z\) in the cuckoo filter \(CF[b]\). If \(z\) is found in the filter, it can be retrieved from \(SP\); otherwise, \(z\) is not present in \(SP\). The complete process is summarized in Algorithm 5. ```
1:Input : Data \(Dc\), \(CF[b]\), \(SP\);
2:Output : Updated \(CF[b]\) and \(SP\) with unique data;
3:function\(I_{a}(Dc\), \(CF[b]\), \(SP)\)
4:for each \(x\in Dc\)do
5:if SF(\(x\), \(CF[b]\)) = not found \(\wedge\)\(SP=DLT\)then
6: Store \(x\) in \(AuxS\)
7:if\(x\) is recorded in DLT then
8:\(result\leftarrow\) Cr(\(x\), \(CF[b]\));
9: Delete \(x\) from \(AuxS\);
10:endif
11:else
12:\(result\leftarrow\) Cr(\(x\), \(CF[b]\));
13:if\(result\leftarrow\) Done then
14: Store \(x\) in \(SP\);
15:else
16:if\(result\) = Failure then
17:handle insertion failure;
18:endif
19:endif
20:endif
21:endfor
22:endfunction
```

**Algorithm 4** Insertion Algorithm \(I_{a}\)

### Integrating FODIT in Phonendo

To illustrate a practical use case, we present the integration of the FODIT module within a real-world framework called _Phonendo_[25] (see Figure 4). Phonendo is an open-source framework designed to support the configuration and deployment of trustworthy smart environments. Its modular architecture and open-source nature enable straightforward customization and extension, allowing developers to easily adapt the framework to specific use cases by incorporating new modules. One such example is CertifIoT [46], which builds upon Phonendo to provide a solution for data certification by combining IoT and DLT technologies. Although Phonendo was originally conceived to facilitate seamless integration with DLTs, it can also function independently, without requiring data to be published to a DLT. The Phonendo architecture is composed of the following components:

* _Reader_: Responsible for establishing connections with various IoT devices and collecting their data. * _Manager_: Acts as the orchestration layer of the framework, coordinating all services and managing the data flow. * _Verifier_: Verifies the integrity of incoming data and appends a digital signature to ensure its authenticity before storage. * _Storage_: Handles the persistence of the system state, which can be managed either locally, DB, or via a cloud-based storage service, DaaS. * _Publisher_: Oversees the management of data streams, verifying their digital signatures and publishing validated data to a DLT when required. As shown in Figure 4, the FODIT module is integrated between the _Manager_ and the _Storage_ components. This placement allows FODIT to be consulted before any insertion, query, or deletion operation is performed on the selected storage system (DB, DaaS, or DLT), effectively preventing the storage of redundant data and thereby improving overall system efficiency. As previously described, Phonendo's _Storage_ module supports integration with different types of storage backends, including DB and DaaS. In the case of DLT, data is first stored locally as a backup before being published to the distributed ledger. This is why FODIT does not need to be placed between the _Manager_ and the _Publisher_. ## 6 Evaluation

In this section, we will detail the case studies conducted to evaluate our hypothesis: _\"the utilization of filters optimizes the storage of data generated in IoT environments, avoiding the storage of duplicate data and improving query time.\"_ The obtained results are also discussed, highlighting the impact of FODIT compared to traditional B5G IoT systems. ### Case Studies

To evaluate our hypothesis, we conducted two case studies to assess the improvements achieved by avoiding redundant data storage and the time saved when querying non-stored data.