Solving The Opioid Crisis With Blockchain

Girik Narang
14 min readSep 3, 2022

Utilizing Blockchain Technology to Create Accountability, Transparency, and Decentralization in Opioid Prescription Tracking

Photo by Moussa on Pexels

Take a second to really internalize this: a friend or family member is suffering from some terminal condition, and you’re concerned that the pain may be too much for them to bear. But you feel somewhat relaxed because they received prescription opioids from one of your city’s finest and most trustworthy clinicians. Fast forward a few weeks, and you begin seeing them recover. It seems like everything is going according to plan until, one day, you get a call. It turned out your loved one had been discreetly doctor shopping and receiving several times their necessary dosage.

Your loved one died from an overdose.

Unfortunately, stories like this recur quite frequently. In fact, roughly 115 Americans die after overdosing on opioids EVERY SINGLE DAY. These pharmaceuticals are easily misused due to the production of euphoria and pain relief. In light of these effects, regular use (even through valid prescriptions) can yield dependence and addiction, hence why the abuse of pain relievers often leads to overdose and death.

Percent Increase of Overdose Deaths in the US (2014–2018)

It is important to note that opioids are designed to block pain signals between the brain and the body, making them different from other classes of drugs. The most common types you will likely hear about are heroin and legal pain relievers like oxycodone, hydrocodone, codeine, and morphine. These pain-relieving opioids can be safe when prescribed for the right reasons and duration, but as you can imagine, this isn’t always the case.

By calculating healthcare expenditures, addiction treatment, and criminal justice involvement, the Centers for Disease Control and Prevention (CDC) estimates that prescription opioid misuse has an average economic burden of $78.5 billion annually in the United States.

Total and Projected Costs of the Opioid Epidemic in Billions (2016)
Total and Projected Costs of the Opioid Epidemic in Billions (2016)

To make matters worse, the existing prescription tracking system in the US lacks the technical infrastructure to address this crisis effectively. In particular, the prescription marketplace is rife with:

  • Fraudulent Prescriptions
  • Doctor Shopping
  • Data Hoarding
  • Vulnerable and Centralized Data
  • Lack of Clinician Accountability
  • Synthetic Alternatives

Attacking the opioid crisis requires an approach to prescription monitoring that makes pharmaceuticals safer and encourages providers to write fewer prescriptions. Providers today are economically incentivized to prescribe opioids to patients. Consequently, clinicians often spend less face-time with patients, thereby lowering costs associated with patient treatment and increasing their financial returns.

Likewise, pharmacies today are encouraged to produce and distribute opioids because the more pharmaceuticals sold, the greater their earnings, which also increases shareholder value. Patients themselves are also urged to consume opioids. For example, physical therapy in pain treatment can be highly frustrating and filled with disappointment. Opioids provide short-term relief and a sense of euphoria, which often leads to patient addiction. This self-reinforcing cycle can be alleviated by a technical approach that realigns priorities for patients, providers and pharmacies.

Key Challenges Faced by Current Approaches

PDMPs: With the widespread problem of opioid misuse in the United States, federal, state, and local governments have begun efforts to implement prescription drug monitoring programs (PDMPs). The agency responsible for the administration of the PDMP varies by region and includes the state’s regulatory, administrative, and law enforcement agencies. However, they still do not fix the fundamental problems with how clinicians and pharmacies are economically incentivized to prescribe opioids.

Traditional Prescription Tracking System
Traditional Prescription Tracking System

The diagram above depicts a scenario where a patient attempts to request an opioid prescription. In this conventional approach, the patient is required to present a state-issued ID as proof of their identity. Providers (Provider A and Pharmacist B) within the same state can exchange prescription data of the same patient using their provided ID through case reporting enabled by statewide PDMPs. However, the state-by-state siloed implementation of PDMPs limits interoperability beyond state lines. As a result, when the same patient visits another provider (Pharmacist C), Pharmacist C is unaware of the patient’s previous prescription activities, which creates a loophole in the system that patients with opioid addiction can exploit to doctor shop across states and obtain more than the necessary opioid dosage.

