# Hybrid Quantum-Classical Deep Neural Networks Based Smart Contract Vulnerability Detection
## 4 Experiment
\begin{table}
\begin{tabular}{c c c c c c c} \hline \hline \multirow{2}{*}{**Tool**} & **Access** & \multirow{2}{*}{**Arithmetic**} & **Front** & \multirow{2}{*}{**Reentrancy**} & **Time** & **Denial** & **Unchecked** \\  & **Control** & & & **Running** & & **Manipulation** & **of Service** & **Low Calls** \\ \hline Mythril & 1057 & 18,220 & 1953 & 8343 & - & - & - \\ Osiris & - & 13,409 & - & - & 1432 & - & - \\ Oyente & - & 33,631 & - & - & 1403 & - & - \\ Securify & - & - & 7023 & 1915 & - & - & - \\ Slither & 2260 & - & - & 8507 & - & 2484 & - \\ Smartcheck & - & 6993 & - & - & - & 11,198 & 2484 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Tools with over 1000 vulnerabilities. TF-IDF-based feature vectors were created using contract texts and vulnerability reports, and a model was trained. The dataset was divided into 80% training and 20% testing. In the training phase, TF-IDF features were provided to the proposed HQCDNN architecture, and the results were compared. In the ML algorithm, we relied on \"default\" parameters. Our proposed HQCDNN architecture consists of three basic layers:  
The classical dense layer, where the features in the dataset are initially larger than the size of the quantum circuits. The number of qubits used in a quantum circuit is 2 due to current hardware and simulation constraints. Therefore, a dense layer is used to reduce the size of the data to make it a suitable input to the quantum layer. At this stage, a non-linear transformation of the data is achieved by applying the ReLU activation function. The Quantum Circuit (Quantum Node) Layer is located at the center of the hybrid structure, where a quantum circuit with learnable parameters is run. In the study, the PennyLane library is used and the simulation device default.qubit is preferred with 2 qubits. This device simulates the quantum circuit in software without access to the actual hardware. The general flow of the quantum circuit is as follows:  
* Angle Embedding: Low-dimensional features of classical data are encoded into qubits as rotation angles with Rx, Ry, or Rz gates. Angle Encoding transforms classical \begin{table}
\begin{tabular}{c c c c c} \hline
**Tool** & **Arithmetic** & \begin{tabular}{c} **Front** \\ **Running** \\ \end{tabular} & **Reentrancy** & \begin{tabular}{c} **Denial** \\ **of Service** \\ \end{tabular} \\ \hline \begin{tabular}{c} Mythril \\ Osiris \\ \end{tabular} & 6624 & - & - & - \\ \hline \begin{tabular}{c} Mythril \\ Oyente \\ \end{tabular} & 17,117 & - & - & - \\ \hline \begin{tabular}{c} Mythril \\ Securify \\ \end{tabular} & - & 1028 & - & - \\ \hline \begin{tabular}{c} Mythril \\ Slither \\ \end{tabular} & - & - & 3910 & - \\ \hline \begin{tabular}{c} Mythril \\ Smartcheck \\ \end{tabular} & 23,513 & - & - & - \\ \hline \begin{tabular}{c} Osiris \\ Oyente \\ \end{tabular} & 12,622 & - & - & - \\ \hline \begin{tabular}{c} Osiris \\ Smartcheck \\ \end{tabular} & 1998 & - & - & - \\ \hline \begin{tabular}{c} Oyente \\ Smartcheck \\ \end{tabular} & 5237 & - & - & - \\ \hline \begin{tabular}{c} Slither \\ Smartcheck \\ \end{tabular} & - & - & - & 2171 \\ \hline \begin{tabular}{c} Mythril \\ Osiris \\ Oyente \\ \end{tabular} & 6284 & - & - & - \\ \hline \
\begin{tabular}{c} Mythril \\ Oyente \\ Smartcheck \\ \end{tabular} & 2135 & - & - & - \\ \hline
\begin{tabular}{c} [PERSON] \\ Oyente \\ \end{tabular} & 1815 & - & - & - \\ \hline \end{tabular}
\end{table} 
Table 3: The number of vulnerabilities marked in common by the same tools. data into quantum states by applying rotations on the Bloch Sphere, as shown in Figure 3, with each data feature represented as a rotation on the quantum state vector [22]. This approach enables classical data to be processed by quantum systems, leveraging quantum properties like superposition and entanglement to enhance model performance [23]. * Entangling Layer: By creating entanglement between qubits (e.g., gates such as CNOT), as shown in Figure 4, hidden correlations in the data are blended with the superposition properties of quantum mechanics.