Blockchain technology in the pharmaceutical supply chain: researching a business model based on Hyperledger Fabric S R Bryatov1, A A Borodinov1 1 Samara National Research University, Moskovskoye shosse, 34, Samara, Russia, 443086 e-mail: aaborodinov@yandex.ru Abstract. Pharmaceutical companies that manufacture, ship and supply products face difficulties in tracking their products, allowing counterfeiters to inject counterfeit drugs into the system. This situation is observed, in particular, in the Russian market of turnover of pharmaceutical products, although the problem has long been global. The ability of blockchain systems to pinpoint the origin of data makes them particularly suitable for pharmaceutical supply chain applications. The data stored in the blockchain distributed register on the identification of drugs produced by the plant, as well as records of their movements throughout the supply chain, can accurately determine the authenticity of pharmaceutical products lying on the shelves of pharmacies. The development and implementation of such a system can be a big step towards winning the exhausting fight against the easy availability of counterfeit drugs and medical products. In the first part of this work, the main characteristics and features of the functioning of blockchain systems will be studied. In the second and final part, the designed concept of the pharmaceutical turnover control system based on the blockchain technology Hyperledger Fabric using the Hyperledger Composer development environment will be investigated. 1. Introduction In a recent report by the world health Organization, drug counterfeiting has been identified as a global problem. It estimates that in low- and middle-income countries, every 10th drug in market circulation is counterfeit or has a poor quality [1]. The use of such substandard products may have a negative impact on the mortality rate. Medicines move through a supply chain in which several participants participate. These usually include the manufacturer, wholesaler and retailer. They are engaged in the production, transportation and sale of these products. Also in these systems, there is a key participant - the regulating authority responsible for each stage of the movement of batches of products throughout the chain. In particular, at the state level, this participant may be some authorized body of the state apparatus, for example, a special Agency for the control of turnover of medicinal products. Its main task is to delegate the rights to manufacture medicines according to state standards, as well as to control the movement of all units of goods ever produced. As for the consumer, there is another problem - the control of drugs, issued only by prescription. Dispensing without a prescription is illegal, however, the control of honesty of retailers, as well as with counterfeit medicines, is not easy and requiring a special approach. V International Conference on "Information Technology and Nanotechnology" (ITNT-2019) Data Science S R Bryatov, A A Borodinov Some pharmaceutical companies have already started implementing blockchain technology in drug supply chain management [2]. Blockchain is an electronic cryptographic registry based on a decentralized network model in which information is distributed and synchronized between all nodes in the network. This functionality is provided by a consensus algorithm deployed in the system to eliminate the problem of duplicate transactions, allowing nodes to verify the truth of information before it is directly written to the registry. In addition, this system has a high fault tolerance. The threshold for the number of failed nodes before a complete network failure depends on the total number of nodes connected to the network. Thus, the more nodes are functioning in the blockchain network, the less the probability of a complete system failure. A properly designed system based on blockchain technology can significantly simplify the process of drug turnover control for authorized state bodies [3-5]. At the same time, a decentralized approach has a number of advantages that increase the information security of such systems compared to centralized counterparts [6]. In section 1 of this work, the main characteristics and methods of functioning of blockchain systems will be studied. Section 2 is devoted to the study of the concept of the designed system for the control of drug turnover with regulation at the state level. 2. Blockchain networks 2.1 Blockchain technology Blockchain is a continuous chain of blocks containing information built according to certain rules. Most often, copies of block chains are stored on many different computers independently of each other. [2] The set of such computers assembled into a network operating under a single Protocol for adding new blocks to the chain, i.e. for conducting transactions, forms a Blockchain network [3]. Thus, the Blockchain network is a distributed information system that contains information about all transactions ever performed in the past and working on a pre-selected Protocol that determines the course of conducting and validating transactions, and the work of the entire network and its participants [4]. In addition, this network is usually called a distributed registry, as data about each transaction of such a network is stored on each node operating in it. There are three types of blockchain systems: 1. Public Blockchain (Permissionless Blockchain) 2. Consortium Blockchain 3. Private Blockchain In the public blockchain, each participant has the opportunity to see and verify any transaction taking place on the network, and can also participate in the consensus-building process. There is no administrative node in the public blockchain that checks transactions, the validity is achieved by consensus between the participants. Bitcoin and Ethereum are vivid examples of this type of networks. In the consortium blockchain there is an administrative node, which is selected by the network participants initially based on the optimal ways to achieve their business goals, for example, in the case of a partnership. Data in such networks can be public and private (for example, confidential information), so the network itself can be regarded as partially decentralized. An example of such a network is the Hyperledger platform. A private blockchain is similar to the previous type except for one aspect. All data of such a distributed registry is strictly closed to the public. Only members authorized by the administrative node can access the information stored on blockchain. Multichain or Hyperledger platforms can be used to build such solutions [5][6]. The choice of a particular type of network depends on the task. For example, for small businesses where accounting is maintained by a separate institution, a suitable option would be to use a private blockchain network in which a distributed registry would become a single source of truth. However, in a situation, for example, with the supply chain, where the consumer wants to know everything about the product, a consortium network will approach. Product data would be available to read by all V International Conference on "Information Technology and Nanotechnology" (ITNT-2019) 135 Data Science S R Bryatov, A A Borodinov participants, but only authorized nodes, for example, the seller, the factory and the supplier of raw materials, may record it. 2.2 Functioning of blockchain systems. Consensus mechanisms. A group of transaction in blockchain networks are combined into blocks of transactions that are connected to each other in the chain using the hash of the record of the previous block (figure 1). Figure 1. Blockchain systems chain structure Thus, the basic security mechanism of blockchain networks is implemented as a property of immutability. The farther the block is located along the chain (the older it is), the more protected from changes is the data enclosed in it. If an attacker tries to modify any of the blocks, the local registry will automatically cease to be valid, because the hash values inside the headers of the next blocks will be completely different, based on the mechanism of hash functions. The Blockchain system does not require a trusted third person for reliable registration of the transaction in the registry. Instead, decentralized consensus mechanisms are used to ensure that transactions are properly executed. In existing blockchain networks, the following are among the most popular [13]: 1. Proof of Work (PoW) 2. Proof of Stake (PoS) 3. Practical Byzantine Fault Tolerance (PBFT) 4. Delegated Proof of Stake (DPoS) In practice, solutions might also be a combination of such mechanisms. In the framework of the study we will focus on the algorithm Practical Byzantine Fault Tolerance (PBFT), which is based on the well-known problem of Byzantine generals [14]. To reach agreement in the network, this algorithm assumes that no more than 1/3 nodes will be unfriendly. The whole process can be divided into three stages: pre-training, prepared status and consensus-building. At each stage, a node enters the next phase if it receives votes from more than 2/3 of all nodes. Therefore, PBFT requires that each node is pre-known in the network. As a result, the final decision on the validation of the block is given to the third nodes trusted by the results of the general voting process. The Hyperledger Fabric platform[15], which will be discussed in the next Chapter, uses PBFT as a consensus algorithm. 3. Designing the information system of drug turnover control 3.1 Hyperledger Fabric platform The state plays a key role in the supply chain of medicines, as a universal regulator of interaction between the participants of the system. Only the state has the right to establish norms of relations between organizations and consumers, as well as only its bodies can be engaged in the registration of medicines and the issuance of licenses for their production, as well as the sale and issuance of prescriptions. Therefore, when designing a system for controlling the circulation of medicines, it was decided to take a private model of the blockchain network and make it administrated by some state- controlled agency. Thus, the Hyperledger Fabric platform, which offers a wide range of tools for building solutions based on private blockchain networks, became the basis of this project. Because Hyperledger Fabric-based networks are private, all of their nodes have different roles in the system. There are three types of such nodes: V International Conference on "Information Technology and Nanotechnology" (ITNT-2019) 136 Data Science S R Bryatov, A A Borodinov • Client peers. They are end users and have the right to place a transaction execution order. • Endorser peers. This type of node manages the execution and validation of transactions. However, not all nodes of this type are directly involved in the execution of the code of smart contracts [16-18]. To do this, there are special nodes-guarantors, which are selected based on the terms of the contract. • Ordering peers. Are engaged in formation of blocks of transactions and updating of the state of the distributed register. Also used in the configuration of the transaction by the network administrators. Created to simplify the change of consensus algorithm in the network if necessary. The current project is based on the Hyperledger Composer framework, created to simplify the development of blockchain-based systems based on Hyperledger Fabric. With it, you can get a single system configuration file, which can then be used by the administrator to reprogram the behavior of the entire network. Four different sources are required to successfully create the configuration: 1. Model files. 2. Transaction scripts. 3. Access control lists. 4. Query scripts. Model files define the structure of the main entities that are created in the distributed registry: assets, members, and transaction descriptions. Assets are digital property and documents, in this case it can be units of medicines, licenses and contracts between the participants of the turnover. Participants are the assets that contain basic information about the users of the system and their belonging to other assets. Transaction scripts describe smart contract code (chaincode) executed by proxy nodes. In this framework, scripts should be written in the popular JavaScript language. Access control lists define the rights of participants to access certain system resources, to read, write, and modify assets, as well as to execute the both system transactions and transactions created based on transaction scripts. Using query scripts, data can be easily extracted from the blockchain registry. They are usually used to display data in front-end applications or in the code of generated transaction scripts, thereby increasing the efficiency of re-use of already developed code. 3.2 Architecture of the proposed solution The following diagram shows the interaction of network participants with the designed distributed registry. Figure 2. The information exchange participants Each member of the system has its own specific rights to read data from the registry and perform transactions to modify it. To access a member card, the client application operator must be identified in the system based on private and public keys. V International Conference on "Information Technology and Nanotechnology" (ITNT-2019) 137 Data Science S R Bryatov, A A Borodinov Thus, the following types of information exchange participants can be distinguished in the developed system: 1. Government. It is both the administrator and the developer of the network and it owns all registry nodes. The Government account has the ability to register the other members of the network and make transactions for the issuance of licenses for the production of drugs to manufacturers. It also registers new drugs in the information system. 2. Manufacturer. Produces goods and takes orders from the pharmacy. The manufacturer's account has the ability to register units of medicines in the system based on a unique identifier (uuid), as well as to create transactions on the transfer of ownership of a unit of medicine to the pharmacy. 3. Pharmacy. Sells goods to citizens. Pharmacy account has the ability to create a transaction for the transfer of ownership of drugs to the citizen. If the drug is available without a prescription, make a note of the fact that the drug was sold, in another case, undertakes to pay to the registry information about the sale of drugs to the citizen, the account which has the right to buy a certain type of medication. The transaction is approved by the nodes if there is a doctor's prescription in the system with a link to this type of medicine and the buyer's account, as well as the number of possible purchases of units of drugs in the prescription is greater than 0. With each sale, this counter decreases. 4. Doctor. Writes a prescription to his patients (citizens), in which he makes a mark on the types of drugs and their quantity necessary for healing, as well as a link to the citizen's account and enters these data in the distributed register of Hyperledger Fabric. 5. Citizen. When buying prescription drugs, must present his virtual ID, referring to his account in the state register. Thus, the end of the lifecycle of the drug unit resource in the system is a mark by the pharmacy on the sale of a certain unit in the virtual doctor's prescription, as well as a mark on the unit of the drug of the last owner - a Citizen or the Government, if the drug was sold without a prescription. The following is a simplified relational model of connections between the system assets (figure 3): Figure 3. Simplified relational model of the proposed solution. The arrows with the “+” sign in the diagram above define transactions that create a specified asset by a specific network member. Dashed arrows indicate the relationship between the assets by the foreign key. V International Conference on "Information Technology and Nanotechnology" (ITNT-2019) 138 Data Science S R Bryatov, A A Borodinov 3.3 Principles of operation of the designed information system. Strengths and weaknesses The drug control system is still under development, so it is not possible to provide a final list of the main transactions of the system at this stage. However, we can distinguish the main ones, giving an approximate picture of the functioning of the working prototype. For clarity, we will follow the full lifecycle of the pharmaceutical product: 1. The Governement develops the specification of the medicinal product and registers the new medicinal product in the distributed register by means of the transaction of creation of the “Type of medicinal product” asset. In order to enable production, it also registers a “production License” and issues it to the registered participant-manufacturer, indicating a link to his account. If it revokes a license, a transaction marks the license as “invalid”. There is also a need for a transaction to prolongate it. 2. The Manufacturer creates a “Medicine”, identifying it with a unique code, puts a link to the “Type of medicine” and fills in the fields on the expiration date. 3. The Pharmacy produces the “Order” and notes the amount of the desired product and its type. During the execution of the order, the manufacturer binds to this asset links to the unique unit numbers of the goods from the warehouse. It also makes transactions to change the status of the order. Upon delivery, the "owner” field on the drug unit becomes equal to the ID of the recipient, i.e. pharmacy. 4. The Doctor writes out a “Prescription” to his patient. A Citizen buys medicine, providing his digital medical policy, which in this case is tied to the asset of his account. It also contains a link to the provided recipe. In the pharmacy, a sale transaction takes place, which becomes successful only in the case of the non-zero balance of the counter for this type of drug in the client's prescription. The Citizen becomes the owner of both real and virtual unit of medicine. Thus, each licensed unit of medicine leaves a unique trace in the register, which can be easily tracked in the event of disputes. The application of this system in practice should simplify the process of control over the official supply chains of medicines. Transparency of the system will motivate its participants to comply with the rules established by the law. The weaknesses of this project include the following limitations: • The proposed system is able to detect only the movement of drugs, which follow an official supply chains, which are known to the regulatory agency. It cannot track counterfeit drugs that are distributed along routes outside the official chains. • The proposed system will be developed and tested in a controlled simulated network; therefore, the results of the following studies may not reflect actual performance in real-world deployment. 4. Conclusion At this stage, a relational model is implemented, the main participants of the system and their roles are thought out. Development of the project continues. The next stage will be the development of smart contract transaction scripts and access control lists. After completing the development of a prototype model of the system, it is expected to conduct several tests on virtual machines running Ubuntu 18.04. If successful, the next step will be the creation of a front-end architecture for easy access of users to the designed system. Blockchain technologies are still quite young and it is impossible to say with accuracy whether they will take root in the future due to many of their conceptual limitations. However, such studies, as a system of control over the circulation of medicines, can later become an example for the emergence of more advanced solutions for automating the processes of the state apparatus with the maximum level of information security on the processing of data. 5. References [1] World Health Organization. 1 in 10 medical products in developing countries is substandard or falsified: WHO urges governments to take action URL: http://www.who.int/en/news- room/detail/28-11-2017-1-in-10-medical-products-in-developing-countries-is-substandard-or- alsified V International Conference on "Information Technology and Nanotechnology" (ITNT-2019) 139 Data Science S R Bryatov, A A Borodinov [2] Kim H M and Laskowski M 2018 Toward an ontology-driven blockchain design for supply- chain provenance Intelligent Systems in Accounting, Finance and Management 25 18-27 [3] De Filippi P and Hassan S 2016 Blockchain technology as a regulatory technology: From code is law to law is code First Monday 21 [4] Bocek T, Rodrigues B B, Strasser T and Stiller B 2017 Blockchains everywhere - A use-case of blockchains in the pharma supply-chain Proceedings of the IM IFIP/IEEE International Symposium on Integrated Network and Service Management 772-777 [5] Rodrigues U R 2019 Law and the blockchain Iowa Law Review 104 679-729 [6] Plotnikov V and Kuznetsova V 2018 The Prospects for the Use of Digital Technology “blockchain” in the Pharmaceutical Market MATEC Web of Conferences 193 [7] Wikipedia, Blockchain URL: https://en.wikipedia.org/wiki/Blockchain [8] Dennis R, Owenson G and Aziz B 2016 A temporal blockchain: A formal analysis International Conference on Collaboration Technologies and Systems 430-437 [9] Singh S, Singh N 2016 Blockchain: Future of financial and cyber security 2nd International Conference on Contemporary Computing and Informatics 463-467 [10] Hackernoon URL: https://hackernoon.com/3-popular-types-of-blockchains-you-need-to-know- 7a5b98ee545a [11] Zheng Z, Xie S, Dai H, Chen X and Wang H 2017 An Overview of Blockchain Technology: Architecture, Consensus, and Future Trends IEEE 6th International Congress on Big Data, BigData Congress 557-564 [12] Sylim P, Liu F, Marcelo A and Fontelo P 2018 Blockchain technology for detecting falsified and substandard drugs in distribution: Pharmaceutical supply chain intervention Journal of Medical Internet Research 20 [13] Zheng Z, Xie S, Dai H, Chen X and Wang H 2016 Blockchain challenges and opportunities: A survey Internat. J. Web Grid Serv. [14] Wikipedia, Byzantine fault tolerance URL: https://en.wikipedia.org/wiki/ Byzantine_fault_tolerance [15] Hyperledger Project URL: https://www. hyperledger.org/ [16] Werbach K and Cornell N 2017 Contracts ex machina Duke Law Journal 67 313-382 [17] Casado-Vara R, González-Briones A, Prieto J and Corchado J M 2019 Smart Contract for Monitoring and Control of Logistics Activities: Pharmaceutical Utilities Case Study Advances in Intelligent Systems and Computing 771 509-517 [18] Jaccard G O B 2017 Smart contracts and the role of law Jusletter IT V International Conference on "Information Technology and Nanotechnology" (ITNT-2019) 140