Now in all fairness, PDMPs still provide an important contribution to the fight against opioid abuse. Nonetheless, the following challenges remain largely unresolved:

1. Lack of Interoperability Between States: PDMPs create one statewide electronic database to contain data on administering particular substances. While these databases are a necessary first step, their state-by-state implementation restricts the interoperability of states, which is explicitly concerning for a country like the US.

2. Vulnerability of Centralized Databases: Maintaining one central database raises the risk of losing all data through a single hack or cyber-attack.

3. Reliability and Consistency of Information: Physicians using existing PDMP databases are often dissatisfied with data reliability and consistency.

Blockchain

Blockchain is a rapidly evolving technology with potential applications for the opioid crisis and healthcare system–level issues related to data availability, interoperability, privacy and security.

For the purpose of this article, I won’t be going into all the specifics of blockchain and how it works beyond its advantage over a traditional centralized system, so if that’s a priority for you, review the following resources below before returning to this next section:

Fundamentally, blockchain is a distributed ledger technology that uses a peer-to-peer network to provide a shared, immutable, and transparent single-entry record of all the transactions that have occurred to all the network participants (also called nodes).

Using various cryptographic techniques, blockchain enables participants to interact (e.g. store, exchange, and access information) without preexisting trust. Additionally, no central authority exists in this system; instead, transactions are stored and distributed among all network participants in the form of blocks, which are linked together through the cryptographic hash of the previous block. Therefore, the network doesn’t have a single point of failure, so it is less likely to experience downtime. If a failure does ever occur, each device possesses a full copy of the blockchain, so data is never lost.

Blockchain interactions are also made known to all nodes and must be verified before the information is added to the network, which enables trustless collaboration between network participants while recording a time-stamped and immutable trail of all interactions.

Each Block Contains the Hashes of the Previous Block

Moreover, it’s crucial to note that blockchain systems can be classified into three types: public, private and hybrid. A public Blockchain has several member nodes connected in a decentralized way that allows anyone to participate, read, and report data to the chain. On the other hand, private Blockchains allow only authorized nodes to participate in the network and exchange digital assets.

Blockchain Transaction Process (Simplified)

In light of this, it makes sense to consider developing private blockchains where nodes across the country are interconnected and have access to all patient data, improving healthcare accountability and allowing tracking patient activity to be considerably more accessible. Specifically, I think there are two fundamental issues we can tackle using this approach:

  1. Ensuring the secure exchange and management of electronic opioid prescriptions throughout the country.
  2. Incentivizing the secondary use of clinical data to facilitate further research in this area.

Secure Exchange and Management of Electronic Opioid Prescriptions

Nowadays, it seems like the solution to any problem is to digitize whatever you’re dealing with. Especially when it comes to prescriptions, moving from paper to electronic prescribing minimizes (but does not eliminate) prescription theft and forgery, and facilitates tracking of prescription histories for prescribers, pharmacists, and patients. However, current PDMP programs are outdated and insufficient, and I believe blockchain is the missing piece of the puzzle.

For starters, the current problems with managing electronic prescriptions all involve centralization. By switching to an interoperable and decentralized model, clinicians will no longer be able to overprescribe without arousing suspicion, and patients won’t be able to doctor shop freely since all health institutions will have identical databases. On top of all that, data will be less vulnerable and much more available for research.

An intriguing concept to explore is using clinicians as “nodes” to verify prescriptions. Based on the medical history and information already documented on the blockchain, clinicians can anonymously verify each other’s prescription transactions and raise red flags whenever deemed necessary. This allows for a self-sufficient and autonomous database in which there is little to no need for a single central authority to hold medical professionals liable for their decisions.

Incentivizing Secondary Use of Clinical Data

One of the most prominent challenges relating to opioids and other pharmaceuticals — apart from the overdoses — is the lack of patient data available for research. To accurately address research issues and conduct real-time public health monitoring, it is necessary to possess a complete and precise picture of a patient’s trajectory over time, across providers, and between healthcare and non-healthcare settings. However, patient health data are often collected and stored in diverse information systems (e.g. emergency department registries and first responder data systems), which significantly lowers researchers’ access to real-world data for opioid-related treatment and public health surveillance.

