# Synergy of Blockchain Technology and Data Mining Techniques for Anomaly Detection
## 6 Discussion  
Following the previous section which depicted the features of applications considered in our study systematically, we provide an overall discussion and extraction of key elements that define the taxonomy of data mining methods used for analysing blockchain data. We defined the following levels:  
* Level 1: Data extraction,
* Level 2: Data preprocessing, \begin{table}
\begin{tabular}{l} \hline \hline
**Application/Method** \\ \hline Deep Hashing \\ Deep Learning \\ Federated Learning \\ GAN \\ Supervised Learning \\ Isolation Forest \\ KNN \\ XGBoost \\ \hline \hline \end{tabular}
\end{table} 
Table 10: IoT fraud detection. * Level 3: Data mining,
* Level 4: Evaluation and visualisation of results. The first level is tailored to the raw data that are stored in blockchain. Here, we are confronted with data retrieval from blockchain. As we have already mentioned, blockchain technology, where a set of valid transactions form a block and a set of blocks that satisfy the consensus protocol that are added to the ledger, brings the benefits of transparency, immutability and consistency of data [21]. Nevertheless, the features that offer these benefits are the ones that include several challenges with regard to data management. Searching and retrieving data in blockchain-based systems is not straightforward. It is time and money consuming, since it requires additional programming efforts. Blockchain is optimised for storage and not for searching and retrieving data as is the case with traditional databases. Therefore, the biggest obstacles to enabling the efficient retrieval are: decentralisation and data distribution, lack of query language, data confusion and entanglement and limited APIs [21; 169]. At the moment there are several efforts underway to try to provide more efficient and reliable data access, such as supporting faster querying using a centralised indexing server to copy blockchain data (e.g., Etherscan), or proposing an SQL-like query language (e.g., Ethereum Query Language (EQL)) to provide general purpose querying [21]. Let us mention that many of the research papers skipped the step of data retrieval, due to using publicly available datasets where this step had already been performed. In addition to the raw data stored in the blockchain, in some studies [74; 124; 141] raw network traffic was collected to detect certain anomalies within the blockchain network. Specifically, the needed traffic information was added to the data set and, if necessary, converted into different formats. On the other hand, some created network and scenario simulations to generate the needed data [59; 66; 76; 106; 128; 132; 140; 150; 161; 165; 166]. The simulations included malicious nodes, traffic flows, etc. Smart contracts were obtained from sources such as HONEYBADGER [49], Ethereum [48] and Etherscan [56; 57]. The collected smart contracts are mostly in bytecode, which is converted into opcode for further processing [49; 117; 118; 157]. The data are stored mostly on the blockchain, or collected from the blockchain or its network. Some authors [83; 97] used blockchain to store the data collected from a data set or sensors, while [PERSON] et al. [97] also tested the storage of data on the blockchain versus using a classical method of storage, and their results showed more significant latency when using blockchains. Additionally, NoSQL databases were used to store the data retrieved from the blockchain for easier processing [81], while [PERSON] et al. [101] tested whether it was better to keep all the data on the chaincode, or to combine the chaincode with the Oracle web service. Another way to store data is using a CSV file [127; 149; 153] because of its simplicity and ease of further processing. The second level deals with the preprocessing of the retrieved data. Usually, data preparation is one of the most complex processes, that involves data cleaning, missing data estimation, feature selection, and several data transformations.