| Algorithm 2. BSF-EHR Doctor and Insurance Agent Blockchain Formation and Block Addition | ||
| Input | : | Referred patient block from the patient blockchain |
| Output | : | Doctor Doc1 Blockchain formation and Add blocks to Doctor Doc1 Blockchain and Insurance Agent IS1 Blockchain formation and Add blocks to Insurance Agent IS1 Blockchain |
| Step 1 | : | Block ← Doctor Doc1 and Insurance Agent IS1 can download his referred patient Block from the patient blockchain using the private key. |
| Step 2 | : | Block → Retrieve encryptedEHR, Hash with Bilinear Map from Block |
| Step 3 | : | Decrypt encryptedEHR based on Private Key → EHR |
| Step 4 | : | Doctor Doc1 and Insurance Agent IS1 can access this EHR |
| Step 5 | : | Create Genesis block for Doctor Doc1 blockchain using doctor name, password and doctor ID and Create Genesis block for Insurance Agent IS1 blockchain using insurance agent name, password and insurance agent ID |
| Step 6 | : | Block ← Put encryptedEHR, hash with Bilinear Map |
| Step 7 | : | Add this Block to Doctor Doc1 Blockchain and Insurance Agent IS1 Blockchain |
| Step 9 | : | Insurance Agent IS1 provides the Lump-sum payment for the treatment of covered illness. This amount is transferred to the particular patient block |