EHRBlockchain – EHRB锁链区块链毕设代写

区块链毕设代写本文提供国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,EHRBlockchain – EHRB锁链区块链毕设代写 是一篇很好的国外资料


EHRBlockchain - EHRB锁链

A project managing Electronic Health Records(EHR) of patients and giving permissions to audity using Solidity(Etherium Blockchain) with Truffle and Ganache GUI. Front-end is implemented with Flask and is to connect Ethereum Blockchain.

It uses:

  • Solidity which is an Ethereum Smart Contract programming language
  • Truffle and Ganache to deploy smart contracts
  • is a python library to connect with deployed contracts and create new contracts, transaction calls etc.
  • Flask to create a user GUI and Python backend for authorization and identification goals.

Demo video


This project fully implements a Blockchain EHR(Electronic Health Record) DApp Website which is decentralized and immutable. The objectives of the system is:

  • Privacy: Patient is always maintained. Unauthorized entities should not be able to access audit by using Ethereum Smart Contracts. The patient can add or remove audits/doctors who can view their Medical Records.
  • Identification and authorization: All system users have to submit their information in the sign up page, and this sensitive info is encrypted and passwords are encrypted and hashed in a txt file. In the login page users need to enter correct credentials to login the system.
  • Queries: Authorized entities which are decided by patient are able to query audit records of patients, and due to Ethereum blockchain running in background, everyone can see the changes made to the specific Medical Record.
  • Immutability: Without detection, neither patients nor audits/doctors cannot modify the specific record. From starting the visit to updating medical records all of the changes to a specific Medical Record is written to a separate Ethereum block as a transaction.
  • Decentralization: Using smart contracts and deploying the project in Ethereum blockchain makes the system fully decentralized and itt does not rely on a single trusted entity which ensures immutability.


  1. Install all python requirements. Libraries used are: flask, flask_boostrap, flask_wtf, wtforms, hashlib, pandas, cryptography, pyopenssl, datetime, dateutil, web3, json and clipboard (Discussed in next section).
  2. Install truffle using npm install truffle -g
  3. Install Ganache GUI from
  4. Generate a fernet key using Fernet.generate_key() to data/enc_key.key file.

Compile and Run

  1. Open Ganache UI and connect truffle.js in settings
  2. In terminal go to project folder and truffle compile && truffle migrate
  3. From another terminal FLASK_ENV=development flask run

External Libraries/Tools Used

  • Truffle: Truffle Suite is a development environment based on Ethereum Blockchain, used to develop DApps (Distributed Applications). Truffle is a one-stop solution for building DApps: Compiling Contracts, Deploying Contracts, Injecting it into a web app, Creating front-end for DApps and Testing.
  • Ganache GUI: Ganache GUI is a visual interface for Ganache CLI that works as a blockchain explorer. It is used to show blocks/events/transaction in the blockchain we deployed through truffle. After real deployment to Ethereum blockchain, everyone would be able to query whatever is shown in this Ganache GUI.
  • a Python library built for interacting with the Ethereum blockchain. All interaction to Ethereum blockchain deployed in port 7545 is done from using
  • Flask: Flask is a lightweight WSGI web application framework, (flask, flask_boostrap, flask_wtf, wtforms) used for Website front end implementation and python is used in the server side.
  • Hashlib: Used to hash passwords and file names in /data/
  • Cryptography: Used for fernet encryption/decryption and generation of key.
  • Pyopenssl: Used to create an SSL certificate for EHR website.
  • Pandas and JSON: Used to store into csv file and read from csv file while encrypting and decrypting.
  • Datetime and Dateutil: to get/change date from epoch to any datetime format and vice versa.
  • Clipboard: Used for copying a unique patient record into clipboard.. Patient record is not selectable on the audit front end side, so only the copy function can copy it.

