1 Introduction

A medical supply chain intends to keep a log of medicine at each stage of its journey. It tracks the status of a batch of medicine from manufacturers to wholesalers, distributors, and retailers. This status tracking characteristic of a medical supply chain offers numerous benefits to both stakeholders and consumers. In a medical supply chain, pharmaceutical companies, wholesalers, hospitals, and retailers are the primary stakeholders. Consumers and governing healthcare agencies are, likewise, a vital part. By leveraging the medical supply chain, the stakeholders can analyse and optimize their storage and production. Also, the consumers and governing agencies can verify the authenticity of a drug by inspecting its journey. As medical supply chain was centralized [1], it was not meet healthcare standards, fail to meet profit for genuine manufacturers, and also not track the counterfeit drugs from the market. Without a proper medical supply chain, it is arduous to achieve network integrity and leads to inadequate information about medicine ' s journey, henceforth setting patients’ health at risk and affects billions to stakeholders. These are often hard to maintain and are prone to fraud. Moreover, appointing a single entity sprouts monopoly over the information. Although, the burdensome of a centralized system can be dealt with by employing blockchain technology.

Blockchain, a rising technology, acquired popularity after the creation of Bitcoin [2]. It has become the most suitable way to create trust between third parties [3]. It can potentially revolutionize the current medical [4,5,6,7], financial [8,9,10], public [11, 12], insurance [13,14,15,16], supply chain [17], and business sectors [18,19,20,21]. As its name suggests, a blockchain is a structure where blocks containing information and transactions are tied together using cryptography [22]. It is an immutable [23] peer-to-peer [24] distributed network. This distributed network functions as a shared trusted ledger between individuals [25]. Anyone who is entering a blockchain network becomes a node. Any change in the ledger can only be processed via transactions, and nodes inside a blockchain network can initiate transactions. A transaction needs to be validated to get recognized in the network. Here, a miner plays an important role. A miner is also a node, but it serves to generate new blocks of transactions. For mining a block on most blockchain networks, a miner needs to solve a mathematical puzzle called Proof of Work (PoW). The PoW mathematical puzzle requires brute force for obtaining a hash value less than a specific number. Obtaining the required hash has a very low probability and requires multiple compilations, taking around ten minutes and high computational resources [26]. The nature of mining makes it impractical to change the previous transactions. If a malicious user aims to change any previous transaction, all the blocks, from that transaction to the latest, need to be re-mined, and because mining is time taking and resource expensive, it is nearly impossible to do so. Hence, once a block is appended following successful mining, it is filed permanently on the network. As a result, blockchain reduces fraud and prospers trust in a network [27]. Blockchain uses asymmetric key cryptography [28] to identify and validate a transaction. It is a technique for encrypting and decrypting a message consisting of two keys, public and private. A public key is an account’s address shared publicly and used for tasks such as viewing an account ' s history. On the other hand, a private key is like a password, which needs to be kept secret. It is used for authorizing a transaction on behalf of a user. When a user creates an account on a blockchain platform, both private and public keys are generated. Elliptic Curve Cryptography (ECC) [29] is a public key cryptography algorithm based on the elliptic curve theory. This theory is useful for generating small, efficient, and faster cryptography keys and requires less computational power for creating keys. This type of cryptography algorithms suitable for less power consumption devices like mobile phones due to the small-sized key for developed decentralized applications (DApps). Bitcoin was the first most popular blockchain implementation. Since it was designed only for cryptocurrencies, it was incomplete and low-level [30]. Although in 2015, Ethereum [31, 32] was developed by Vitalik Buterin, with the idea of a network that can exchange cryptocurrencies and assets. Ethereum introduced smart contracts [33], employing which complex business logic can be embedded easily into a network. As its name suggests, a smart contract is a predefined set of rules that can cause changes in the network according to a situation. It is also capable of sending and receiving ethers (cryptocurrency on an Ethereum-based platform). The smart contracts, deployed on an Ethereum-based platform, are written using the Solidity programming language. Solidity [34] is a statically typed, contract-oriented, high-level language. The bytecode produced by a solidity program can execute on Ethereum Virtual Machine (EVM) [35]. The smart contracts are stored on the blockchain-platform, in its binary form, thus unchangeable. Due to smart contracts' stated properties, these are highly useful for automating a process while still maintaining trust between the parties.

