Leveraging Ethereum Platform for Development of Efﬁcient Tractability System in Pharmaceutical Supply Chain

: Consumer knowledge of the goods produced or processed by the numerous suppliers and processors is still relatively low due to the growing complexity of the structure of pharmaceutical supply chains. Information asymmetry in the pharmaceutical sector has an effect on welfare, sustainability, and health. (1) Background: In this respect, we wanted to develop a productive structure for a pharmaceutical supply chain that satisﬁes the consumer information needs and fosters consumer conﬁdence in the pharmacy goods they buy. By using blockchain technology, the main goals were to develop and implement a pharmaceutical supply chain. (2) Objectives: The main objectives of this work were to leverage an Ethereum platform for the development of a tractability system in a pharmaceutical supply chain environment and to analyze the efﬁciency of MSMAChain with respect to the cost and execution of transactions based on our designed smart contracts. (3) Results: This research looked into a variety of issues related to the value, viability, and effects of blockchain technology for use in supply chain applications. The methods and creations in this environment were monitored and researched. It is vital to identify a number of crucial subjects including future research areas, in order to achieve the widespread acceptance of the supply chain traceability provided by blockchain technology. (4) Conclusions: MSMAChain, an Ethereum blockchain-based approach, leverages smart contracts and decentralized off-chain storage for efﬁcient product traceability in terms of the cost and execution of transaction for a health care supply chain.


Introduction
A supply chain is the whole process of making and delivering goods and services, from obtaining the raw materials to providing the finished products to the end users.A product or service's whole manufacturing process may be traced back to its supply chain.Everything from the activities at each stage of the production process to the information exchanged and the conversion of raw materials into useful forms is included.The supply chain for generic goods starts with the sourcing and processing of basic ingredients.The raw materials are subsequently delivered by a logistics service provider to a supplier, who serves as the wholesaler in this arrangement [1].The unfinished product is created by going through additional steps of processing at a factory, or more frequently, at several factories.Manufacturers, suppliers, and pharmacy benefit managers (PBMs), to name a few, are all important parts of the pharmaceutical supply chain.Pharmaceutical companies have a lot on the line in this intricate process.When medications are given incorrectly, it had a detrimental influence on a company's reputation, customer satisfaction, and prospective profit.The Kaiser Family Foundation's study indicates that a poorly functioning supply chain might impede patient recovery and have serious negative effects on the general public's health.The pharmaceutical supply chain is experiencing numerous challenges including supply chain visibility [2], medication fraud, cold-chain transportation, and escalating prescription drug prices, which might significantly raise the patients' out-of-pocket costs.The most important strategic product in any health care system is medicine.In today's health-conscious culture, supply chain management for medications is becoming increasingly challenging.It takes into account the desire to save human lives as well as the participation of several stakeholders including drug manufacturers and distributors, wholesalers and distributors, customers, and information service providers.However, only a few studies on pharmaceutical supply chains are currently available.
Pharmaceutical companies, key participants in the medicine supply chain, face a variety of threats.Because of these risks, pharmaceutical businesses are unable to supply their goods in a timely manner in the right quantity and quality, or to the right market.Price inflation has played a role, but newer, more effective medicines are also to blame for recent increases in prescription costs.When money is put into making new medicines, the whole health care system saves money.The rising use of drugs, especially more recent ones, has resulted in both an increase in longevity and a decrease in impairment.The advantages of many major conditions that affect elders greatly outweigh the costs.The level of care delivered may be significantly impacted by even modest improvements in drug treatment.Chronic illness, disability, and an aging population will be the main drivers of future health care spending [3].Pharmaceutical innovation will be necessary for effective answers to this issue.There will soon be additional alternatives for individualized therapy that is accessible to elderly individuals as a result of the rapid increase in our knowledge of the genetic and molecular causes of disease.This is anticipated to result in significant advancements in the diagnosis, prognosis, and treatment of a wide variety of costly, fatal, and disabling ailments affecting the elderly in the United States.The extent to which a patient's pharmaceutical demands are covered must be taken into account by October to assess whether a drug benefit program is suitable for older patients.Policies that support the accessibility of rare pharmaceuticals may have a significant positive impact on treatment outcomes, life quality, cost control, and ongoing research expenditures for new and more effective treatments.
A sequencing flowchart is used in Figure 1 to show the supply chain of a pharmaceutical firm.The diagram shows the complicated steps that are taken to develop medicine, produce it, and then provide it to the patient.It explains how medicine gets to hospitals, pharmacies, and doctors by going through wholesalers, distributors, and retailers.The involvement of players such as the government and insurance providers as well as how pharmaceuticals are distributed via the supply chain can be found by using different colored arrows.All of the information is presented in a logical way and in the form of flowcharts so that it is easy to understand.A color-coded diagram of the supply chain is used to make it easier to grasp.

Major Contributions
First of its kind, this survey paper provides comprehensive coverage of the blockchain applications throughout the supply chain.Our most significant contributions to this field are outlined here.o An Ethereum-based private permissioned blockchain platform, namely, MSMAChain for Pharmaceutical Supply Chain (PSC), was proposed, which uses off-chain data storage and Ether as a transactional currency.o The deployment of blockchain technology in the PSC is driven by the necessity for drug traceability.o A decentralized app (dApps) for efficient drug tractability was developed, through which Ethereum smart contracts were presented in seven different aspects.The efficiency of MSMAChain with respect to the cost and execution of transactions based on our designed smart contracts was also analyzed.o A brief security analysis of the blockchain-based developed platform was also performed by considering the integrity, accountability, authorization, availability, nonrepudiation, and MITM attack as evaluation parameters.

Paper Organization
The rest of this paper is structured as follows.Section 2 reviews the current supply chain traceability methods.The goal is to provide readers with a basic understanding of blockchain technology Section 3 focuses on the research methods used and the solutions suggested by this article.In Section 4, a detailed overview of the findings as well as a discussion is presented.The conclusions and future works of this paper are reported in Section 5.

