Using Ethereum blockchain to store and query pharmacogenomics data via smart contracts

Gamze Gürsoy, Charlotte M. Brannon, Mark GersteinbioRxiv 2019 · DOI

TL;DR

This paper presents two Ethereum smart contract solutions for securely storing and querying pharmacogenomics data. They demonstrate that blockchain can offer efficient and practical solutions for managing sensitive biomedical data, with an optimized "fastQuery" version significantly improving query times.

What Problem Does This Paper Address?

Precision medicine relies heavily on pharmacogenomics data, which links genetic variations to drug responses. As this data becomes more integral to patient care, secure and efficient storage and sharing are paramount. Traditional databases can be vulnerable to single points of failure, corruption, or unauthorized access. The paper addresses the challenge of creating a robust, immutable, and accessible system for this sensitive data by leveraging the Ethereum blockchain and smart contracts. The 2019 iDASH competition highlighted the need for time- and space-efficient smart contracts for secure genome analysis, motivating the development of such solutions.

Methods

The authors developed two smart contract solutions on a private Ethereum blockchain using Solidity.

  • Challenge Solution: This approach uses an "index-based, multi-mapping" data structure. It stores pharmacogenomics observations (gene, variant, drug, outcome, etc.) in a primary mapping, keyed by a unique index. Three additional mappings act as indexes for gene names, variant numbers, and drug names, each pointing to arrays of relevant observation indices. This allows for efficient retrieval by querying one to three fields.
  • fastQuery Solution: This is an optimized version that improves query efficiency by pooling gene-variant-drug relations during insertion rather than during querying. It uses a similar index-based structure but stores a single struct for each unique gene-variant-drug combination, along with aggregated counts for outcomes and side effects. This design aims to reduce the number of indexed entries and prevent indefinite database growth.

Both solutions were tested on a private, proof-of-authority test network using the Truffle framework.

Datasets

The paper does not describe specific, pre-existing public datasets used for training or evaluation. Instead, they generated synthetic datasets for testing, simulating pharmacogenomics observations. The evaluation involved inserting up to 1000 entries into the smart contract storage, with data inserted in batches of 25, 50, 100, and 200 observations at a time.

Key Insights and Ideas

  • Blockchain for Biomedical Data is Viable: The research demonstrates that blockchain technology, specifically Ethereum smart contracts, can be a practical and efficient solution for managing sensitive biomedical data like pharmacogenomics information, addressing concerns about security, immutability, and accessibility.
  • Index-Based Structures are Key: The core innovation lies in using index-based, multi-mapping data structures within smart contracts. This approach significantly reduces the computational overhead for querying compared to naive linear scans.
  • Trade-offs in Data Pooling: The "fastQuery" solution highlights a trade-off: pooling data during insertion (to create unique gene-variant-drug relations) leads to substantially faster queries, especially for complex queries, at the cost of potentially more complex insertion logic.
  • Scalability Challenges Remain: While the solutions handle up to 1000 entries efficiently, the inherent limitations of blockchain transaction costs and processing times suggest that scaling to much larger, real-world genomic datasets would require further optimization or hybrid approaches.

Key Results

  • Insertion Performance:
    • The challenge solution took approximately 67 seconds to insert 1000 entries, with linear time complexity and constant memory usage (around 500 MB). Disk usage grew linearly, reaching about 80 MB for 1000 entries.
  • The fastQuery solution showed a slight improvement, taking approximately 56 seconds to insert 1000 entries, with similar memory and disk usage.
  • Query Performance:
    • The challenge solution averaged around 300 ms for a two-AND query on 1000 entries, with linear time complexity and constant memory usage (around 5 MB).
  • The fastQuery solution significantly improved query times, averaging approximately 83 ms for a two-AND query on 1000 entries, with constant query time for 1- and 2-AND queries. Memory usage remained constant at around 5 MB.
  • For the challenge solution, 0-AND queries were slower (around 1.6 s) than one- or two-AND queries. The fastQuery solution showed a similar trend, with 0-AND queries taking around 400 ms.

Limitations and Future Work

  • Scalability: The study was limited to datasets of up to 1000 entries. The authors acknowledge that scaling to larger, real-world datasets will require further optimization.
  • Development Complexity: Developing smart contracts on Ethereum is complex and requires specialized knowledge. While external scripts can simplify usage, underlying software issues (e.g., with web3.js) were noted.
  • Future Work: The authors suggest that their solution designs could be adapted for other types of clinical trial data and any field requiring high-integrity data storage and efficient access. They also acknowledge the need for more platform stability before widespread adoption for shared databases.

Summary updated

Abstract

Abstract Background With the advent of precision medicine, pharmacogenomics data is becoming increasingly critical to patient care. These data describe the relationship between a particular variant in the genome and the response to a drug by the patient. As utilizing this kind of data becomes more integral to medical treatment decisions, appropriate storage and sharing of this data will be critical. A potential way of securely storing and sharing pharmacogenomics data is a smart contract with the Ethereum blockchain. This is an open-source blockchain platform for decentralized applications. A transaction-based, state machine, the “world” of Ethereum maintains user accounts and storage in a network state. Immutable pieces of code called “smart contracts” may be deployed to the Ethereum network and run on the Ethereum Virtual Machine when called by a user or other contract. The 2019 iDASH (Integrating Data for Analysis, Anonymization, and Sharing) competition for Secure Genome Analysis challenged participants to develop time- and space-efficient smart contracts to log and query gene-drug relationship data on the Ethereum blockchain. Methods We designed a smart contract to store and query pharmacogenomics data (gene-drug interaction data) in Ethereum using an index-based, multi-mapping approach allowing for time and space efficient storage and query. Our solution to the IDASH competition ranked in the top three at a workshop held in Bloomington, IN in October 2019. Although our solution performed well in the challenge, we wanted to improve its scalability and query efficiency. To that end, we developed an alternate “fastQuery” solution that stores pooled rather than raw data, allowing for significantly improved query time for 0-AND queries, and constant query time for 1- and 2-AND queries. Results We tested the performance of both of our solutions in Truffle (v5.0.31) using datasets ranging from 100 to 1000 entries, and inserting data at 25, 50, 100, and 200 observations at a time. On a private, proof-of-authority test network, our challenge solution requires approximately 70 seconds, 500 MB of memory, and 80 MB of disk space to insert 1000 entries (200 at a time); and 400 ms and 5 MB of memory to query a two-AND query from 1000 entries. This solution exhibits constant memory for insertion and querying, and linear query time. Our alternate fastQuery solution requires approximately 60 seconds, 500 MB of memory, and 80 MB of disk space to insert 1000 entries (200 at a time); and 83 ms and 5 MB of memory to query a two-AND query from 1000 entries. This solution exhibits constant memory for insertion and querying, linear query time for 0-AND queries, and constant query time for 1- and 2-AND queries in a database of up to 1000 entries. Conclusion In this study we showed that pharmacogenomics data can be stored and queried efficiently on the Ethereum blockchain. Our approach has the potential to be useful for a wide range of datasets in biomedical research; while we focused on gene-drug interaction data, our solution designs could be used to store a range of clinical trial data. Moreover, our solutions could be adapted to store and query data in any field where high-integrity data storage and efficient access is required.
BibTeX
@misc{gursoy2019using,
  author = {Gamze Gürsoy and Charlotte M. Brannon and Mark Gerstein},
  title = {{Using Ethereum blockchain to store and query pharmacogenomics data via smart contracts}},
  year = {2019},
  doi = {10.1101/2019.12.16.878488},
  howpublished = {bioRxiv},
}
Figure