Giter Site home page Giter Site logo

rajivjc / clinicaltrials-on-blockchain Goto Github PK

View Code? Open in Web Editor NEW
16.0 3.0 7.0 258 KB

Demonstrate how blockchains can be used to improve data transparency in clinical trials

HTML 4.73% JavaScript 94.60% CSS 0.67%
ethereum smart-contracts blockchain clinical-trials ipfs truffle testrpc

clinicaltrials-on-blockchain's Introduction

Clinical Trail Ethereum Blockchain demo

This project is to demonstrate on how blockchain can be used in improving data transparency in clinical trials using Ethereum smart contracts for Ethereum smart contracts. This project was built using the Ethereum development and test framework Truffle.

This software requires access to an Ethereum blockchain network. For simple testing purposes the simplest setup is to use testrpc which creates an in memory blockchain. This software would also require IPFS which is distributed file system which will be used for storing the trial protocols in a distributed manner.

1. Pre Requisites

Windows, Linux or MacOS running a Git client and NodeJS 5.0+

2. Installation

Install TESTRPC

npm install -g ethereumjs-testrpc

Install Truffle

npm install -g truffle

Install IPFS

Download the package from https://ipfs.io/docs/install/ and execute the following commands

tar xvfz go-ipfs.tar.gz
mv go-ipfs/ipfs /usr/local/bin/ipfs
ipfs init

3. Installing the application

In a new command shell clone the repository Use your own folder name if you like

mkdir clinicaltrials-on-blockchain
git clone https://github.com/rajivjc/clinicaltrials-on-blockchain.git
npm install

4. Starting the Blockchain

In a new command shell run testrpc This starts blockchain node and creates ten test accounts.

To stop the blockchain node type ctrl-c

5. Taking IPFS online

ipfs daemon

To take IPFS offline type ctrl-c

6. Deploying the application contracts##

  • Ensure the TESTRPC instance is running

  • From a new command shell window change to the directory and type

    truffle migrate
    

This command runs the deployment scripts in the migrations folder. The contracts are mined into the blockchain

7. Starting the application##

The applcation may now be started. This can be served by any web server but the most convenient way to start the application is by running

truffle serve -p 8081

The application will be served by default at http://localhost:8081

Note:- If you have Metamask on your browser, you need to disable to for the demo application to work.

Demo

Click to watch demo

8. Useful Documentation

TESTRPC

https://github.com/ethereumjs/testrpc

Truffle Read The Docs

https://truffle.readthedocs.io/en/latest/

Ethereum Contract Deployment

https://ethereum.gitbooks.io/frontier-guide/content/creating_contract.html

IPFS

https://ipfs.io/

clinicaltrials-on-blockchain's People

Contributors

rajivjc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

clinicaltrials-on-blockchain's Issues

Mortgage object undefined ?

I am running the application on windows 7 machine . I am able to bring up the application .
When i click "Initiate lon contract " or any other button .
I get the below error .

Uncaught ReferenceError: Mortgage is not defined
at deployLoanContract (app.js:22238)
at HTMLButtonElement. (app.js:22532)
at HTMLButtonElement.dispatch (jquery.min.js:3)
at HTMLButtonElement.r.handle (jquery.min.js:3)

Please find the testrpc terminal logs below .

E:\blockchain\truffle\demo\mortgage-blockchain-demo>testrpc EthereumJS TestRPC v
3.0.3
EthereumJS TestRPC v6.0.3 (ganache-core: 2.0.2)

Available Accounts

(0) 0x98921a28221d17199122174ff593281dc987c7e4
(1) 0xa21415a48b9bebf57f7602df006ab637160b3836
(2) 0x1556a064ccb06a4abfc7a1b1b3cf4aa05e475ce9
(3) 0xfd95111e80c8f0b1bdcbc50d2dd1fc96732a07b6
(4) 0xd53363c7a2f325e3cfc317ebfc6b665dfa38fa7d
(5) 0x67ecaf010dc64029813661da148a1d86340010e6
(6) 0x6fbf875fcf833cb93e8bfe0fbd7c539594916a7a
(7) 0x27745a94f9af1127a710b2d7e0524eb24e013770
(8) 0xe5ee38c6eedafe82ed67f3d607ba6f5102a4ce0a
(9) 0xdafde31a46988783cc4cf3aa63c343c228c86cc5

Private Keys

(0) 327f9caa05c4d17f5a7bdbadcf4bfae260a346f0a64277c4d80fe10644cc297b
(1) c185c50d582657bcfb3cade4857b04096cd4470b9bba5ce1b47ffb944b0e6754
(2) 5adb9af9673e148a6b93729fdb00cf67e09453caa43cc3fc03c184a08dbf4c5d
(3) 7989bd05b19e36b6e26c1d4aca654c0dc322388f6c22da33ecf8fc9344f9fa54
(4) cccf203f31e0633d14ddb16639bd86d85e11bbc8ef8cec290ddb0959093265de
(5) d756adf78c63cd264f63f4bc25ebdf25c6ecb3dc3ec18298707dbdca1535f547
(6) 899ee31a2d613f597bd55bbdfe0624b2f08520f40a9b4be98866c81f1658717f
(7) 816ed584b3de80e60d3e7b7013b0ae77a955b42d158d11d3b28b9f00b5cb60f5
(8) 93f3cf87b812dd7553796265e2f8d86665fdff9bf6a1b5f0cb3c47a63a33d9d8
(9) 326a34089b24915afde7d67fcda240836c8461ac398b6ba60daa4884aaef6dae