Source Files

  • All the user interface is implemented here using Flask and other than solidity files, all blockchain connections and other encryption/decryption/hashing is implemented here. This file will be deployed to the server.
  • GUI forms for login signup and all patient and user actions model classes defined here. This file will be deployed to the server.
  • abi.json: JSON file that describes the deployed solidity contracts and its functions.
  • bytecode.json: Solidity files get compiled to the EVM bytecode which gets deployed to the Ethereum blockchain.
  • build/contracts/Migrations.json: After compilation Migration.sol turns into js file
  • build/contracts/Patient.json: After compiling using truffle Migration.sol turns into js
  • contracts/Migrations.sol: Solidity file which includes implementation of Migrations contract keeping track of which migrations were done on the current network. Implemented in truffle projects automatically, I did not change the file.
  • contracts/Patient.sol: Solidity contract for creating a new patient and all of the health records of the patient as well as their authorized audit/doctor info.
  • data/3f91fb273e0c… .csv: Hashed name of “signin_data” where encrypted patient and audit signin data is stored. This file will be stored in the server or ideally a new encrypted db will be created for this purpose.
  • data/enc_key.key: Fernet encryption key is stored here. This file should be hidden securely in server.
  • data/f415ea3131a… . csv: Hashed name of “uniqueid_data” where encrypted unique medical record id and patient id is stored. This file will be stored in the server or ideally a new encrypted db will be created for this purpose.
  • migrations/1_initial_migration.js: First task to do after compiling both Migrations.sol and Patient.sol. It migrates the and keeps track of migrations to the Ethereum blockchain. Implemented in the truffle project automatically, I did not change the file.
  • migrations/2_deploy_contract.js: Second task to do after compilation of both solidity files. Fully implemented by me and creates the first Patient contract and deploys into the Ethereum network.
  • static/css and static/img : CSS and image files for the EHR website.
  • templates/audit.html: Flask template showing client side audit actions webpage. Built using HTML/CSS, Bootstrap and Jinja(embedded python code).
  • templates/auditreg.html: Flask template showing client side audit signup webpage. Built using HTML/CSS, Bootstrap and Jinja(embedded python code).
  • templates/index.html: Flask template showing client side index webpage. Built using HTML/CSS, Bootstrap and Jinja(embedded python code).
  • templates/login.html: Flask template showing client side login webpage for both patients – audits. Built using HTML/CSS, Bootstrap and Jinja(embedded python code).
  • templates/patient.html: Flask template showing client side patient actions webpage. Built using HTML/CSS, Bootstrap and Jinja(embedded python code).
  • templates/patientreg.html: Flask template showing client side patient signup webpage. Built using HTML/CSS, Bootstrap and Jinja(embedded python code).
  • templates/result.html: Flask template showing client side result web page after sign in. Built using HTML/CSS, Bootstrap and Jinja(embedded python code).
  • test/: Test files for deployed solidity contract. Empty in this project
  • truffle-config.js: Truffle configuration file is a Javascript file and can execute any code necessary to create configuration. In our case we connect Ganache GUI to truffle using this file.

Cryptographic Components Used

  • Fernet Encryption/Decryption:
    • Used in the authentication system. All sensitive info of audits and patients are encrypted file getting written into a csv file.
    • While checking their credentials in login page
    • All unique id and patient id pairs are encrypted while stored in a csv file
    • While list button is used all info gets decrypted first, then using pandas DF functions related unique id’s are listed.
  • SHA 256 Salted Hashing:
    • All passwords are hashed and salt is used before hashing.
    • No actual password storage is implemented and the system just compares pass hashes.
  • SSL and TLS
    • System runs through HTTPS and uses SSL certificates as well as leveraging TLS.
  • Ethereum Blockchain
    • The whole system is immutable and decentralized using a Ethereum Blockchain backend.



EHRBlockchain - EHRB锁链