Literature Review
Many people will benefit from the use of blockchain technologies in the health care industry including doctors, nurses, RD specialists, health care companies, and biological researchers.These people will have more privacy protection and stronger security while being able to communicate vast amounts of data, share clinical skills, and express ideas.If blockchain technology can be used successfully in clinical settings in the health care

Major Contributions
First of its kind, this survey paper provides comprehensive coverage of the blockchain applications throughout the supply chain.Our most significant contributions to this field are outlined here.
An Ethereum-based private permissioned blockchain platform, namely, MSMAChain for Pharmaceutical Supply Chain (PSC), was proposed, which uses off-chain data storage and Ether as a transactional currency.The deployment of blockchain technology in the PSC is driven by the necessity for drug traceability.A decentralized app (dApps) for efficient drug tractability was developed, through which Ethereum smart contracts were presented in seven different aspects.The efficiency of MSMAChain with respect to the cost and execution of transactions based on our designed smart contracts was also analyzed.A brief security analysis of the blockchain-based developed platform was also performed by considering the integrity, accountability, authorization, availability, nonrepudiation, and MITM attack as evaluation parameters.

Paper Organization
The rest of this paper is structured as follows.Section 2 reviews the current supply chain traceability methods.The goal is to provide readers with a basic understanding of blockchain technology Section 3 focuses on the research methods used and the solutions suggested by this article.In Section 4, a detailed overview of the findings as well as a discussion is presented.The conclusions and future works of this paper are reported in Section 5.

Literature Review
Many people will benefit from the use of blockchain technologies in the health care industry including doctors, nurses, RD specialists, health care companies, and biological researchers.These people will have more privacy protection and stronger security while being able to communicate vast amounts of data, share clinical skills, and express ideas.If blockchain technology can be used successfully in clinical settings in the health care industry, it would definitely open up new research opportunities for biomedical research.On the other hand, using safe, secure, and scalable collection, storage, and exchange of clinical data in applications for precision medicine will help to find ways to diagnose and treat diseases.For neural-control systems, a digital brain might be stored on a blockchain.
The application of blockchain technology in neurotechnology, which is currently in the experimental stage, has only been verified by a small number of companies.In this study, the authors in [4] proposed a number of options.It is no secret that blockchain technology is popular right now.A wide range of possible applications including data management, financial services, cyber security, the Internet of Things (IoT), and even the food science industry is receiving a growing amount of attention.There is a lot of interest in the application of blockchain technology to provide safe and secure health care data management.Blockchain may be able to help in the future by merging all of the patient's real-time clinical data into an advanced safe health care setup to provide personalized, authentic, and secure health care.This article discusses both the existing and potential developments in health care using blockchain as a paradigm.The author also discusses the applications of blockchain in real-world settings as well as its drawbacks and future prospects.
Regarding this topic, the study by [5] discussed many solutions.Pharmaceutical companies have struggled to track their products as they move through the supply chain since the beginning of this decade.This has given counterfeiters the opportunity to flood the market with knockoffs of popular medicines.Illegally made drugs are an extremely large barrier for the pharmaceutical industry worldwide.The analysis indicates that bogus medications cause pharmaceutical companies in the United States to lose somewhere between USD 100 billion and USD 300 billion annually [6].These drugs come with a range of additional possible health hazards, and the patients who use them may not recover from their illnesses.A World Health Organization (WHO) study found that around one in ten of the drugs that individuals in underdeveloped countries took into their bodies were of a substandard or fraudulent form [7].As a result, we require a system that can trace and track the supply of medicines at every level in order to combat the problem of counterfeiting.With blockchain technology, the supply chain system can be managed and monitored very efficiently.In this paper, we developed a novel system for the administration and recommendation of drug supply chains based on machine learning and blockchain technology (DSCMR).
Several alternatives were put forth in [6].Transactions are secure and dependable because of the use of cryptographic principles.In recent years, blockchain technology has become more popular [7], partly due to the rapid ascent of cryptocurrencies such as Bitcoin and Ethereum.Blockchain technology [8][9][10][11][12] has great promise for the health care industry, which must adopt a far more patient-centered strategy, integrate fragmented systems, and improve the accuracy of electronic health records (EHRs).Therefore, the purpose of this thorough review was outlined in this study, and an examination of the most current advancements in blockchain-related health care research was conducted.The objective of this paper was to shed light on the numerous potential uses of the technology as well as to address the hurdles and opportunities confronting blockchain research in the medical profession.A thorough explanation of the study methodology is provided after a review of some of the basic background information.A bibliometric summary will come after an assessment of the data's characteristics, the quality of the literature, and the qualities of the data.The results of the investigation will subsequently be discussed.Blockchain technology is being used by an increasing number of health care institutions to manage health data, distribute information about patient records, and keep track of who has access to what; anything else happening is quite improbable.Frameworks, architectures, and models are typically presented in research as distinctive structural designs, however, most of the reviewed publications did not include the technical details about the blockchain components used.
The authors in [13] suggested a number of ideas.The health care supply chain is a sophisticated network of related organizations and sectors that supports the daily delivery of essential services.Erroneous data, a lack of transparency, and a lack of data traceability are all potential negative consequences as a result of the system's inherent complexity [14][15][16][17][18][19][20].In addition to endangering human health, supply chain restrictions for counterfeit drugs can result in considerable financial losses for the health care industry.In light of this, a recent study emphasized the requirement of effective pharmaceutical supply chain tracking from the beginning to end.To ensure product safety and weed out fakes, pharmaceutical items need an end-to-end tracking system.There are issues with data privacy, transparency, and authenticity in health care supply chain contexts since the bulk of track-and-trace systems currently in use are centralized [21][22][23][24][25]. Here, the authors outlined a method for efficient product tracing in the health care supply chain using the Ethereum blockchain, smart contracts, and decentralized off-chain storage.A smart contract keeps an immutable record of all transactions, eliminating the need for middlemen, and guaranteeing data provenance.The system architecture and detailed algorithms covered here serve as the guiding principles for the approach proposed in this paper.In order to establish whether this system will be effective at enhancing supply chain traceability, it was tested and validated, and we performed a cost and security analysis.
Blockchain is a safe, decentralized database that can work without a central authority or supervisor.Blockchain creates a growing, continuous list of ordered information called blocks to create a digital ledger [26] on a distributed, peer-to-peer network.A cryptographically signed block containing each transaction is then automatically verified by the network.In [27], the authors presented the fundamentals of blockchain technology and showed how it could be used in the health care sector today and in the future.Due to their ability to send information securely between nodes and networks from the access point [28] and to make sure that transactions are safe, blockchain technologies can offer ways to meet the needs of today.At the moment, it is clear that the exchange of medical data is slow, imperfect, unsafe, and focused on the provider [29][30][31][32][33][34][35].These problems, which come from a lack of basic, structural, and semantic interoperability, make it hard for the data to be shared.Using blockchain technology with the right identifiers can help keep patient data safe while it is being sent from one place to another.Therefore, we examined how blockchain technology may be applied to mobile health care applications.A comparative analysis of the state-of-the-art related studies are described in Table 1.

