## 5 Experimental Environment
### Implementing NFTs in the Hyperledger Fabric Network to Tokenize the Patient Record  
The NFT for patient records was implemented using the Go programming language within the HLF network's chain code directory. The chain code files described below encapsulated the core logic for handling patient records and access permissions.  
* **patient-contract.go**: The patient-contract.go file contains the main logic for managing patient records as NFTs and defines their structure and behavior, including metadata attributes such as the patient ID, medical history, and associated access controls.
* **token.go:** The token.go file complements the patient-contract.go file by implementing the NFT token functionality, including token minting, transfer, and access permission management.  
A predefined set of collaborators was established to ensure secure and authorized access to patient NFTs. This collaborator set comprises registered healthcare professionals across multiple institutions, including hospitals and laboratories.  
* **Hospitals** (e.g., hospital1, hospital2, hospital3): registered doctors within these hospitals are designated as collaborators, enabling them to request access permission for specific patient records within their respective institutions.
* **Laboratories** (e.g., lab1, lab2): similarly, lab scientists affiliated with designated laboratories are included in the collaborator set, allowing them controlled access to patient data for diagnostic and research purposes.  
\begin{table}
\begin{tabular}{c c} \hline \hline
**Hardware Specifications** & **Software Specifications** \\ \hline \hline  & Hyperledger Fabric v2.x \\  & Docker Engine v24.0.5 \\  & Docker Compose v1.29.2 \\ Operating System: Ubuntu 20.04 LTS & Hyperledger Caliper v0.6.0 \\ CPU: 12 th Gen Intel® CoreTM & Npm v5.x \\ i9-12950 HX\(\times\)24 & Git 2.9+ \\  & Go 1.11 \\  & Python v2.7.x \\  & Visual Studio v17.11 \\ \hline \hline \end{tabular}
\end{table}
Table 3: Hardware and software specifications of the experiment.  
The NFT implementation incorporates a robust access control mechanism where authorized collaborators can request access permissions for specific patient records. Access requests trigger a permission verification process within the chain code, ensuring only validated collaborators can retrieve or update patient information. Algorithm 1 presents a comprehensive, step-by-step guide for implementing NFIs, outlining the specific procedures and methods involved in the process.  
```
//Setup HLF Network
1 InitializeHLFnetwork(version = 2.4, nodeVersion = 14.17.0)
2 configureEntities(entities = [\"hospital\", \"hospital\", hospital3\", \"lab1\", \"lab2\", \"MoH\"]) //Deploy chain codes
3 deployChaincodes(chaincodes = [\"doctor_contract.go\", \"patient_contract.go\", \"patient_checkup.go\", \"patient_health.data.go\", \"token_contract.go\"])
4 deployPatientNFT(tokenContract = \"token_contract.go\") //Create collaborator set for access permission for patient NFT createCollaboratorSetCollaborators = [\"registered doctors in hospital1/hospital2/hospital3\", \"lab scientists in lab1/lab2\"]) //Request access permission for patient NFT
6 searchPatients(criteria)
7 requestAccessPermission(healthcare_entity, patient)
8 If(healthcare_entity in collaborators)then
9 sendAccessRequest(patientID) //For Patient.
10 AccessRequestReceived(healthcare_entity ID)
11 PermissionRevoked(healthcare_entity ID) //For healthcare_entity
12 RecordViewed(patientID) or RecordUpdate(patientID)
13 updatePatientNFT(patientID, accessGranted)
14 commitTransactionToBlockchain(transaction)
15 else
16 Reject access request for patient data
17 logUnauthorizedAccessAttempt(healthcare_entity ID)
18 endif
19 recordTransactions(transcationHistory, CouchDB)
```  
**Algorithm 1**HLF Network Setup and Patient NFT Access Control