Blockchain features such as decentralization, automation, immutability, and transparency can create a highly secure and robust medical supply chain. In this paper, we will review the various characteristics, components, and platforms of blockchain. Furthermore, we will see how it can be adopted for enhancing the drug supply chain. We will perform the network' s implementation and design using smart contracts, Web3.js library, and JavaScript. At first, we will deploy the network on a local private network and then later on the Kovan test network. Furthermore, the whole code will be analysed and tested using the Truffle suite. Finally, we will critique the future scope of the paper.

1.1 Literature survey

This section reviewed the previous work done in our research and summarize the vital background knowledge required to understand the paper.

1.1.1 Medical supply chain

A supply chain is a practice of maintaining the status of goods at each stop. For example, a supply chain for diamonds [36] will store all the information from mining, sorting, manufacturing, till retailing. Similarly, a Medical Supply chain [37, 38] accounts for medicine’s status and condition at each intermediate station. It tracks the medicine status from pharmaceutical companies to wholesalers, distributors, and retailers. A medical supply chain brings multiple benefits to both consumers and stakeholders. It enables the consumer to check the authenticity of the drug by checking its journey among different intermediaries and, as a result, eliminating counterfeit drugs from the market. Moreover, other stakeholders like manufacturers or wholesalers can also use the supply chain for analyzing drug demands to optimize the quality [39], manufacturing and storage. Furthermore, information about expired medicine and waste management can be easily accessed and analyzed. Figure 1 shows an overview of a medical supply chain proposed by the paper.

Fig. 1
figure 1

Medical supply chain overview

Generally, there is very little to no information about a product ' s journey without a supply chain. This unseen journey spells financial and reputational losses for the firm, plus increases the risk of entering counterfeit products. The US Trade Representative office’s annual reports suggest that 20% [40] of medicine in the Indian market are counterfeit. In 2017, a report by the World Health Organization declared roughly 10% of India ' s medicine are of inferior quality [41]. Counterfeit and substandard drugs account for $200 billion globally [42]. By using a medical supply chain, the issues in medical healthcare can be solved.

1.1.2 Problems in current medical supply chain

Mostly, a centralized organization handles the current medical supply chain system which is not trustworthy, below we were pointed some issues related to current medical supply chain system.

  • The medical supply chain in centralized organization or a single organization is believed to be inherently complex and as a result it is quite a tough task to recognize, manage and update any magic button that will help remove the inefficiencies to drive down costs.

  • About 25% of the pharmaceutical cost is for its supply chain. Moreover, in medical devices, this cost increases by up to 40% [43]. The medical supply chain costs about $230 billion annually [43].

  • For a centralized organization, such as Fairtrade [44], it is hard to collect and secure accurate data. Since a singular entity governs the data, other stakeholders cannot check the medicines ' journey, hence incapable of optimizing their production and storage. Thus, even a small improvement in it can redeem a large sum.

  • Moreover, relying on a single organization tip it with extraordinary power over the sensitive data. Additionally, it develops the chance of fraud, corruption, counterfeit drugs and a single-point of failure.

  • Finally, the consumers solely need to trust the logos certified by the third-party organization.

In the literature [43,44,45,46,47,48,49,50,51,52], we found that the researchers are suggested, presented, and addressed the issues related to medical supply chain, but very little work done so far using blockchain driven model, and implementation, which was motivated us doing research in this area.

All the shortcomings of the centralized system can resolve by using blockchain. A blockchain-based platform, such as Ethereum, can be employed for forming a robust medical supply chain.

