# A Novel Approach for Fraud Detection in Blockchain-Based Healthcare Networks Using Machine Learning
## 3 Proposed System
### Second Stage: Classifying Transactions inside the BC  
To train the model, the second stage uses the same ML algorithms and Ethereum fraud detection dataset [25]. This stage checks the transactions to determine whether it is normal or malicious data. If it is a normal transaction, it is stored in the blockchain. Otherwise, (i.e., it is an attack) will be blocked and marked as a novel attack and sent to the attacks database (see Figure 3). There are several steps that start from receiving data from the application layer and end with storing the transaction in the blockchain as follows:  
7. Receive data: The blockchain node acts as a mediator between the application layer and the blockchain network. When an application layer sends data to the blockchain node, the node receives the data and verifies its validity;
8. Analysis transactions: To validate a transaction in a blockchain network, digital signatures are created using the sender's private key, and each receiving node verifies them using the sender's public key. The NODEID of each node in the network is compared to the broadcasting node to ensure authenticity, and timestamps may be used as well. Transactions that fail any of these checks are rejected and not added to the blockchain;
9. Transaction classification: it consists of two subsections as follows:  
* Transaction classification using a marked attacks database creates a catalog of known attack patterns to identify and classify transactions, preventing fraudulent  
Figure 2: The first stage of the proposed system.  
transactions in the blockchain. Characteristics such as transaction type and timestamp are used to check transactions against the database and flag them as high-risk (blocked) or low-risk;
* The proposed system using machine learning can automate the transaction classification process, allowing for fraud detection, transaction monitoring, and optimization of the blockchain network. It collects and processes transaction data, extracts relevant features, trains and evaluates the model, and deploys it in real time.
* Transactions can be stored in the blockchain depending on their classification as normal or abnormal. Normal transactions are added to the blockchain by nodes after validation;
* Abnormal transactions flagged as high-risk are blocked and sent to the database of marked attacks. The database is continually updated to protect against new threats, maintaining the integrity of the blockchain system.  
Machine learning (ML) models are used in the first stage to classify the collected data that comes from patients as normal or abnormal. The second stage also checks the transactions for normal or malicious. Normal transactions are stored in the blockchain, while abnormal (malicious) transactions are blocked and marked as new attacks. The process begins with receiving data from patients and ends with storing transactions in the blockchain. Figures 4 and 5 also describe the architecture and workflow of the proposed system, which illustrates the all-whole stages of the proposed system as mentioned above.  
Ultimately, the use of ML in blockchain-based smart healthcare can detect user behavior anomalies and prevent attacks by analyzing activity patterns and monitoring data integrity. ML can also develop predictive models using historical data to identify potential threats before they occur, thereby enhancing security and protecting sensitive patient data.  
Figure 3: The second stage of the proposed system.  
Figure 4: The architecture of the proposed system.  
Figure 5: The workflow of the proposed system.