Based on blockchain
Ethereum smart contracts were not presented.

Based on Ethereum
There was limited size of kB (kilobyte) block size for the blockchain-network so it cannot be used for the large scale traceability of PSC.Nazmul Alam [2021] [33] Hashing algorithms

Blockchain-based medication tracking system
Web application framework using JavaScript and Angular Performance of the proposed system was not analyzed.
Several of the above-mentioned blockchains can be used to enhance the traceability mode of the pharmaceutical supply chain, which can give pharmaceutical information the characteristics of "visible, controllable, and traceable", so the development potential of blockchain technology in the field of pharmaceutical traceability is generally positive.In addition to the aforementioned benefits, the supply chain faces significant difficulties due to the constraints of the blockchain consensus process.Pharmaceutical supply chain transactions and account data are updated more frequently as a result of the network's explosive growth, and issues such as the consensus algorithm's low throughput [36], transactional latency, and high communication overhead have a significant impact on the overall performance of the traceability system.However, very few researchers have looked at how the blockchain consensus process could be adapted to the pharmaceutical supply chain.Because of this, it is now more important than ever to study how to make a blockchain consensus mechanism with high throughput, low latency, and the ability to handle large-scale networks.

Proposed Framework: MSMAChain-A Blockchain for Pharmaceutical Supply Chain Traceability
MSMAChain is a framework for supply chains in the pharmaceutical industry that is enabled by blockchain technology.As inherited from its ancestor such as blockchain, MSMAChain furnishes tracking and tracing to the pharmaceutical supply chain.Figure 2 graphically presents the work flow of the proposed framework.In the subsequent, the same is described.
Suppose we have a pharmaceutical company named MSMA that is interested to apply the traceability of its products throughout the key processes of its supply chain.The purpose of this cumbersome activity is the tracking and tracing of its genuine products and to save the customers from the disastrous issue of forfeited and substandard pharma products.Hence, MSMA adopted blockchain for the traceability of the products that require a track-and-trace service for its supply chain.This blockchain based system was named the MSMAChain.The number of pharma items was entered into a system that generates a MID (MS-MAChain Identity).To create the identities (i.e., MIDs), mining algorithms such as Proof of Work (PoW), delegated Proof of Authority (PoA), delegated Proof of Stake (PoS), etc. may be engaged depending upon the companies available resources and the established business setup.To keep the system running in a smooth and inherited fashion, an MSMA token is rewarded to the successful miner.
Here in MSMAChain, we introduced two different types of tokens: (i) MSA-A smart payment currency for utilization in financial and business activities; (ii) MSMA-Currency for the execution of smart contracts and for running the applications on the blockchain).

•
The IoT products (QR Codes, RFID trackers, NFC Chips, etc.) can be introduced for the true implementation of the tracking and tracing of pharma items.These IoT products must be in-built for the purpose of confidentiality, since the code is being generated with the set protocol of blockchain.The same are plugged with the pharma items by the company, converting the system into a digital twin.

•
Throughout the processes in the supply chain, the pharma items are transported from department to department (i.e., as shown Figure 1) until it reached the end user\pharmacy shop.The traversig record of these items is updated by the blockchain service provider at its blockchain (i.e., MSMAChain).

•
Smart contracts, which can only be used with MSMA tokens, have logic built into them and is linked to transactions and business deals between the parties.

•
As MSA is the smart currency of this blockchain, additional MSMA tokens may be acquired using MSA vouchers and converted to MSMA tokens if needed.For instance, via GEMINI or GDAX, FIAT currency is converted to Bitcoin, which is then converted to MSA through Binance.

•
The smart money MSA is used to conduct commercial operations or communicate with the MSMAChain blockchain.Any shortage is taken care of by purchasing it from Binance, converting FIAT money into Bitcoin, and then sending it to the MSA.
ated with the set protocol of blockchain.The same are plugged with the pharma items by the company, converting the system into a digital twin.

•
Throughout the processes in the supply chain, the pharma items are transported from department to department (i.e., as shown Figure 1) until it reached the end user\pharmacy shop.The traversig record of these items is updated by the blockchain service provider at its blockchain (i.e., MSMAChain).

•
Smart contracts, which can only be used with MSMA tokens, have logic built into them and is linked to transactions and business deals between the parties.

•
As MSA is the smart currency of this blockchain, additional MSMA tokens may be acquired using MSA vouchers and converted to MSMA tokens if needed.For instance, via GEMINI or GDAX, FIAT currency is converted to Bitcoin, which is then converted to MSA through Binance.