1.1.3 Related work on medical supply chain using Blockchain

Shrikant [45] has talked about permission blockchain for the traceability of drugs used by a pharmaceutical company. He also pointed out the feature to register a patient ' s reaction to medicine. In his system, he only allows trusted-actors to join the supply chain network, and hence only these users can upload data. Randhir Kumar [46] discussed how counterfeit medicines are damage the healthcare sector and how blockchain technology would help create a medical supply chain from the manufacturer to the consumer. He suggests using blockchain with an encrypted QR code imprinted on a medicine. Kapoor D [47] sought to explain all complexities in a medical supply chain in his paper. In a medical supply chain, the most crucial entity, a pharmaceutical company, has various risks, which result in corrupting the quality and quantity of medicine. He presented that sharing information about the medicine from producer to customer can help to remove fraud. Yan Huang [48] has proposed scenario-driven drug traceability and authenticity system, Drug ledger, based on the peer-to-peer blockchain-based solution. He has talked about splitting service elements into three independent segments. He also revealed the algorithms utilized for drug supply chain logic.

1.1.4 Improvement of medical supply chain using blockchain

As discussed in the previous section, problems with a centralized medical supply chain can be rectified by adopting blockchain. Blockchain is a distributed network [53]; hence no single entity holds the data ' s monopoly [54]. The distributed nature of blockchain makes the entire system robust [55]. Plus, it enhances transparency in a supply chain [56]. For example, even if a server (node) crashes on a blockchain platform, the other nodes still have an identical copy [57]. Blockchain cryptographic security ensures data taper-resistance [58]. Smart-contracts, running on a blockchain platform, aids a medical supply chain by periodically updating drugs ' status, automating transactions [59], and determining access to information [60]. Due to all these stated reasons, a blockchain network can significantly improve the medical supply chain.

Let us further discuss the advantages of a blockchain-based medical supply chain in detail.

Decentralization

The blockchain concept of decentralization will distribute the authority and access to all the various actors of a medical supply chain. At every stage, the associated actor will update the status of a batch of health care products. Likewise, when a medicine reaches the next actor, it is their responsibility to update the batch condition. This practice depreciates the control of a single centralized organization on the data. Also, as multiple nodes affiliated with the supply chain can access, update, and validate the batch of health care products, this enhances transparency and ease the status update process, hence eliminating monopoly and bribery.

Immutability

All records on the blockchain network are cryptographically [61] protected, consequently immutability. When an actor updates the status of health care products, it stores in a block of transactions. This block of transactions is then required to be validated by the miners. The miners are required to solve a puzzle, commonly Proof of Work (PoW), in an Ethereum-based platform to validate a block of transactions. A block is uploaded on the blockchain network only once the puzzle is solved. This process makes it impracticable to add false information or to alter the ledger. Hence making the medical supply chain ledger tamper-proof and further reduces fraud.

Durability

As the data is distributed on the blockchain, it secures the ledger from a single point of failure. Multiple actors (nodes) have a copy of the blockchain ledger. Hence even if one fails, the data will be available with other nodes. Therefore, making the whole system robust.

Transparency

Since blockchain is decentralized, anyone can access the ledger’s data. For example, the manufacturer can scan and analyze the ledger to understand the drug requirements better. Similarly, consumers can also check the authenticity of the drug by checking its journey. If there is a faulty actor, he can be identified easily. Hence, increasing trust between the parties and eliminating fraud or counterfeit drugs.

Scalability

On a public blockchain platform, such as Ethereum, it is simple to add members into the medical supply chain. An authorized member can easily add information to the system. Moreover, the information on a public blockchain network is public; hence anyone can access it. The newer advancements in blockchain technology can solve scalability issues [62]. In Ethereum 2.0, scalability issues solved by sharding, and state channel. In sharding process, the network was divided into sub networks and each node stores and manages a fraction of blockchain (a shard), it also allows scaling up as the network grows. In state channel, the states were scaling by using off-chain transactions, can update the channel multiple times, and only settlement transactions are on-chain. Nevertheless, a private blockchain platform can be used for higher scalability [63, 64].