一个管理患者电子健康记录(EHR)并使用Solidity(Etherium区块链blockchain)和Truffle和Ganache GUI向audity授予权限的项目。前端由Flask实现,Web3.py用于连接以太坊eth区块链blockchain


  • Solidity,这是以太坊eth智能合约编程语言
  • Truffle和Ganache部署智能合约
  • Web3.py是一个python库,用于连接已部署的合约并创建新合约、事务调用等。
  • Flask用于创建用户GUI和python后端以实现授权和识别目标




  • 隐私:始终维护患者。未经授权的实体不得使用以太坊eth智能合约访问审计。患者可以添加或删除可以查看其病历的审核/医生
  • 识别和授权:所有系统用户都必须在注册页面中提交他们的信息,这些敏感信息被加密,密码被加密并散列在txt文件中。在登录页面中,用户需要输入正确的凭据才能登录系统
  • 查询:由患者决定的授权实体可以查询患者的审计记录,由于以太坊eth区块链blockchain在后台运行,每个人都可以看到对特定医疗记录所做的更改
  • 不变性:未经检测,患者和审计/医生都无法修改特定记录。从开始访问到更新病历,对特定病历的所有更改都作为事务写入单独的以太坊eth数据块
  • 去中心化:使用智能合约并在以太坊eth区块链blockchain中部署项目使系统完全去中心化,itt不依赖单一的可信任实体,从而确保不可变性


  1. 安装所有python要求。使用的库有:flask、flask_boostrap、flask_wtf、wtforms、hashlib、pandas、密码学、pyopenssl、datetime、dateutil、web3、json和剪贴板(将在下一节中讨论)
  2. 使用npm安装块菌-g安装块菌
  3. 使用fernet.Generate_key()生成fernet密钥到data/enc_key.key文件
  4. 打开Ganache UI并在终端的设置中连接truffle.js进入项目文件夹,然后truffle编译&amp&块菌从另一个终端烧瓶迁移


  1. 应用程序=main.py烧瓶_ENV=开发烧瓶运行
  2. 块菌:块菌套件是基于以太坊eth区块链blockchain的开发环境,用于开发分布式应用程序。Truffle是构建DAPP的一站式解决方案:编译合同、部署合同、将其注入web应用程序、创建DAPP前端和测试
  3. Ganache GUI:Ganache GUI是Ganache CLI的可视界面,用作区块链blockchain浏览器。它用于显示我们通过truffle部署的区块链blockchain中的块/事件/事务。在实际部署到以太坊eth区块链blockchain之后,每个人都可以查询此Ganache GUI中显示的任何内容


  • Flask:Flask是一个轻量级WSGI web应用程序框架(Flask、Flasku boostrap、Flasku wtf、wtforms),用于网站前端实现,python用于服务器端
  • Hashlib:用于对/data/
  • 加密中的密码和文件名进行哈希运算:用于fernet加密/解密和生成密钥
  • Pyopenssl:用于为EHR网站创建SSL证书
  • 熊猫和JSON:用于存储到csv文件中,并在加密和解密时从csv文件中读取
  • Datetime和Dateutil:从历元获取/更改日期为任何日期时间格式,反之亦然
  • 剪贴板:用于将唯一的病历复制到剪贴板中。。在审计前端无法选择病历,因此只有复制功能可以复制病历


  • abi.json:json文件,描述部署的solidity契约及其功能
  • bytecode.json:Solidity文件被编译成EVM字节码,并部署到以太坊eth区块链blockchain
  • build/contracts/Migrations.json:编译后Migration.sol转换为js文件
  • build/contracts/Patient.json:使用truffle Migration进行编译后。sol转换为js
  • contracts/Migrations.Solidity文件,其中包括迁移的实现合同跟踪在当前网络。在truffle项目中自动实现,我没有更改文件
  • 合同/Patient.sol:创建新患者和患者所有健康记录及其授权审核/医生信息的实体合同
  • 数据/3f91fb273e0c….csv:存储加密患者和审计签名数据的“签名数据”的哈希名称。此文件将存储在服务器中,或者理想情况下,将为此创建一个新的加密数据库
  • 数据/enc_key.key:Fernet加密密钥存储在这里。此文件应安全地隐藏在服务器中
  • 数据/f415ea3131a。csv:“uniqueid_数据”的散列名称,其中存储加密的唯一病历id和患者id。此文件将存储在服务器中,或者理想情况下,将为此创建一个新的加密数据库
  • migrations/1_initial_migration.js:编译migrations.sol和Patient.sol后要执行的第一个任务。它迁移并跟踪到以太坊eth区块链blockchain的迁移。在truffle项目中自动实现,我没有更改文件
  • 迁移/2_deploy_contract.js:编译两个solidity文件后要执行的第二个任务。由我全面实施,创建第一份患者合同,并部署到以太坊eth网络
  • 静态/css和静态/img:EHR网站的css和图像文件
  • 模板/audit.html:显示客户端审核操作网页的Flask模板。使用HTML/CSS、Bootstrap和Jinja(嵌入式python代码)构建
  • 模板/auditreg.html:显示客户端审计注册网页的Flask模板。使用HTML/CSS、Bootstrap和Jinja(嵌入式python代码)构建
  • 模板/index.html:显示客户端索引网页的Flask模板。使用HTML/CSS、Bootstrap和Jinja(嵌入式python代码)构建
  • 模板/login.html:显示两名患者客户端登录网页的Flask模板-审核。使用HTML/CSS、Bootstrap和Jinja(嵌入式python代码)构建
  • 模板/patient.html:显示客户端患者操作网页的烧瓶模板。使用HTML/CSS、Bootstrap和Jinja(嵌入式python代码)构建
  • 模板/patientreg.html:显示客户端患者注册网页的烧瓶模板。使用HTML/CSS、Bootstrap和Jinja(嵌入式python代码)构建
  • templates/result.html:登录后显示客户端结果网页的Flask模板。使用HTML/CSS、Bootstrap和Jinja(嵌入式python代码)构建
  • 测试/:部署的坚固性合同的测试文件。此项目中为空
  • truffle-config.js:truffle配置文件是一个Javascript文件,可以执行创建配置所需的任何代码。在我们的例子中,我们使用这个文件将ganachegui连接到truffle
  • Fernet加密/解密:用于身份验证系统。审计和患者的所有敏感信息都被加密文件写入csv文件。在登录页面中检查他们的凭证时,所有唯一id和患者id对都被加密,并存储在csv文件中,同时使用列表按钮,所有信息首先被解密,然后使用DF函数列出相关的唯一id
  • 用于身份验证系统。审计和患者的所有敏感信息都被加密文件写入csv文件


  • 在登录页面检查他们的凭证时,所有唯一id和患者id对都会加密,并存储在csv文件中
  • SSL和TLS系统通过HTTPS运行,并使用SSL证书以及利用TLS
  • 整个系统使用以太坊eth区块链blockchain后端是不可变和分散的
  • Ethereum Blockchain
    • The whole system is immutable and decentralized using a Ethereum Blockchain backend.



区块链毕设网(全网最靠谱的原创区块链毕设代做网站 部分资料来自网络,侵权联系删除! 最全最大的区块链源码站 ! QQ3039046426
区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » EHRBlockchain – EHRB锁链区块链毕设代写


立即查看 了解详情