•
The smart money MSA is used to conduct commercial operations or communicate with the MSMAChain blockchain.Any shortage is taken care of by purchasing it from Binance, converting FIAT money into Bitcoin, and then sending it to the MSA.Several trials on a local private blockchain, where smart contracts were used to handle important interactions between stakeholders, goods, and processes, have shown that the recommended method works and is possible.Figure 3 depicts a graphic representation of a smart contract.Through the use of smart contracts, stakeholders, products, and processes may all interact.Specifically, truffle4 created and deployed a set of fully functional smart contracts, while node2 and ganache-cli3 formed an Ethereum blockchain.In order to make it easier to query the data stored in the blockchain, a graphical user interface was created with the aid of the node package manager npm5.The graphical user interface also allows users to obtain pedigree hashes and Inter-Planetary File System links (IPFS).Because of its consensus mechanism and smart contract architecture, Ethereum was chosen (i.e., to protect ourselves from vulnerabilities like unidealized storage pointers and Several trials on a local private blockchain, where smart contracts were used to handle important interactions between stakeholders, goods, and processes, have shown that the recommended method works and is possible.Figure 3 depicts a graphic representation of a smart contract.Through the use of smart contracts, stakeholders, products, and processes may all interact.Specifically, truffle4 created and deployed a set of fully functional smart contracts, while node2 and ganache-cli3 formed an Ethereum blockchain.In order to make it easier to query the data stored in the blockchain, a graphical user interface was created with the aid of the node package manager npm5.The graphical user interface also allows users to obtain pedigree hashes and Inter-Planetary File System links (IPFS).Because of its consensus mechanism and smart contract architecture, Ethereum was chosen (i.e., to protect ourselves from vulnerabilities like unidealized storage pointers and visibility issues, we employed Solidity 0.5.0).Readers who are curious to learn more about the security of Ethereum and the design of its smart contracts can refer to Xiao et al. (2020) [19], which was published in the journal Computer Science.In their study, the authors did not conduct a security analysis of blockchain, and therefore, there was no explanation about the block size.Moreover, the smart contract's trigger method may be used to send an alert anytime the contract's information is updated.Anyone involved in the order will be able to inspect or manage the order's content in real-time by using the smart contract's get-and-retrieve methods.In addition to the benefits of smart contracts, it is crucial to protect the confidentiality of transactions and the identities of all participants.As a result, only those with the necessary permissions are allowed to alter the content (each function is minutes.Cryptocurrencies and programming code are not required.Decentralized blockchain apps employ IPFS, a decentralized file storage technology.Web 3.0 applications or decentralized apps are additional names for similar technologies.Decentralized applications will, for the most part, be hosted online.
The Remix Ethereum IDE, which we used to find the smart contract results and graphs, is shown in Figure 3.If there is no gas in the Ethereum IDE, there are no smart contracts, and no Ether transactions.
Smart contract outcomes and graphs can be found using the Remix Ethereum IDE, which we utilized.There are no smart contracts or Ether transactions if there is no gas in the Ethereum IDE.

Efficiency Analysis of MSMAChain
In this section, we analyzed the efficiency of MSMAChain with respect to the cost and execution of transactions based on our designed smart contracts.
The cost of the gas is negligible in comparison to the price of one Ether.Based on our findings, decentralized apps are being created.Drug products, or anything else for that matter, can be monitored.A hash serves as a unique identifier for each product.When a user expresses interest in a product, a distinct transaction hash is produced.A smart contract is created by the application between the buyer and seller.Each hash is therefore exclusive to the sender and recipient.It is a secure technique to use while purchasing or transferring items.As a consequence of this, the gas is used up once a transaction is concluded in comparison to the Ether that is used in the transmission of the product.The gas does not have any value and the transaction method will generate a unique hash or input address when it is finished.
Table 2 displays the status and transaction because it presents a range of variables that are easy for customers and other important parties to understand.The cost of the gas is negligible in comparison to the price of one Ether, a consequence of rare gas consumption.Based on our findings, decentralized apps are being created.Drug products, or anything else for that matter, can therefore be monitored.
A hash serves as a unique identifier for each product.When a user expresses interest in a product, a distinct transaction hash is produced.The application between the buyer and seller establishes a smart contract.Hence, each hash is unique to the sender and Allowing access to be restricted safely: Stakeholders, for instance, will be able to create new techniques and add additional temperatures or product traces (i.e., IoT devices communicating with the blockchain may provide this information immediately).It is possible for public users to check read-only functions and variables to increase user trust in the system (e.g., fundamental information on the quality of the final items).However, while not necessary, it is conceivable to implement further restrictions in private blockchain setups.Establishing a connection between the activities carried out and important administrative requirements is necessary to connect smart contracts to traditional tasks.This allows for realtime interactions, thanks to the transactions that have been validated in the newly created private blockchain (for example, a product, process, and stakeholder are all instances of smart contracts being implemented), which are carried out in less than or equivalent to one millisecond.The smart contracts were able to interact well in both the implementation and the graphical web service.

Algorithmic Steps
To better understand how a smart contract works, we describe some of the methods we utilized to come up with this solution.Accordingly, the terms "buyer" and "supply" refer to recognized entities that have been granted authority to carry out their duties.The primary algorithms are as follows.The process to create a pharmaceutical supplier tracking system is outlined in Algorithm 1.The descriptions of the required inputs for the smart contract functions are presented.The caller and ownerID addresses must match for a function to be called.Therefore, it is up to the caller whether or not they are allowed access to Algorithm 1. Once all the fields are changed, Algorithm 1 updates the status of the two events.This is a description of Algorithm 2 for granting retailers.If the caller has the ownerID, this algorithm will send out a notification to all of the other participants, letting them know the store is for sale.The third algorithm details the interactions between the drug's purchaser and vendor.The buyer's calling address must be different from the seller's (so that the seller does not end up buying the drug they sold), and the amount transmitted must be exactly the same as the medication's price.Once these two conditions are met, payment will be sent to the vendor.The ownerlD will also be updated.Finally, a happening will occur to publicize the drug's sale and include information on the buyer.Remember that a smart contract can only be used by the authorized parties.Buyers may have confidence in the reliability of the vendor and the reliability of the drug's delivery when the sale is advertised.Whereas Algorithm 3 is used to describe the process of purchasing of drug.

Algorithm 1: Smart contract for monitoring drug supply chain
Step 1 "Input: Name, Country, City, Wallet, joinedDate, Caller, OwnerID Step 2 Output: An event declaring that the drug has been supplied.An event declaring that the detail of the drug has been uploaded Step 3 Data: Step 4 Name: is the name of the drug and supplier Step 5 Country: is the country of the drug and supplier Step 6 City: is the city of the drug and supplier Step 7 Wallet: is the price of the drug Step 13 Emit an event declaring that the drug has been supplied Emit an event declaring that the detail of the drug has been uploaded Step 14 else Revert the contract state and show an error."

Algorithm 2: Granting Retailer
Step 1 "Output: An event declaring that the drug is for sale initialization; Emit an event stating that the drug is up for sale Step 5 else Revert the contract state and show an error."

Algorithm 3: Purchasing Drug
Step 1 "Input:ownerlD, Buyer, Seller, Transferred Amount, Price Step 2 Output:An event declaring that the drug has been sold Emit an event declaring that the drug has been sold Step 14 else Revert the contract state and show an error."

Environmental Setup
Our agreements were distributed in a physical manner using a smart contract that was made using a modified version of the Ethereum IDE.We used Truffle to provide pleasant tools for our smart contracts and Ganache to complete a transient transaction.
The three main development frameworks that are part of the Truffle framework are Truffle, Atra, and Remix.These platforms were used to create decentralized apps and Ethereum smart contracts (dApps).A software-based cryptocurrency wallet called MetaMask could be used to interact with the Ethereum network.Users can access their Ethereum wallets via a browser extension or a mobile app, which can then be used to interact with decentralized apps.Any Ethereum-compatible JSON RPC API including 59 customized or private blockchains are now compatible with the MetaMask blockchain client.The MetaMask provides a test blockchain, like Ganache, that may be used for development purposes.
We may develop, deploy, and manage decentralized blockchain applications in a cloud environment with Atra Blockchain Services.Atra streamlines the process of maintaining and expanding an application, cutting years of development time down to minutes.Cryptocurrencies and programming code are not required.Decentralized blockchain apps employ IPFS, a decentralized file storage technology.Web 3.0 applications or decentralized apps are additional names for similar technologies.Decentralized applications will, for the most part, be hosted online.
The Remix Ethereum IDE, which we used to find the smart contract results and graphs, is shown in Figure 3.If there is no gas in the Ethereum IDE, there are no smart contracts, and no Ether transactions.
Smart contract outcomes and graphs can be found using the Remix Ethereum IDE, which we utilized.There are no smart contracts or Ether transactions if there is no gas in the Ethereum IDE.

Efficiency Analysis of MSMAChain
In this section, we analyzed the efficiency of MSMAChain with respect to the cost and execution of transactions based on our designed smart contracts.
The cost of the gas is negligible in comparison to the price of one Ether.Based on our findings, decentralized apps are being created.Drug products, or anything else for that matter, can be monitored.A hash serves as a unique identifier for each product.When a user expresses interest in a product, a distinct transaction hash is produced.A smart contract is created by the application between the buyer and seller.Each hash is therefore exclusive to the sender and recipient.It is a secure technique to use while purchasing or transferring items.As a consequence of this, the gas is used up once a transaction is concluded in comparison to the Ether that is used in the transmission of the product.The gas does not have any value and the transaction method will generate a unique hash or input address when it is finished.
Table 2 displays the status and transaction because it presents a range of variables that are easy for customers and other important parties to understand.The cost of the gas is negligible in comparison to the price of one Ether, a consequence of rare gas consumption.Based on our findings, decentralized apps are being created.Drug products, or anything else for that matter, can therefore be monitored.
A hash serves as a unique identifier for each product.When a user expresses interest in a product, a distinct transaction hash is produced.The application between the buyer and seller establishes a smart contract.Hence, each hash is unique to the sender and recipient.It is a safe strategy to apply while purchasing or transferring commodities." As a consequence of this, gas is used up once a transaction is concluded in comparison to the Ether that is used in the transmission of the product.The gas doesn't have any value.The transaction method will generate a unique hash or input address when it is finished.
Similar circumstances to those above-mentioned are depicted in Table 3.The most apparent difference is that every hash value changes whenever a new transaction is performed, since the app generates a unique hash for each transaction.With this technique, smart contracts between the buyers and sellers are extremely safe.The price of gas is different from the price of a transaction, as is the cost of the execution.
As a consequence, the execution value is condensed in this table and the execution cost is decreased.Due to the use of string-type values, a significant discrepancy between the values in Table 4 and the values in Table 5 can be seen.
The third smart contract that can be produced with Remix IDE is shown in Table 5.The value of the hash in this table and the value of their entries are different.The cost of execution is reduced after the contract is put into action.The implementation of each contract uses a different gas value.In this case, the status and transaction are successfully mined.The three distinct smart contracts that are now in place between the buyer and the seller are shown in Table 5: Hash incorporation increases the transaction and execution costs every time.The role of the smart contract is to maintain the secrecy of the deal between the buyer and the seller.Using the Ethereum remix integrated development environment, the whole contract can be created.This is a very potent compiler that enables the online development of smart contracts.The smart contract is deployed via remix IDE using a variety of hashes and fees.
Table 6 highlights the various execution costs that are minimized as a result of implementing the contract.As each input's transaction hash is distinct from the others when the contract is put into operation, the value remains constant.Therefore, the transaction costs of each contract decrease as the total number of contracts increases.A summary of the numerous execution costs that are decreased as a direct result of putting the contract into effect is shown in Table 7 in a similar vein.Given that each transaction hash is distinct from the hashes of the other inputs, it is impossible to change the value of the contract.As the number of contracts increases, the transaction costs related to each contract are reduced.An example of this is shown in Table 8, which summarizes the many execution costs that are decreased as soon as an agreement is implemented.Because the hash of each transaction is different from the hashes of the other inputs, it is mathematically impossible to change the value of the contract.As the number of contracts increases, the transaction costs that are connected to each individual contract fall, which is because there are more contracts.Examples of smart contracts that may be created using the Remix IDE are shown in Tables 2-9 where a difference between the hash value and the item value can be seen in this table.When the contract is in place, the cost of carrying it out will be less.Each contract uses a different gas value when it enters into force.By synchronizing the necessary data in real-time with the rest of the system, it makes redundancy possible.The suggested paradigm also offers outstanding auditability and confidence benefits as well as auditable data that can be used by important players or external stakeholders such as regulators or policymakers.The public blockchain offers built-in security and transparency.The suggested paradigm also offers significant advantages in terms of trustworthiness and audibility as well as auditable data that may be used by important players or outside stakeholders such as regulators and policymakers.Particularly in industries where safety is a concern (e.g., the food sector) and traceability is a persistent source of concern for a variety of supply chain stakeholders (SC), the need for legal compliance must be taken into account (customers, administrators of the supply chain, public policymakers, and interest groups).Because of this technology, recordkeeping and information exchange are simplified and automated, and regulators have more access to the traceability data.
This technology unites the government agencies in charge of the traceability requirements and the agencies in charge of reporting instances of dangerous consequences.Regulators can rapidly and readily access traceability processes since these data are unreliable, decentralized, and free.Therefore, this establishes a framework for ongoing traceability and oversight.The architecture that is being proposed will also assist in the monitoring of processes, in addition to objects.As a result, access to the whole link between the goods provided to clients and the activities taken in the different SC processes would be made available.The suggested method increases the effectiveness and security of consumer goods.The installation of an architecture is to address food safety, a significant public health concern, and will enhance numerous elements in the business operations.One benefit of this design, for instance, is improved system integration for controlling system calls and/or product quality.Additionally, the irreversible and scattered structure of the recommended method ensures that the quality will not be compromised.This is so that any manipulation of the health information may be instantly detected and prevented.As a result, the excellent quality food items that customers of HSC members receive aids in ensuring the long-term prosperity of their businesses.Because of this, the traceability information transmitted via blockchain technology is more precise, trustworthy, timely, and available.
It should be emphasized, once again, that the suggested modeling technique (i) offers significant advantages in terms of supply chain resiliency because it eliminates geographical restrictions, security requirements, or both, and (ii) it enables the integration of a wide range of traceability-related data across the SC.Denial of service assaults, which are common in business, are prevented by the decentralized nature of blockchain, which is different to the centralized systems that are more common.In contrast, the latter removes the possibility of information loss, which endangers both the consumers' financial and physical security.Blockchain is a wonderful alternative for operations that demand a high level of security and secrecy as well as when processes and transactions must be monitored (a series of events in chronological order).The likelihood of harmful activity occurring in centralized data structures is higher than in decentralized data structures.However, using decentralized storage systems such as IPFS (the Inter-Planetary File System) requires attention to the content that safeguards the privacy of the data that are stored there (i.e., each hash, in addition to the data contained inside a given file, is one-of-a-kind).As a result, the use of records and hashes ensures both the availability and immutability of the contents inside the framework under consideration.It is crucial to remember that objects are stored with the timestamps that are associated with them, and that hash values relate to the currently available environment in each scenario.The company, which will speak to the merchants directly, will oversee product delivery to outlets.However, if distributors were given access to the purchasing power, the company would not be made aware of stores that have already received merchandise.As a consequence, the business will speak to the wholesalers to obtain the data they need.The authorities must be called immediately if a product's quality or safety issue poses a risk to the health of the general public Depending on the product's distribution network, particularly when exporting overseas, the length of the process may vary significantly, which might lead to cost inefficiencies and a considerable loss of time value.The Ministry of Agriculture and Food is required to take actions and impose fines with regard to food, feed, animal health and welfare, and other obligations that fall within its scope.The following actions are a signal to stop feeding or eating: to remove harmful drugs or feed from the supply chain and hold the company accountable for doing so; (ii) to store a drug-related item in a distinct and separate area, complete with the necessary labeling, and to keep the relevant documentation; (iii) to immediately and in writing notify the local authority that is in charge of the area; (iv) to provide written notification to the local competent authority.

Blockchain Supply Chain Security Analysis
Integrity: The fundamental purpose of the blockchain solution that has been presented is to keep track of all of the transactions that take place inside the health care supply chain.This will ensure that the history of the pharmaceuticals, ownership transfers, and their respective providers can be traced back to their sources.Due to the immutability of the blockchain ledger, the suggested method ensures complete auditability.As a result, the pharmaceutical supply chain's every transaction will be traceable, as visually displayed in Figure 4.
Systems 2023, 11, x FOR PEER REVIEW 15 of 21 feeding or eating: to remove harmful drugs or feed from the supply chain and hold the company accountable for doing so; (ii) to store a drug-related item in a distinct and separate area, complete with the necessary labeling, and to keep the relevant documentation; (iii) to immediately and in writing notify the local authority that is in charge of the area; (iv) to provide written notification to the local competent authority.

Blockchain Supply Chain Security Analysis
Integrity: The fundamental purpose of the blockchain solution that has been presented is to keep track of all of the transactions that take place inside the health care supply chain.This will ensure that the history of the pharmaceuticals, ownership transfers, and their respective providers can be traced back to their sources.Due to the immutability of the blockchain ledger, the suggested method ensures complete auditability.As a result, the pharmaceutical supply chain's every transaction will be traceable, as visually displayed in Figure 4. Accountability: Every time a function is called, the caller's Ethereum address is recorded on the blockchain, making it easy to identify who called the function.As a result, everyone involved must take responsibility for their actions.Supply chain accountability will be based on the medication detail's function, and pharmacies will be liable for what- Accountability: Every time a function is called, the caller's Ethereum address is recorded on the blockchain, making it easy to identify who called the function.As a result, everyone involved must take responsibility for their actions.Supply chain accountability will be based on the medication detail's function, and pharmacies will be liable for whatever prescription they issue to a function, since the retailer function will reveal where each patient is obtaining their pharmaceuticals, as shown in Figure 5. Accountability: Every time a function is called, the caller's Ethereum address is recorded on the blockchain, making it easy to identify who called the function.As a result, everyone involved must take responsibility for their actions.Supply chain accountability will be based on the medication detail's function, and pharmacies will be liable for whatever prescription they issue to a function, since the retailer function will reveal where each patient is obtaining their pharmaceuticals, as shown in Figure 5. Authorization: It is possible to execute a smart contract by authorized parties.As a precautionary measure, to guarantee that no unauthorized persons or organizations are allowed to gain access, all participants must have a MetaMask account to use it and the pharmacy has to endorse it.
Availability: The essence of blockchains is that they are decentralized and dispersed.Every participant has access to the smart contract transaction logs and history once it is Authorization: It is possible to execute a smart contract by authorized parties.As a precautionary measure, to guarantee that no unauthorized persons or organizations are allowed to gain access, all participants must have a MetaMask account to use it and the pharmacy has to endorse it.
Availability: The essence of blockchains is that they are decentralized and dispersed.Every participant has access to the smart contract transaction logs and history once it is implemented on the blockchain.In contrast to centralized systems, the transaction data are saved at all participating nodes, hence, node loss does not affect the transaction data.For the use of blockchain in the supply chain for pharmaceuticals to be effective, the blockchain network must always be operational.When an application is linked to it, all participants may access all the information, and every aspect of each entity is shown in full.
Non-Repudiation: Each transaction is given its unique cryptographic signature using the initiators' private keys.Meta Mask's private key is its own thing.Consequently, the owner of a particular private key may be identified as the signer of a transaction if that key is used to authenticate the transaction.This is analogous to the concept of accountability, in which the players in a blockchain-based supply chain for pharmaceuticals are unable to refute their acts since they have already been verified by their private key, which is connected to their actual identity.This prevents the participants from escaping responsibility for their behavior.
MITM Attacks: Because each blockchain transaction must be signed by the initiator's private key, an intruder attempting to alter the original data or information will be unable to have their actions validated until the transaction is signed by the initiator's private key.In a blockchain system, man-in-the-middle attacks are thus impossible to pull off.This feature is essential for the implementation of the pharmaceutical supply chain since it guarantees that only certified entities may carry out the relevant activities.
This thorough review of the literature on the use of blockchain technology [29] to support SCs in health care showed how researchers around the world are working to take advantage of this groundbreaking technology, especially for products made by the industry such as drugs and medical devices, and products made from patients (e.g., blood, organs, and tissues).Even though it has some flaws, the results of this systematic review show that there is a large but growing interest in this topic in the current literature.There are many different ideas and approaches, but there are not very many useful real-world applications.Smart contracts have become a useful way to automate peer-to-peer transactions in blockchain networks when certain conditions are met.Blockchain technology could improve the health of patients and the health care industry.However, more research with real-world applications is needed to come to a clearer conclusion about the benefits and performance of blockchain in health care SCs.

Importance of Blockchain to Pharmaceutical Industry
The authors in [30] outlined the advantages and difficulties of supply chain management for the health care industry.With the health care industry in mind, we talk about how blockchain technology could be used in the health care supply chain.In [31], the authors addressed "blockchain", the technology behind the digital currency Bitcoin, which is being used in several fields to prove ownership and ensure security.Blockchain, according to its creator, Satoshi Nakamoto, "hashes transactions into a continuous chain of hash-based proof-of-work, establishing a record that cannot be modified without repeating the proofof-work" and is described as a peer-to-peer network that timestamps transactions.Several authors believe that using blockchain technology to address health care issues and some of the toughest supply chain issues facing the pharmaceutical industry might be resolved (e.g., secure transmission of sensitive patient data and clinical information).
Blockchain application topics [32][33][34] can be broken down into four categories such as tracking and tracing, safety and security, and the prevention of counterfeit drugs.The most popular category was stopping the sale of fake drugs, which is also the main goal of the pharmaceutical industry.More recent studies have looked at data governance, data quality, pharmaceutical turnover, and the monitoring of prescription drugs.We explored the problems associated with each of these themes and research investigations as well as their shortcomings and potential remedies.We also look at the difficulties and potential paths for future study in using blockchain technology in the pharmaceutical sector.As a result, the blockchain can provide robustness, security, transparency, and scalability to big data systems, and applied to supply chain processes in the pharmaceutical industry.Key constituents of a trustable smart supply chain environment is visually displayed in Figure 6.big data systems, and applied to supply chain processes in the pharmaceutical industry.Key constituents of a trustable smart supply chain environment is visually displayed in Figure 6.

Traceability
Because of the deaths caused by the spread of bad and fake drugs, governments all over the world have put in place "trace-and-track" systems to keep an eye on pharmaceutical supply chains.Blockchain offers fresh chances to guarantee pharmaceutical traceability.Moreover, blockchain offers quality control and monitoring throughout all stages of medicine production, from the producer to the customer.
Managing the supply chain using the Ethereum blockchain and distributed ledger technology is one way to stop fake drugs and make it easier to track pharmaceuticals.

Traceability
Because of the deaths caused by the spread of bad and fake drugs, governments all over the world have put in place "trace-and-track" systems to keep an eye on phar-maceutical supply chains.Blockchain offers fresh chances to guarantee pharmaceutical traceability.Moreover, blockchain offers quality control and monitoring throughout all stages of medicine production, from the producer to the customer.
Managing the supply chain using the Ethereum blockchain and distributed ledger technology is one way to stop fake drugs and make it easier to track pharmaceuticals.Through user privacy, quality control, non-repudiation, transparency of the delivered drug, and demand-supply management, this framework makes it easier for users to trust pharmaceuticals and track them.A scenario-based blockchain system for drug control and tracking was built on a peer-to-peer architecture.In the pharmaceutical business, Hyperledger Fabric is used as a system management framework for the drug supply chain, which makes it possible to keep track of the distribution of medicines.We used math to describe important aspects of blockchain such as accountability, authenticity, and the ability to keep track of prescription information.IoT devices have also been used to ensure that data sources are accurate and to check the status of pharmaceutical products at any time and in any place.Blockchain ensures that the data are transparent and can be tracked, and it also makes it easier to share and store data.Importantly, the Italian pharmaceutical industry has put in place serialization laws and a technical solution based on blockchain.Therefore, we recommend using MSMAChain, a blockchain-based pharmaceutical supply chain system.

Future Challenges of MSMChain System
The body of knowledge on blockchain technology is growing.While initially only being utilized in the financial sector, blockchain technology is now being applied in public services, IoT, reputation systems, and security services.One of the most important uses of blockchain technology in the pharmaceutical industry, which is the most recent industry to do so, is the problem of counterfeit goods.It is fascinating to see how much more study has been conducted on blockchain applications in the pharmaceutical industry over the last three years.We identified numerous difficulties that the pharmaceutical industry is currently battling in our study.In this section, we discuss a few of these challenges with an emphasis on those that pertain to blockchain applications.The MSMAChain system is one of the solutions we offer to these problems.
Information security and privacy are a couple of the benefits that blockchain technology provides, mostly because of decentralization.Unfortunately, this calls for more processing power.Malicious users spend almost half of the power on deceptive attacks; otherwise, users risk losing money to theft and lost property due to a lack of effective monitoring and tracing.Blockchains that are dispersed provide a more complicated environment that is challenging for fraudulent block transactions to exploit.Hyperledger may also be used to secure permissionless blockchains, in which any user can participate.Particularly, Hyperledger makes permissionless blockchains more secure and only allows the people who are engaged in the transaction to join.
Blockchains can make safe banking transactions possible on a global scale, but problems with interoperability are a big problem.The use of distributed ledger technology (DLT) can standardize blockchain activities.The International Telecommunication Union (ITU) attempts to categorize and standardize DLT applications and their related services, but further investigation is required to determine the most effective methods for deployment.Using edge computing, cloud computing, and smart IoT apps has made a huge difference in how much data are available.Because of this huge growth, putting a blockchain in place is hard, especially when it comes to data management, accessibility, redundancy, and privacy.They also have trouble with malpractice and weak supply chains, so several authors have tried to use blockchain technology to organize operations and speed up patient safety, medical transactions, tracing, and monitoring.To handle the complexity of data, a blockchain needs to use algorithms that can handle large amounts of data and other cutting-edge methods.

Comparison of MSMAChain Solution with State-of-the-Art
In this section, we look at how the proposed solution for a pharmaceutical supply chain that can be tracked compares to what is already available.Table 1 gives an overview of this analysis.Decentralization of the suggested solution is a crucial component since it guards against data manipulation or modification by a single organization.As our system is decentralized and does not have a single point of failure, resilience is another crucial aspect.Due to properties like data immutability, which means that once the information is entered into the ledger, it cannot be deleted or changed, blockchain offers exceptional solutions for data integrity and security.Data security is preserved since it is kept decentralized, making it impossible for a single party to manipulate data at the same time.A crucial component of every supply chain is transaction transparency.All parties in our suggested solution may access and view the validated transactions in a secure setting.The track-and-trace feature is the one element that all the solutions in Table 1 have in common, but decentralized storage, integrity, and transparency are all essential for building a reliable track and trace system.Our suggested solution is contrasted with alternative blockchain-based methods in Table 10.Our approach makes use of the Ethereum blockchain, while the solutions in [34] and [32] make use of the Bitcoin blockchain and Hyperledger Fabric, respectively.Furthermore, although that in [32] runs in private permissioned mode, which is an intrinsic property of Hyperledger Fabric, both our solution and that in [34] function in public permission mode.The Ethereum currency, Ether, serves as the payment method in our solution.Unlike [32], which lacks a currency, the method in [34] makes use of BTC.Moreover, while data are always saved on-chain in all systems, ours also contains a feature that enables off-chain data storage.Finally, both our solution and that in [32] include programmable components, which are the smart contract and Docker container, respectively.The answer in [34] does not, however, offer a programmable module.

Figure 1 .
Figure 1.The flowchart of the pharmaceutical supply chain.

Figure 1 .
Figure 1.The flowchart of the pharmaceutical supply chain.

Figure 2 .
Figure 2. A visual diagram of the proposed system that shows the action involved in the pharmaceutical supply chain.

Figure 2 .
Figure 2. A visual diagram of the proposed system that shows the action involved in the pharmaceutical supply chain.

Figure 3 .
Figure 3.A visual example of interaction of objects through a smart contract.

Figure 3 .
Figure 3.A visual example of interaction of objects through a smart contract.

Figure 4 .
Figure 4. Details of the system integrity.

Figure 4 .
Figure 4. Details of the system integrity.

Figure 4 .
Figure 4. Details of the system integrity.

Figure 5 .
Figure 5.The detail of system accountability.

Figure 5 .
Figure 5.The detail of system accountability.

Figure 6 .
Figure 6.Key constituents of a trust smart supply chain environment.

Figure 6 .
Figure 6.Key constituents of a trust smart supply chain environment.

Table 1 .
A comparative analysis of the related articles.

Table 5 .
Comparison of the three smart contacts in Remix IDE.

Table 10 .
Comparison between our proposed solution and other blockchain-based solutions.