Automation and integrity

On Ethereum, a process can be automated through smart contracts. Here, actors can work in coordination and integrity among themselves since they all have a specific job to perform and a platform to track it. Using smart contracts, we can easily set limits, parameters or transfer funds between parties based on the decided conditions [65,66,67].

Data provenance

In supply chain data provenance means to track any products from its origin, here, in Blockchain the token was designated basically for the product at origin, once the product is in supply from one party to another party the token value must be re-assigned according to the phases that product travels [29, 68, 69].

1.2 System model

A medical supply chain starting from manufacturers to consumers has many actors (entities). For simplicity, we have taken a few major actors: pharmaceutical company (manufacturer), wholesaler, distributor, retailer, regulatory agency, government, and an insurance company. All the actors, except the regulatory and government, have the attributes of demand and supply. A pharmaceutical company has an additional attribute for adding information about a batch of medicine. Furthermore, regulatory agencies and government can audit the information present on the blockchain.

This section will look at the proposed system model and implementation of a medical supply chain. We will understand the relationships and transactions between two actors while exchanging a batch of medicine. To clarify the proposed model, we will explain in a sequence, following a real-world example.

1.2.1 Requirements for system security

The proposed medical supply chain system must meet the following security requirements.

Data immutability

For conveying the right information and avoid fraud, the data present on the blockchain network must be immutable.

Data transparency

The data must be accessible to the participants of the network. Transparency is the core requirement for a medical supply chain that the paper proposes.

Automation and integrity

The network must provide ways to ease and automate logging events and process transactions. It should be able to accept information from different actors and, at the same time, arrange that information in the right sequence.

1.2.2 System overview

As shown in Fig. 2, the prominent participants in the blockchain-based medical supply chain, as proposed by the paper, are pharmaceutical companies, distributors, wholesalers, retailers, and regulators. Let us briefly discuss them.

Fig. 2
figure 2

Blockchain-based medical supply chain

Pharmaceutical company (manufacturers)

Pharmaceutical companies are the manufacturer of drugs. According to the proposed system, their job is to register a batch of medicines, log all batch-related information, and store details about the next actor in the supply chain.

Distributor

Distributors are in direct relations with pharmaceutical companies and buys medicine from them. They sell medicine to the next actor in the supply chain, namely wholesalers. In the proposed network, distributors log information regarding medicine arrival, storage condition, location, departure, and the new owner (actor).

Wholesaler

Wholesalers directly buy a large quantity of medicine from the distributors and sell them to smaller retailers. In the proposed network, the wholesalers’ task is similar to that of the distributor.

Retailer

Let it be a retailer, hospital, or clinic they all buy medicines from wholesalers or distributors and sell to customers. Their job is similar to distributors or wholesalers in the network, but instead of adding information about the next actor, they end the supply chain for the medicines sold.

Consumers

Consumers buy medicine from retailers. They are the final participant of a medical supply chain. In the proposed model, consumers do not add any information to the network; instead, they can view the information present in the network about medicine. Using the information present in the network, they can check the authenticity of a drug.

Regulatory agency and government

Regulatory agency and government are public healthcare protectors. They set all the healthcare rules and regulations. The proposed system has access to see all transactions present on the medical supply chain network. Through this network, they can monitor and verify the quality of the medicines.

1.2.3 System smart contract design

