## 3 Materials and Methods
### Blockchain Transaction Lifecycle and Chaincode Execution  
This section explains how transactions are executed among stakeholders using the \"execute-order-validate\" mechanism of Hyperledger Fabric, which ensures both traceability and trust in distributed environments. The proposed Hyperledger Fabric-based system continuously records and stores all activities and events related to the transaction in the immutable ledger of the blockchain. First, all participants must identify and authenticate their identities using digital certificates and cryptographic functions through MSP. The MSP component handles identity management and permission control for all actors in the network. All stakeholders are registered and identified by the health authority in the peer-to-peer blockchain network. When user registrations such as patients, cleaning teams, hygiene teams, etc., are made, each is assigned a chaincode address and ready to perform transactions on the network. A transaction request, such as patient room assignment, is sent to the endorsement peers determined according to the blockchain's endorsement policy. The system consists of various parameters, including patient identity information, the list of transactions to be performed, the chaincode identifier; a one-time random number; and the transaction proposal identifier, according to the MSP. The algorithm describes a chaincode in which transaction activities are represented as different functions. This stage is called the endorsement phase or proposal phase. Designated peers, as specified in the endorsement policy, simulate the transaction by executing the chaincode without committing it. This ensures compliance with network rules and enhances protection against unauthorized actions. These peers validate the transaction and, if the results are correct, sign and return the outcome. The execution results are encrypted in output format and recorded along with the cryptographic signatures of the endorsing peers. This resulting message is called an endorsement. This validation mechanism not only ensures transaction correctness but also reinforces system-level security. Figure 3 illustrates two core chaincode functions in pseudocode format, representing typical interactions such as patient registration and routine room cleaning. The chaincode designed for patient registration efficiently handles the processes of registering patients in the blockchain and managing room allocation. By first confirming whether the patient is previously registered and verifying room availability, the system ensures that patient and room information are accurately recorded on the blockchain, facilitating the seamless and effective management of both. Figure 4 shows the sequence diagram provides a comprehensive overview of the blockchain processes involved. Furthermore, the routine cleaning operations, governed by a specialized chaincode, ensure that patient rooms are cleaned in a consistent, transparent, and reliable manner. All cleaning requests and routine cleaning activities are timestamped and securely stored on the blockchain, ensuring data integrity and traceability. Figure 4 illustrates how patients are registered in a blockchain-based system in healthcare services and how this process is securely executed. The patient registration process begins with the creation of the patient's identity information, health status, and room allocation details. When a new patient is added to the system, a unique identifier is generated for the patient, and an electronic certificate (E-Cert) is requested. This certificate is issued by a local certification authority (Local CA) integrated into the blockchain network and assigned to the patient. Once the certificate is created, the patient registration verification process is initiated by the hospital's endorser nodes. In this process, the patient's information is transmitted to designated endorser nodes according to the blockchain's endorsement policy and undergoes a verification process.