To start, clone this branch of the repo into your local:
git clone https://github.com/aL0NEW0LF/medical-records-management-blockchain
After cloning the project, create your virtual environment:
cd medical-records-management-blockchain
To create a virtual environment, run the following command in the root directory of the project: Windows
py -3 -m venv .venv
MacOS/Linus
python3 -m venv .venv
Then, activate the env:
Windows
.venv\Scripts\activate
MacOS/Linus
. .venv/bin/activate
You can run the following command to install the dependencies:
pip3 install -r requirements.txt
To run the GUI, you need to have a local blockchain running. We will be using Hardhat for this purpose. To install Hardhat, you need to have Node.js installed. You can download Node.js from here. After installing Node.js, follow the steps below to install Hardhat: Initialize an npm project:
npm init -y
Install Hardhat:
npm install --save-dev hardhat
Run the following command to initialize Hardhat:
npx hardhat
Run the hardhat node:
npx hardhat node
To run the GUI, you need to have IPFS running. You can download IPFS Desktop from here.
The GUI uses IPFS to store the files, you would need to have IPFS running in the background. And since python doesn't have a native IPFS library, and the ipfs-http-client library is not compatible with the latest version of IPFS, you need to modify the client\__init__.py
and change maximum version to the current version of IPFS running on your machine. The line should look something like this:
VERSION_MAXIMUM = "0.32.2"
Note
This fix is working as of the time of writing this README, until the ipfs-http-client library is updated to support the latest version of IPFS, or an official library is released.
- Deploy the contracts to the local network in the following order as some contracts depend on others:
- RoleContract.sol
- AuditContract.sol
- PatientContract.sol
- DoctorContract.sol
- Make sure to copy the contract addresses and ABIs to the .env file as shown in the .env.example file (The ABIs should be compacted into a single line JSON)
- Run the GUI using the following command:
python .\GUI\App.py
Important
When asked to sign a message to make sure that the user is the owner of the wallet, you can use your preferred wallet manager to sign the message. To verify the signature, you need to provide a JSON object with the following format:
{
"address": "0x1234567890abcdef1234567890abcdef12345678",
"msg": "2312421421",
"sig": "0x1234567890abcdef1234567890abcdef12345678",
"version": "2"
}