For the implementation of the proposed system, there are three main smart contracts- Medicine Registration Contract (MRC), Batch Addition Contract (BAC), and Transaction Update Contract (TUC). The MRC is responsible for registering a medicine type on the network. Inside MRC, there is a link to invoke BAC. The BAC is used to adding batch information to the network. BAC contains a link to invoke TUC. The TUC is employed while updating the status of a batch of medicine. We can observe that each contract has an option to invoke another contract. This feature brings coherence to the system. In this way, each medicine has batches related to it, and each batch has corresponding transactions. An authorization list is also maintained. Only the actors belonging to the authorization list are allowed to inculcate changes in the network. By entering a medicine ' s product id and batch number on the network, consumers can view the corresponding transactions and authenticate the medicine. Let us briefly understand the purpose of each smart contract.

Medicine registration contract (MRC)

A pharmaceutical company uses the MRC contract for adding specific medicine information. A pharmaceutical company calls the register () function (shown in Algorithm 1.1.) and adds information such as medicine id, name, owner, and expiry period (shown in Table 1). The register () function automatically takes the current universal timestamp and saves it. This timestamp property later helps to check the medicine status at different timelines. After registration of medicine, the MRC automatically deployed a BAC contract from the holder’s address. This BAC contract will provide functionality for adding new batches of medicine to the network.

Table 1 Illustration of medicine registration list of MRC contract

Batch addition contract (BAC)

After registering a medicine, a batch addition contract is deployed automatically. The BAC contract allows the addition of a new batch by calling the function addBatch() (shown in Algorithm 1.2.). The batch manager calls the function addBatch() and adds information such as batch number, medicine id, number of medicines in the batch, expiry date, and timestamp (shown in Table 2). After adding a batch, a BAC automatically deployed a TUC contract from the manager ' s address. This TUC contract will record all the transactions related to the flow of a batch of medicine.

Table 2 Illustration of a batch list of BAC contract for medicine-id: 348975 of Table 1

Transaction update contract (TUC)

After successfully adding a batch, a TUC contract is automatically deployed. The TUC contract is accountable for storing all the transaction-related information. For updating the status of a batch of medicine, the TUC contract provides a function updateTran() (shown in Algorithm 1.3.). These status updates are used for checking the journey of medicine.

At first, the owner of the batch creates a transaction request to a receiver. If it is the first transaction, details such as medicine id and batch number are specified; otherwise, specify the previous transaction ' s hash (shown in Table 3). Once the receiver accepts the request, this transaction is uploaded to the blockchain network with the timestamp, current hash, previous hash, sender’s and receiver’s address. All the transactions will be first checked and then only uploaded on the network.

Table 3 Illustration of transaction list of TUC contract for batch number- 4020025380 of Table 2

1.2.4 System functionality

In this section, we will understand how our proposed model will work. In Fig. 3, we can observe the medicine flow from a pharmaceutical company to a customer, with distributor and retailer ( or wholesaler, hospital) as mediators. It shows the process of registration of medicine and the deployment of the corresponding BAC contract. The method of batch addition and, with it, the deployment of the TUC contract. The process of storing transactions in the TUC contract. Moreover, the method for a customer to check the medicine source is discussed. To summarize, we will observe the steps involved in the registration of medicine, the addition of batch, and the transferring (or exchanging) of a batch. Let us understand each step.

Fig. 3
figure 3

Flow of information and medicine

Contract deployment

The platform administrator deploys the MRC contract on the blockchain network and publicly shares its address. Later, when a pharmaceutical company registers a medicine by calling the register () function on the MRC contract, the BAC is automatically invoked. Moreover, when a batch manager creates a new batch by calling the addBatch() function on the BAC contract, a TUC contract is automatically deployed. The deployed BAC and TUC contracts store batch details of medicines and transactions related to a batch.

Medicine registration

The pharmaceutical company registers a medicine by calling the register () function on the MRC smart contract. It needs to provide all the required information to the agreement (as shown in Table 1). Parallelly, the MRC contract automatically deploys a BAC (name it as BAC A) on the network and adds its address to the registration details. Steps 2 to 5 of Fig. 3 shows the registration of medicine. Now, the pharmaceutical company ' s batch manager divides the medicines into batches and stores the information (as shown in Table 2) of each batch. For storing this information, the batch manager employs the addBatch() function of the BAC A contract. Parallelly with the function call addBatch(), a TUC A1 contract is deployed, and its address is stored in the BAC A contract. Steps 6 to 9 of Fig. 3 shows this addition of batch.

