Inspiration
Healthcare is an inseparable part of our lives, and I am no exception. Covid-19 vaccination and certificates got me thinking about where are my childhood vaccination certificates. I could not find many of them, but even those I found were in no condition to be accepted anywhere. Also, living with my grandparents, I have seen managing the details can sometimes get out of hand and is usually very inefficient and leads to a waste of time. Sometimes we forget one or two essential documents the doctor required, and having been left with no option, we had to revisit the doctor. This is a common problem today which affects every household, not only in India but on a global scale. This is the underlying motivation to develop a secure file-sharing system supported by a DAO integrated with Chainlink Automation (Keepers).
What it does
VyroChain is a DAO with a secure medical file-sharing capability developed for EVM blockchains using IPFS for decentralised file storage. The system has four actors, viz. patient, doctor, hospital and Chairperson of the committee governing the participating hospitals. Patients can register themselves and view their medical files and vote for selecting the chairman of the committee whenever a proposal floats. The doctors, along with hospitals, can also vote for selecting the chairman of the committee. The doctors can upload the medical files of the patient, which will be uploaded to IPFS and then the hash will be stored on the blockchain after encrypting it with the public key of the patient. The Chairman can add doctors and hospitals in the system currently and view the count of patients, hospitals, and doctors in the system. This also features automated QR code generation for quick sharing of files by the patient.
Using VyroChain, patients can access their medical files anytime and anywhere without worrying about any centralised entity storing all the sensitive information. Also, they can participate in the DAO which will democratise the system even more.
This system categorises the medical files of the patient in four categories: vaccination, chronic, acute and accidental, which makes the retrieval of medical information very efficient without any manual work at the patient’s end.
How I built it
I have divided the development of this project into four phases, - implementing secure file sharing, developing logic for DAO, developing the front end, and developing a subgraph for increasing the system's scalability. I have used an iterative waterfall model for developing this project. Jumping between various phases was a must requirement of the project. Debugging was a major issue, but the right practices made it less headache to remove bugs.
Challenges I ran into
Designing a system with such complexity for the first time was a little bit overwhelming for me. For a simple small system, it is very easy to imagine the entire system. But, with this system during the design phase imagining it whole with all the important details was a bit tough, which I overcame by abstracting the less important features and improving the design as I built the system.
Removing bugs was a bit hectic, and I learned many things about the intricacies of the EVM and solidity language. The open-source community and QA forums really helped in finding bugs and removing them.
Integrating the chainlink automation with the DAO to automatically execute the proposals after the minDelay was also a challenge as it was a new feature.
Accomplishments that I'm proud of
I am proud that I was able to work with various libraries, tools and frameworks to implement such a beautiful project. Integrating the DAO with Chainlink Automation is what I am most proud of along with things like implementing auto-generating QR code for easy file sharing.
What we learned
I learned many new things which include: using the node-rsa library and implementing RSA encryption in an application, uploading files to IPFS using the ipfs-core library, using the qrcode library, and building a feature to generate & show QR code of URI of resources (or any string), and using The Graph Indexing protocol to index the data of the blockchain.
I also learned that smart contracts in EVM-compatible chains can have a max size of 24.576KB. I learned that there can be at most 16 variables including parameters, and local variables, in a solidity function. I also learned that you shouldn’t make string parameters as indexed in solidity events and you can't return a struct from a solidity function without using pragma experimental ABIEncoderV2 which is not so experimental.
Debugging the code was very crucial, and I learned various ways and tools to debug and maintain the code. The open-source community really helped me with this.
I also learned the importance of documentation and how to create nice & informative README files.
Encoding and decoding the function parameters is also something which I learnt along with the vulnerability associated with using block.timestamp
What's next for VyroChain
Add more functionality for hospitals like proposing doctors so and voting for them to be added in the system. Adding more features and functionality for doctor's dashboard. Integrating medical payments in this sytem itself.
Built With
- chainlink
- ethers
- hardhat
- javascript
- nextjs
- openzeppelin
- solidity
- tailwind
- thegraph
- typescript
- vercel
Log in or sign up for Devpost to join the conversation.