In addition to access concerns, dealing with substance use data is slightly different because it mandates unique and detailed handling. Privacy and security are critically important, given that substance use disorder (SUD) opioid misuse remains highly stigmatized and is consequently classified as sensitive protected health information. This means they require extra protection and consent requirements, creating apparent barriers for opioid researchers and data exchange. Overcoming this deterrent is essential as SUD and associated treatment data are vital to understanding patient outcomes concerning treatment settings and treatment types.

During periods of crisis, where overdosing deaths skyrocket, patient data is deemed more valuable than ever to provide a proactive response to spikes in the near future, as opposed to a reactive one. In this case, blockchain’s interoperability and decentralization also make it the ideal solution. A model could be developed where patients could grant or deny permission to have their data used for research purposes or not in exchange for financial incentives associated with rehab (e.g. lower rehab costs or free therapy services). If agreed upon, the records can be stored instantaneously on the blockchain for medical researchers across to country to use for drug discovery, testing, classification, and ultimately, overdose prevention.

Building an E-prescription Smart Contract

Photo by James Harrison on Unsplash

If you’ve made it this far, it’s safe to say that you’ve got a reasonably solid background on both blockchain and the opioid crisis. Nevertheless, I continually got asked the same question when I explained these concepts to friends and family:

What would a prescription on blockchain actually look like?

Initially, I didn’t see any problem visualizing the smart contract since I was already familiar with them, but I understand this may not be the case for everyone. That’s why I decided to add this interactive portion of the article, as the best way to understand the ins and outs of a decentralized prescription would be to create one yourself.

If you’re new to programming or Solidity, don’t worry; I will keep this section as straightforward as possible while highlighting the fundamental proof of concept. Now that we’ve established that, let’s get started writing and deploying our prescription!

Step #1: Setting up Your Workspace

Remix (Ethereum IDE) Homepage

After trying multiple IDEs, I found Remix to be the best since there is no installation or need to open the terminal, which keeps it simple for newer developers. To follow along, set up your workspace with a solidity file and name it prescription.sol.

Step #2: Declaring License + Solidity Version

For starters, I declared an MIT license, which permits users to reuse code for any purpose. When announcing the solidity version, I recommend going with the latest one (unless you are following an older tutorial or a feature you require is no longer available).

// SPDX-License-Identifier: MITpragma solidity ^0.8.15;

In this case, the ^0.8.15 means that the code is written in version 0.8 of the Solidity programming language and will compile for Ethereum contracts running on the EVM (Ethereum Virtual Machine) at a gas cost of 15 Gwei per operation.

Step #3: Define A Contract

Next, define a contract using the “contract” statement.

contract prescription {

Step #3: Add Prescription Data Points

This is where we write the prescription layout and customize the information that is added to the blockchain in the form of “strings”. Feel free to add or remove any sections based on the data you prefer to store.

struct prescriptionInfo {uint id;string patientFullName;string age;string prescriptionHistory;string clinicianFullName;string licenseType;string NPInumber;string prescriptionName;string NDCDrugID;string dosageMlMg;string additionalNotes;bool dataUsageAgreement;}

Step #4: Mapping

Mapping in Solidity acts like a hash table or dictionary in any other language and is used to store the data in the form of key-value pairs.

mapping (uint => prescriptionInfo) public patientsById;uint public patientCount;

Step #5: Storing Data Points In Memory

Now we’re writing a function to add our data points to string memory, which you can imagine as RAM for the smart contract.

You may also notice that the last line is slightly different from the rest, which is entirely intentional. As opposed to the other variables, the data usage agreement boolean will prompt a “true or false” response from the clinician to determine whether the patient has been granted permission for their data to be used for research purposes.

function addPrescription(string memory _patientFullName,string memory _age,string memory _prescriptionHistory,string memory _clinicianFullName,string memory _licenseType,string memory _NPInumber,string memory _prescriptionName,string memory _NDCDrugID,string memory _dosageMlMg,string memory _additionalNotes,bool _dataUsageAgreement)

Step #6: Returning Patient Count

This final part of the code effectively allows us to assign an I.D. to each patient and increase the patient count every time a new one is registered. This could be potentially useful for monitoring the frequency of prescriptions and patients dealing with a particular medical professional at a given time.

public {patientCount++;patientsById[patientCount] = prescriptionInfo(patientCount, 
_patientFullName, _age, _prescriptionHistory, _clinicianFullName, _licenseType, _NPInumber, _prescriptionName, _NDCDrugID, _dosageMlMg, _additionalNotes, _dataUsageAgreement);
}}