Medicine buyer-seller consensus

For transferring a batch of medicine, proper communication and tracking system must be present. This section will discuss how a buyer and seller come to a consensus on medicine transfer. An elaboration of step 10 in Fig. 3 is shown in Fig. 4. Let us discuss this process step-by-step. 1.) For requesting a medicine, a buyer calls the buyRequest() function. The buyRequest() function parameters stores buyer, seller Ethereum address, and medicine id. Finally, it is signed by the buyer’s private key to authenticate the transaction. 2.) At first, a seller with available medicine checks the validity of the request. After validation, a buyer then calls the requestResponse() function as a response to the seller. This transaction includes information of a buyer ' s Ethereum address, seller ' s Ethereum address, medicine id, and finally, the buyer ' s signature. 3.) Now, when a seller ships medicine, the sendMedicine() function is called. It is required to prove that the seller has shipped the medicine. The sendMedicine() function contains details of a seller ' s Ethereum address, buyer ' s Ethereum address, medicine id, batch number, and finally signed by the seller ' s private keys. 4.) When the buyer receives the medicine shipment, he calls the function receiveMedicine() to endorse the shipment. To call the function receiveMedicine(), the buyer provides the buyer ' s Ethereum address, seller ' s Ethereum address, medicine id, batch number, and then finally signs it with his private keys.

Fig. 4
figure 4

Seller-buyer consensus

After fulfillment of the consensus between buyer and seller, the buyer finally initiates a transaction using the updateTran() function of the TUC (TUA A1, according to Fig. 3) contract for updating the status of a batch.

The above procurement process was for the transfer of medicine from a pharmaceutical company to a distributor. Similarly, medicines are transferred from distributors to wholesalers and from wholesalers to retailers. This process is shown in steps 12 to 15 of Fig. 3. In Fig. 3, we have omitted the entity wholesaler for reducing redundancy.

Customer query procedure

Customers can enter the network by either becoming a full or light node. After becoming a node, a customer can verify the medicine ' s source and journey by using the product id and batch number present on the medicine container. This process of customer query is shown in step 16 of Fig. 3.

Authorization of actors

Any authorized actor can quickly authorize a new actor into the network. Using the registerActor() function and entering a new actor ' s address, an authorized actor can authorize a new actor.

1.3 System implementation

To implement the medical supply chain using blockchain, we have used local network through Truffle Suite [64] for creating the required environment. Using the Ganache-Cli [65], part of Truffle Suite, we created a test private blockchain network on the system [66]. Ganache allows us to create multiple local accounts, which is ideal for developing and testing smart contracts. The IDE (editor) of choice was Visual Studio Code [67], an open-source editor for macOS, Linux, and Windows operating system. Visual Studio Code supports many languages through extensions that are required for this setup. A few of the required languages for this implementation are Solidity, JavaScript, and HTML-CSS (Table 4) [67].

Table 4 Developing environment

The decentralized application often used in Distributed Ledger Technology, such as Ethereum, and Hyperledger Fabrics. DApps have their backend code running on a decentralized peer-to-peer network whereas the frontend code and user interfaces written in solidity and serpant language that can make calls to its backend. The main feature of a DApp is to connect the features of smart contracts with a web application. Smart contracts are the ruling factor in a decentralized app. With the help of HTML and CSS, we can design a front-end, and with the use of JavaScript, we can connect smart contracts to the front-end. A popular JavaScript library in the Ethereum world, Web3.js, is used for interactions with the blockchain network. Users can easily interact with a DApp, as it provides a user-friendly UI. Figure 5 shows how a user interacts with the DApp and how a DApp can interact with the blockchain network. A user can invoke any function on the DApp, and it will interact with the blockchain as its backend. For a functional DApp, it is first required to deploy a smart contract. After deploying a smart contract on EVM, the EVM returns an automatically generated Ethereum address. This Ethereum address enables users to interact with the smart contract. With our system, we have initially deployed the MRC contract. Hence, the Ethereum address returned after deploying the MRC contract will be saved in the DApp for further interactions. The other contracts will be deployed automatically once invoked by the MRC on a user’s request.

