From medical records to Merkle trees with IPFS

Be prepared for the blockchain discussion by improving your knowledge of Merkle trees and Merkle-DAGs. Do you know how they relate to healthcare?

arrow shaped trees taking flight
Shutterstock

It’s the application of technology, not the technology itself, that provides for business transformation. Making the connection between how the technology works and how it applies to healthcare can be perplexing. Today, we’ll untie the knot of Merkle trees and Merkle-DAGs and connect these innovations to healthcare.

A Merkle tree

Hash values are numeric values, created from data. Hash values uniquely identify data and provide a “digital fingerprint.” These values are used to validate that data has not been tampered with or altered.

The Merkle tree was named after Ralph Merkle, one of the inventors of public key encryption and a researcher on cryonics (suspension and storage services of humans). In 1979, Merkle wrote a paper titled "Secrecy, Authentication and Public Key Systems," in which he presented his thesis findings on cryptography.

The Merkle tree is a cascading network of hashes (or hash trees). This binary tree structure is used to condense transactions that are hashed into a block. The Merkle tree structure is important because it allows miners to verify the hashes of blocks. Think of a tree with all the minor branches connected into larger branches, which eventually connect to the trunk of the tree or the “root hash.”

For example, let’s assume you have a single block and you want to verify the authenticity of that block. You will first need the root hash (a collection of block hashes) and the blocks in the transaction tree (or series) that together will allow the reconstruction of the hash tree for blocks that you didn’t generate.

Objects in a typical Merkle tree are linked together by block's transaction sequence. Therefore, you need all or some of that transaction history (collection of hashes) to confirm authenticity. At some point, scale becomes a challenge or at minimum a point of discussion.

A Merkle-DAG

A Merkle-DAG is similar to a Merkle tree in that they both are essentially a tree of hashes. A Merkle tree connects transactions by sequence, but a Merkle-DAG connects transactions by hashes. In a Merkle-DAG, addresses are represented by a Merkle hash. This spider web of Merkle hashes links data addresses together by a Merkle graph. The directed acyclic graph (DAG) is used to model information. In our case, modeling what address has stored specific data.

It’s useful to know that different blockchains (Ethereum, Bitcoin, Lisk, MultiChain and Eris) use a variety of implementations of Merkle trees or similar structures.

The healthcare connection

Let’s put it all together: Merkle trees are used to verify something.

Simply stated, Merkle tree data structures provide state verifications for data. The knowledge of the state also becomes useful when we’re talking about healthcare. For example, we can answer the queries such as "Tell me the last time you had a physical” or “Did you have a blood test done during your last appointment?” We just become much smarter.

By keeping the states in a Merkle DAG (or hash chain) nodes can verify the validity and correctness of states. The verified state can also be used for searching. It is not possible for nodes to lie or change a past state. Therefore nodes cannot change or falsify content. This results in nodes not having to trust each other.

Another interesting beast is the Merkle computer, where the state changes are hash-linked sequentially (think serial log). Merkle trees are used to verify the state.

Allow me to provide an example. Let’s assume we have three patients: patient A, patient B and patient C. It’s unlikely all health events from patient C will neatly follow all the health events of patient A and patient B. Most likely, health events for all three patients will be in random order.

Merkle-DAG structures can be used to verify the state of hashes. When used in combination with a Merkle computer, we could process through a list of health events to construct a chronological history of the patient — e.g., healthcare events for patient A, then patient B and lastly patient C, even if the actual events were out of our desired grouped sequence.

The new discussion

Does it scale? Will this evolve into existence or fade into extinction? Many questions remain to be solved. We don’t have all the answers. We rarely do.

However, I'm sure of one thing: IPFS and blockchain will gain momentum in healthcare. Interest in these areas will continue to grow as leaders better understand the technological impact on the business of healthcare delivery.

Rest assured, you’re better prepared for the blockchain discussion with an upgraded understanding of Merkle trees.

This article is published as part of the IDG Contributor Network. Want to Join?

Time is running our to share your experience. Take the 2019 State of the CIO survey today!