HD Wallet

Mnemonic: camera renew range shell imitate switch steel feed elite bargain
lecture burst
Base HD Path: m/44'/60'/0'/0/{account_index}

Listening on localhost:8545
eth_accounts
net_version
eth_accounts
eth_accounts
net_version
net_version
eth_sendTransaction

Transaction: 0x92b3334cb91885e7625845a60122c4d0a1cfa71c4b2122289214b3d08f98e42
1
Contract created: 0x662ec09dca6e08f6a088e53a8e3b9ca47f98b155
Gas usage: 269607
Block Number: 1
Block Time: Fri Jan 26 2018 00:21:42 GMT+0400 (Arabian Standard Time)

eth_newBlockFilter
eth_getFilterChanges
eth_getTransactionReceipt
eth_getCode
eth_uninstallFilter
eth_sendTransaction

Transaction: 0x91a5157cdb013756f8c4358a1db6a8dbd9f0103c60d3b9e8e612903867018b5
9
Gas usage: 41981
Block Number: 2
Block Time: Fri Jan 26 2018 00:21:42 GMT+0400 (Arabian Standard Time)

eth_getTransactionReceipt
eth_accounts
net_version
net_version
eth_sendTransaction

Transaction: 0x5bcdd09e6bb21b713db3fb22f472a47280066c52d43e0ae47b62d4c8ae27ab7
5
Contract created: 0xa5034b953a720d062f6dbc0b14fc60c669db8a1f
Gas usage: 1016403
Block Number: 3
Block Time: Fri Jan 26 2018 00:21:42 GMT+0400 (Arabian Standard Time)

eth_newBlockFilter
eth_getFilterChanges
eth_getTransactionReceipt
eth_getCode
eth_uninstallFilter
eth_accounts

IPFS Configurations missing from README

In order for the web app to upload/retrieve files from IPFS, you will need to add the proper IPFS configurations for access control. The following commands will resolve the issue:

ipfs config --json API.HTTPHeaders.Access-Control-Allow-Credentials '["true"]'
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "POST", "GET"]'
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Headers '["Authorization"]'
ipfs config --json API.HTTPHeaders.Access-Control-Expose-Headers '["Location"]'
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["*"]'

Also, it would be nice to put a license for this repo too. Thanks.

Blockchain view: Audit trail and Block explorer aren't working

MetaMask seems to be front-running testrpc when injecting the web3 instance. If you remove MetaMask, then everything works fine. Only annoyance now is that this older testrpc version (v3.2.1) continuously outputs events for eth_getFilterChanges.

Reference Error: Regulator is not defined

What I did

After starting the app exactly as in README.md, I can reach it in the browser as expected.

Result

Clicking "Initiate Regulator Contract" has no effect. None of the other controls (except the tab buttons) have any effect.

Javascript console shows this error

Reference Error: Regulator is not defined

I also get ClinicalTrial is not defined.

However, on the regulator tab, there is an account. Same on CRO and Pharma.

Expected Result

App should generate assets as demoed in the video.

EthereumJS TestRPC v6.0.3 (ganache-core: 2.0.2)
Truffle v3.2.1
ipfs version 0.4.15

TypeError: fsevents is not a constructor

Environment:
AWS EC2
node v6.11.0.
Truffle v3.3.0

Default install on clean hardware. First time user. Looks like this is not your code but the truffle build?

`truffle serve -p 8081
Serving static assets in ./build on port 8081...
Rebuilding...
/home/ec2-user/.nvm/versions/node/v6.11.0/lib/node_modules/truffle/build/cli.bundled.js:123830
return (new fsevents(path)).on('fsevent', callback).start();
^

TypeError: fsevents is not a constructor
at createFSEventsInstance (/home/ec2-user/.nvm/versions/node/v6.11.0/lib/node_modules/truffle/build/cli.bundled.js:123830:11)
at setFSEventsListener (/home/ec2-user/.nvm/versions/node/v6.11.0/lib/node_modules/truffle/build/cli.bundled.js:123884:16)
at FSWatcher.FsEventsHandler._watchWithFsEvents (/home/ec2-user/.nvm/versions/node/v6.11.0/lib/node_modules/truffle/build/cli.bundled.js:124048:16)
at FSWatcher. (/home/ec2-user/.nvm/versions/node/v6.11.0/lib/node_modules/truffle/build/cli.bundled.js:124182:25)
at LOOP (fs.js:1773:14)
at _combinedTickCallback (internal/process/next_tick.js:73:7)
at process._tickCallback (internal/process/next_tick.js:104:9)
`

constructor error

$ truffle migrate
Using network 'development'.

Running migration: 2_deploy_contracts.js
Deploying ClinicalTrial...
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: ClinicalTrial contract constructor expected 7 arguments, received 0
..
.
.
.
any solution ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.