Fig. 5
figure 5

User-DApp-blockchain relation

As our intention was only to test the proposed model; hence, we choose to test the network locally. By using the Truffle, we created a local Ethereum environment. A local network is stored and processed entirely on the local memory. This local environment helps us to develop in real-time, as transaction delay is very minimal. First, it is always recommended to check and verify the smart contracts in a local environment before pushing them onto the main Ethereum network. After successfully implementing the local network, we needed to check our work on an Ethereum test network [68]. Hence, we used the Kovan test network [69]. This is to make sure that our contracts are functioning correctly. The required gas amount to deploy our contract on the Kovan test network is taken from Kovan Authenticated Faucet [69].

As discussed earlier, there are three essential contracts for the implementation of the medical supply chain using blockchain. Let us discuss their algorithm lucidly.

The system administrator deploys the MRC contract. It is employed for registering and checking the registered medicines. When registering a medicine, the MRC contract appends a BAC contract address with it. The algorithm for the register () function used to register a medicine is shown in Algorithm 1. 1.

The automatically deployed BAC contract is employed to store batch details of medicine. The BAC contract function addBatch(), explained in Algorithm 1.2., is used to create. It also deploys a contract TUC that stores transactions related to a batch.

TUC contract stores all the transactions related to a batch. The function updateTran(), in the TUC contract, is used for adding information of batch exchanges. Algorithm 1.3. defines the pseudocode for updateTran(). With the help of the TUC contract, a drug can be tracked and therefore authenticated, as explained in Section 1.3.4.

1.4 Experimental assessment

In this section, we share the outcome of the system implemented.

1.4.1 Implementation result

Initially, the contracts are tested on a local private network using the truffle suite. Figure 6 shows the deployment of contracts on the local private network. Here, the values of different parameters such as transaction hash, Blocks, contract address, block number, block time stamp, account, balance, gas used, gas price, value sent, and total cost were addressed through Medicine Registration Contract (MRC), Batch Addition Contract (BAC), and Transaction Update Contract (TUC). After successful local testing, the smart contracts are deployed on the Kovan test network for a better gas consumption calculation.

Fig. 6
figure 6

Contract deployment on Truffle (private network)

At the time of deployment in Etherscan at Main Network on Ethereum.org platform, the gas price involves for execution process of smart contracts for Medicine Registration Contract, Batch Addition Contract, and Transaction Update Contract was given below in Table 5 (USD).

Table 5 Contract deployment gas fee

The cost of deploying smart contracts is shown in Table 5 (the conversion rate of ETH to USD may vary).

After testing the smart contracts, the decentralized app is deployed. Figure 7 shows the registration page of the medicine. This page allows the authorized pharmaceutical companies to register a new medicine and provide information about the previously registered medicines. Here information about different drugs is arranged according to their serial number, expiry date, name, owner ' s address, BAC address, and timestamp. A bottom section is provided for registering a new medicine. It requires the medicine name, id, and expiry date for a successful registration.

Fig. 7
figure 7

Medicine registration page

Coming to Fig. 8 shows the batch information related to a medicine id. As shown, this page provides a section to enter medicine id. Entering a medicine id and clicking the “ok” button gives the medicine’s information, and also, all its existing batches are displayed. To add a new batch, a user can click on the “Add Batch” button, and it will redirect them to the batch addition page.

Fig. 8
figure 8

Medicine batch information page

