The aims of this application are:-
- To implement blockchain technology for storing, updating, and retriving EHR.
- To provide secure storage of electronic records by defining granular access rules for the users of the proposed application.
- This application also discusses the scalability problem faced by the blockchain technology in general via use of off-chain storage of the records. This application provides the EHR system with the benefits of having a scalable, secure and integral blockchain-based solution.
Video Demo: Link
This application requires NodeJS, npm, Truffle, Ganache, and IPFS to work. Instruction to install all, and setup dependencies are given below.
- Move to the project directory
cd app
- Run
npm install
to install project dependencies.
- Go to Ganache homepage and download.
- If you are on Linux, you must have received an
.appimage
file. Follow installation instructions available here.
- Go to the github page of IPFS and install IPFS Desktop.
- Install Node lite-server by running the following command on your terminal from project root directory
npm install -g lite-server
.
- Metamask is a browser extension available for Google Chrome, Mozilla Firefox and Brave Browser.
- Add Metamask to your browser by clicking here.
- Open Ganache and create a new Workspace.
- Add truffle_config.js in
Add Project Section
- Under Server tab:
- Set Hostname to
127.0.0.1 -lo
. - Set Port Number to
8545
. - Enable Automine.
- Set Hostname to
- Under Accounts & Keys tab:
- Enable Autogenerate HD Mnemonic
- Fire up your terminal and run
ipfs init
. If it says command not found then follow this link - Then type the following command from your project root directory.
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin "['*']"
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Credentials "['true']"
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods "['PUT', 'POST', 'GET']"
Note - If you face any issues with the above command on windows, try using command prompt and escape sequences or git bash, same goes for Linux, Mac and other machines.
- After installing Metamask, click on the metamask icon on your browser.
- Click on continue and accept all the terms and conditions after reading them.
- Stop when Metamask asks you to create a new password. We will come back to this after deploying the contract in the next section.
-
Install Truffle using
npm install truffle -g
. -
Compile Contracts using
truffle compile
.- Open Ganache.
- Make sure to configure it the way mentioned above.
- Open new Terminal and deploy contracts using
truffle migrate
. - Open Remix, upload
MedBloack.sol
and then deploy it. - Copy deployed contract address to src/js/app.js
// app/src/app.js line number 11 var agentContractAddress = '0x75E115394aacC7c6063E593B9292CB9417E4cbeC';
- If you change contents of any contract , replace existing deployment using
truffle migrate --reset
. - Deploy the modified contract on remix and change the ABI in src/js/app/js to the
deploted contract
ABI.
- Connect metamask to localhost:8485
- Click on `Import Account`.
- Select any account from ganache and copy the private key to import account into metaMask.
- Start the IPFS Desktop Application
- Open a new terminal window and navigate to `/YOUR_PROJECT_DIRECTORY/app/`.
- Run `npm start`.
- Open `localhost:3000` on your browser.
We have added a new FurtherImprovement.md
file please go ahead, read it, review it and drop your suggestions as a PR 😃.