Inspiration

The digital era has brought a surge in medical misinformation, leading to serious health risks. While the Internet is a primary source for health information, it often results in misleading or harmful advice. The rise of Language Learning Models (LLMs) like ChatGPT sparked hopes of aiding medical professionals. Yet, two major issues persist: the risk of inaccurate information and privacy concerns. Doctor Oracle addresses the latter, ensuring user data privacy in medical AI applications.

What it does

Doctor Oracle introduces a privacy-centric approach. It encrypts user medical data using RSA and AES cryptography before sending it to Chainlink Functions via IPFS. There, data is decrypted, processed by an LLM, and re-encrypted with the user's public key. This method maintains a secure barrier between user data and the LLM, ensuring privacy. Although there's a potential risk of data exposure by rogue Chainlink node operators, this risk will be mitigated by upcoming advancements like Town Crier, which will allow for Functions code to be executed inside enclaves.

How we built it

Doctor Oracle comprises three components:

  1. Frontend: A user-friendly React interface built with wagmi for conducting medical surveys, encrypting data, and interfacing with Chainlink Functions.
  2. Backend: A Solidity smart contract manages requests, while TypeScript code in Functions uses the Subtle Crypto library.
  3. Custom IPFS Gateway: Developed on AWS serverless services and QuickNode API to address Chainlink Functions' limitations in sending FormData in requests, which is a requirements for all IPFS gateways I was able to find.

Challenges we ran into

Most problems I faced were related to relatively strict service limits of Chainlink Functions. 9 second limit on API requests sometimes leads to OpenAI API timeouts. I was also struggling a bit with Deno environment, which I've never used before, and initially I was not aware I could use the built-in Crypto module, so I experimented with a basic JS implementation of ECC. Luckily I realized I could use that library and in the end Doctor Oracle uses time-tested AES + RSA hybrid cryptography.

Accomplishments that we're proud of

Doctor Oracle's architecture potentially resolves a key issue in using LLMs for sensitive data. While currently a prototype, its functionality is a significant achievement which I'm very proud of.

What we learned

I've learned a ton about Chainlink Functions, as well as elliptic curve cryptography, which the project is not using in the end, but I did have to wrap my head around it when I faced what I thought was a dead-end when trying to use RSA.

What's next for Doctor Oracle

Potential future improvements:

  • RAG with knowledge retrieved from medical journals, family medical guides etc.
  • use of multi-modal models to process images, e.g. x-rays
  • interantionalized frontend (currently only works in English, most members of underserved communities with limited access to healthcare actually don't speak that language)
  • a pricing model that takes into account OpenAI pricing per token and billing information from Chainlink Functions

Built With

Share this project:

Updates