# Blockchain-Driven Generalization of Policy Management for Multiproduct Insurance Companies
## 4 Solution Approach
### Anchoring Protocol: Merkle Trees  
The most immediate anchoring mechanism to the network would be through a smart contract. In it, the complete policy model would be represented directly. The main problems we might encounter with this initial approach are:  
* Size and Complexity: Inserting large volumes of data directly can lead to performance and efficiency issues, affecting execution speed. * Model Changes: Updating or correcting data in a part of the contract can be complicated and costly. This is because each modification requires a new transaction, which, with this model, involves the entire dataset of the contract or policy. * Code Security: The larger the contract, the more attention must be paid to code security. Including errors or vulnerabilities in the contract's logic can create serious issues in policy management. * Data Queries: Performing complex queries and analyses on large volumes of data stored directly in the contract requires processing all of it. It would be more efficient to only act on the necessary data. To avoid this situation, we propose using Merkle trees as the insertion mechanism into the Blockchain network. Figure 3: Policy modeling. Practical approaches have been made where Merkle trees are used as a data protection mechanism for medical records instead of a full-scale Blockchain approach [21], as well as implementations where they serve as the insertion mechanism for training models for fault detection in IoT [22]. Merkle trees are an efficient data structure that provides a secure mechanism for verifying the integrity of large datasets used in cryptography and distributed systems. They were designed by [PERSON] in 1979. Merkle trees are binary hash trees where each leaf node represents a piece of data, and each internal node represents the concatenation of the hash values of its child nodes. The root of the tree, known as the Merkle root, represents the unique cryptographic summary of all the data stored in the tree. The verification or data search process when using Merkle trees is conducted as follows:  
1. Obtain the Root Hash: This represents a summary of all the data. 2. Calculate Intermediate Hashes: To verify a specific piece of data, its hash is calculated and compared with the hash stored in the tree's leaf node. It is not necessary to process all the data. 3. Trace the Verification Path: Starting from the data's hash, trace the path from the leaf node to the root hash, calculating the intermediate hashes at each step. 4. Compare with the Root Hash: Finally, the root hash calculated from the verification path is compared with the root hash stored on the Blockchain. If they match, the data are valid and has not been tampered with. Each time a transaction affecting a policy is made, the corresponding Merkle tree is updated to reflect the changes. Authorized entities, such as insurance companies, clients, and processors, can verify the complete integrity of the data by checking the Merkle root stored on the blockchain. With this in mind, an insertion mechanism into the Blockchain network has been implemented based on Merkle trees instead of directly embedding the model of each policy within the smart contract. The advantages of this approach are as follows:  
* Flexibility and Scalability: By representing each specific piece of policy data--such as the type of insurance, policy status, policyholder, etc.--through a Merkle tree, the system can easily adapt to any type of policy without limitations. Only the necessary data to represent that policy are stored in the tree. In contrast, with a standard smart contract, all types of data must be integrated from the outset, regardless of whether they are used. * Granularity: More precise and detailed verifications can be performed on the data of a specific policy without the necessity to consider all of the client's policy data, thereby improving the system's transparency and reliability. * Integrity: With smart contracts, detecting a hash discrepancy indicates that something has changed, but it does not reveal what has changed.