The webpage, shown in Fig. 9, displays the batch related information. By entering the medicine id and batch number, a user or customer can check a medicine journey. It shows all chains of exchanges that took place for a drug in the form of transactions. These events are shown with their transaction hash, sender ' s address, receiver’s address, and previous transaction hash. For the authorized user, an option is present for updating the transaction details by entering the last transaction and receiver’s address.

Fig. 9
figure 9

Batch transaction update page

1.4.2 System security and analysis

The proposed medical supply chain using a blockchain-platform satisfies the following system security requirements.

Data immutability

The proposed system allows the addition of authorized nodes, and these nodes can add information to the network. Once inserted, the information is saved permanently in the form of a transaction. As this is a blockchain network, any transaction made is immutable.

Data transparency

The proposed system stores all the information about medicine, its batch, and exchange. Moreover, the system permits access to this information to every node on the network. Thus, anyone on the blockchain network, let it be a customer, a pharmaceutical company, distributor, or wholesaler, can access the information present on it, hence making the information transparent.

Automation and integration

By employing smart contracts in our system model, we have uplifted the activities’ automation. Moreover, by using smart contracts, it is possible to enforce a step-by-step procedure for all actors. Each actor needs to fulfill some predefined conditions, succeeding it, their transaction will be identified as valid in the system. This obligation ensures that the information is stored correctly. Furthermore, as all the actor needs to work together, it brings integrity in the system.

1.4.3 System comparison

In this section of the paper, we have compared our system of the medical supply chain with the other papers discussed in Section 1.2.3. Table 6 shows the result of the comparison.

Table 6 System Comparison

Decentralization

As we have introduced blockchain into our medicine supply chain, we have distributed our network’s access and control to every actor in the supply chain. Moreover, even the customers are granted access to the information present on the network. This decentralization of information reduced the monopoly and tempering done by a centralized organization and reduced fraud by a third-person. Hence, making our system highly decentralized and transparent. The system proposed in [47] is a centralized and non-distributed network. Due to this reason, it is prone to frauds privately by organizations or other third-person.

Transparency

Our system allows all the authorized medical supply chain actors to add information to the network. Also, all customers can access the data on the network by becoming a partial or full node. Through this, they can check the authenticity of the medicine. In contrast, in [45], being a permissioned network, the drug supply chain model does not allow customers to enter or check medicine information. Hence it is less transparent.

Scalability

As our medical supply chain system is on a public network, it is easy to add members into the system. A new actor, who wants to update a transaction on the network, can quickly be authorized with any authorized actor ' s request on the network. Moreover, the information on the network is public; hence, anyone can access it. Besides, many extension points are also provided in our network to increase the scalability. Similarly, all the other models in this comparison also offer scalability features.

User-friendliness

The DApp we prepared is easy to use. Actors or customers can easily interact with it. It has clear and simple steps for updating and accessing information present on the blockchain network. The proposed model in [45, 57] does not provide a user-interface or DApp. Hence, the operations in both these models need to be executed via some high-level instruction, which is difficult for a layperson to understand.

2 Conclusions and future direction

In the paper, we proposed the drug traceability and transparency of a medical supply chain system using the blockchain. This blockchain-based medical supply chain’s key feature is to system stores all the medicine batch ' s transfer history, register a medicine, batch-manager uploads its details on the platform ' s network, further exchange of this batch needs both sender and receiver ' s approval on exchange, and exchange transaction is permanently stored on the network. This can eliminate the possibility of a third-person fraud. Lastly, we made a DApp (Decentralized Application) for the tracking of the medical supply chain. The test result indicates that our system is decentralized, transparent, and provides automation and integrity.

The medical supply chain ' s future work using blockchain may include the following features: 1) Quality check report to be uploaded for each batch of medicine. 2) The use of IoT for inculcating integrated chip that can automatically update a batch ' s location, temperature, and other physical conditions periodically. 3) Using QR to update a batch ' s status effortlessly. 4) Introducing other healthcare products into the system.