I am looking to Design Smart Contract using Ethereum Blockchain for storing and retrieving Medical Recoreds in Blockchain.

As I am new to Ethereum I am little issue with below thing. anyone have any idea or some solidity code how to get it.

Key Functions/Module: There will be two users o Doctor o Patient

Add Doctor Information o Doctor ID o Name o Email o Contact Number o Address

Add Patient Information o Patient ID o Patient Name o Email o Contact Number o Address

1 Patient can view his/her information 2 Doctor can view/her information 3 Patient can share his/her information with Doctors 4 Doctors can view all/limited information of Patients who shared their information with doctors.

Thanks in advance.

  • I would suggest not putting private data on a public blockchain, especially medical data. You could put hashes of the data on chain and store the data securely off chain.
    – abcoathup
    Commented Jul 4, 2019 at 4:42
  • 1
    Thanks for comment I also think same. However I thought if we use hash then could it possible. Commented Jul 4, 2019 at 4:43

1 Answer 1


Storing anything secret on the blockchain is difficult. Whatever you store is visible for everyone.

You can store data in an encrypted format but then you can't store the encryption key in the blockchain as everyone would have access to it. So you'd need to distribute it to those who need it outside the blockchain.

The kind of access based restrictions you mention are very hard to implement with Ethereum - the blockchain is simply not meant for this kind of usage. Transparency is one of the biggest advantages of the blockchain although in your case it doesn't really help.

One option you can consider is using a private Ethereum blockchain. That way you control the access and you have much better control over who can access what. The downside is that somebody has to run the private blockchain and that you have to implement a lot of stuff outside the blockchain (the access control system).

  • So is it possible using private ethereum blokchain? Commented Jul 9, 2019 at 7:52
  • 1
    If the blockchain is private and you run it yourself you also control who has access to it. Nobody can read the data if they don't have access to a node on the blockchain. So in that sense it is possible with a private blockchain. See a case study for example (they switched to a private blockchain due to privacy reasons): innovation.wfp.org/project/building-blocks Commented Jul 9, 2019 at 8:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.