Step #7: Compiling & Deploying Our Smart Contract

Finally, we are ready to compile and deploy our contract. If you look at the third icon on the toolbar (circled in red) and see a green check mark, it means you’ve got the green light to start customizing your transaction. Typically, I would set the environment to one of the various test-net options that remix offers. However, the default Remix VM (London) will suffice for this next step.

Once everything looks good, you can click “deploy,” allowing you to interact with your prescription under “deployed contracts.” Recall that depending on the various variables you chose; your contract would appear different than mine.

So how did it go for you? Were you able to follow along successfully?

Now, as simple as this project seems, the reality is that a blockchain system capable of managing thousands of nodes and millions of patients mandates considerable resources and cooperation among various entities. This is why numerous barriers still prevent us from turning this concept into reality.

Challenges and Limitations

The use of blockchain in healthcare is still in its infancy. Further research and testing are required to determine whether applications for health care in general and areas that call for a high level of privacy protection are indeed feasible. Opportunities for short-term growth in the blockchain sector should focus solely or almost entirely on practical applications to identify further obstacles and constraints. The following are the fundamental limitations I’ve come across and believe are preventing us from progressing faster in this space:

  1. The adoption of blockchain in research is hampered by a fundamental lack of knowledge and comprehension of it. Researchers should be encouraged to use industry guidance to evaluate the viability of blockchain applications in the context of technological and policy constraints. By increasing awareness and fostering competencies among significant research partners, the community will be adequately equipped for implementation.
  2. Current standards for smart contracts are lacking. Given the fact that many blockchain applications rely on smart contracts, establishing better standards and guidelines can boost network interoperability.
  3. Sharing data can be challenging due to substance use treatment information’s legal and regulatory framework. To fully realize the potential for integrating substance use treatment records with other health care data to track patient outcomes over time, studies concerning the technical solutions for implementing blockchain in this complex ecosystem are required (taking into account various policy and privacy conditions).

Final Thoughts

Photo by Louis Reed on Unsplash

Researchers are now facing various difficulties in accessing and utilizing opioid-related data. In addition to the necessity for reliable, timely, high-quality data, opioid researchers must also deal with fragmented information systems and the need for substance use disorder (SUD) data privacy. In light of blockchain’s capabilities and its current use in other industries, it could serve as a facilitator in aiding in addressing these challenges by offering a solution to research, data management, and data exchange that is more efficient, secure, and privacy-preserving. The use of blockchain in ensuring the secure exchange and management of electronic opioid prescriptions while incentivizing the secondary use of clinical data has the potential to impact millions.

Even though there is a lot of opportunity in these blockchain applications, further research needs to be done to identify and handle infrastructure, scalability, sustainability, implementation costs, and governance issues. Policy concerns linked to bridging the necessity to develop high-fidelity data that safeguard patient privacy and autonomy in retracting consent to utilize their data for research and treatment should also be discussed.

Simply put, the opioid epidemic is a massive predicament for families, communities, and hospitals across North America, and there needs to be a better approach to solving it. While providing aid to those impacted by these narcotics is extremely necessary, there needs to be a more promising universal drug monitoring system to prevent the overprescription of these drugs and finally hold medical professionals accountable for their actions.

If you want to learn more about the opioid crisis and how blockchain could make a difference, I highly recommend checking out the resources below:

Let’s Connect!

If you enjoyed reading this article or learned something new, I’d love to connect on LinkedIn. If you’d like to stay updated on my recent articles or projects, you can subscribe to my monthly newsletter here!

--

--