Git Product home page Git Product logo

airmedfoundation-terminal's Introduction

Airmed Foundation - Node.js Terminal

The Airmed Foundation is an open source initiative that provides a secure channel to store and transfer medical records. It is based on the Interplanetary File System (IPFS) and Hyperledger Fabric. The conjunction of these technologies guarantees the immutability and availability of the data.

In order to achieve secure and reliable file management:

  • We replicate all records on the IPFS network using the Bittorrent protocol.
  • We restrict access to records using asymmetric cryptography.
  • We protect and store cryptographic access keys in the Hyperledger Fabric blockchain.

Sharing files with the Airmed Foundation platform is pretty straightforward. Depending on their desired privacy level, one can upload files with or without asymmetric encryption. We have created this tutorial to explain both procedures.

Installation and Usage

The following dependencies must be downloaded and installed in order to use Airmed Foundation's Node.js terminal:

  • Interplanetary File System (IPFS)
  • Docker
  • Docker Compose
  • Node.js
  • NPM
  • NVM
  • Hyperledger Fabric

Here we guide you through this process.

Interplanetary File System (IPFS)

Project website: https://ipfs.io/

wget https://dist.ipfs.io/go-ipfs/v0.4.19/go-ipfs_v0.4.19_linux-amd64.tar.gz
tar xvfz go-ipfs_v0.4.19_linux-amd64.tar.gz
cd go-ipfs
sudo ./install.sh
ipfs init

Docker and Docker Compose

Project website: https://docs.docker.com/install/linux/docker-ce/ubuntu/ (Docker)
Project website: https://docs.docker.com/compose/install/ (Docker Compose)

sudo apt-get install docker-ce docker-ce-cli containerd.io
sudo apt-get install docker-compose

Node.js, NPM and NVM

Project website: https://nodejs.org/en/ (Node.js)
Project website: https://www.npmjs.com/ (NPM)
Project repo: https://github.com/creationix/nvm#installation-and-update (NVM)

sudo apt-get install nodejs
nvm install 8.15.0
nvm use 8.15.0

Hyperledger Fabric

Project website: https://www.hyperledger.org/projects/fabric

git clone https://github.com/hyperledger/fabric-samples
cd fabric-samples
./scripts/bootstrap.sh 1.4.0 1.4.0
cd first-network
./byfn.sh generate
./byfn.sh up

Download Airmed Foundation

Project website: https://airmedfoundation.thechain.tech/

git clone https://github.com/the-chain/airmedfoundation-terminal
cd airmedfoundation-terminal
npm install 

Install Chaincode to Hyperledger Network

cd airmedfoundation-terminal
docker exec -it cli peer chaincode instantiate -C mychannel -l "node" -n airmed -v v1 -c '{"Args":[]}' -o orderer.example.com:7050 --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
docker exec -it cli peer chaincode instantiate -C mychannel -l "node" -n secureRec -v v1 -c '{"Args":[]}' -o orderer.example.com:7050 --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem

Configuration of Airmed Foundation's server

Edit config/datastores.js

Change values to connect to postgreSQL. In order to install postgreSQL, you can run the following command in the terminal:

docker-compose up -d

Setup appconfig.json

{ "email": { "admin":"[email protected]", "auth": { "user": "[email protected]", "pass": "password" }, "service": "Gmail", "emailVerification": 1 }, "database": { "adapter": "sails-postgresql", "user": "admin", "password": "adminpassword", "port": "5432", "host": "localhost", "database": "airmed" }, "session": { "name": "sails.sid", "secret": "secretKey", "redis": { "url": "redis://: [email protected]:6379/15", "host": "127.0.0.1", "port": 6379, "pass": "redisPassword", "db": 15 } }, "ipfs": { "host":"127.0.0.1", "port":"5001" } }

Edit config/policies.js

For testing purposes, remove comment from line 20. That is, line

//'*': 'isHTTPS',

should now look like

'*': 'isHTTPS',

Edit Hyperledger configuration file

In the file fabric-api/config/configfile.yaml, you should replace the default admin certificate paths with the actual path of your project. Please note that you should only modify paths from adminPrivateKey in Line 44 under Org1, and in Line 56 under Org2. Everything else must remain unaltered.

As a further advice, please make sure that fabric-sample and airmedfoundation-terminal are in the same directory.

The paths should look as follows:
/home/root/Desktop/fabric-sample
/home/root/Desktop/airmedfoundation-terminal

Running the application

Running the application is very simple. You just need to:

  • Run IPFS
ipfs daemon &
  • Run the server
node ./node_modules/sails/bin/sails.js l --redis --safe
  • Run the sync process
./init.sh &

And now you're ready to go!


Contact: This open source project is brought to you by The Chain, a software shop specialized in the development of applications and services based on blockchain technology and artificial intelligence. Any questions that might arise should be sent to the project's maintainers. We will be happy to assist you.

License: This project is under the GNU Affero General Public License v3.0.

airmedfoundation-terminal's People

Contributors

alex99y avatar allgebrist avatar andandandand avatar dependabot[bot] avatar jcibeira avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

airmedfoundation-terminal's Issues

called with an Error: { AdapterError: Unexpected error from database adapter: relation "public.block" does not exist

Hi, I encountered the following error, could you please tell me how to solve it? Thank you in advance.
I changed the appconfig.json like this:
{ "email": { "admin":"[email protected]", "auth": { "user": "[email protected]", "pass": "password" }, "service": "Gmail", "emailVerification": 1 }, "database": { "adapter": "sails-postgresql", "user": "airmed", "password": "LYbAWCErGttRsP9y", "port": "5432", "host": "localhost", "database": "airmed" }, "session": { "name": "sails.sid", "secret": "secretKey", "redis": { "url": "redis://: [email protected]:6379/15", "host": "127.0.0.1", "port": 6379, "pass": "redisPassword", "db": 15 } }, "ipfs": { "host":"127.0.0.1", "port":"5001" } }

database:{... "user": "airmed", "password": "LYbAWCErGttRsP9y" ...} is this right?

Everything else is normal.

Custom response `res.serverError()` called with an Error: { AdapterError: Unexpected error from database adapter: relation "public.block" does not exist
    at Object.fn (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/api/controllers/block/gettotal.js:15:31)
    at wrapper (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/@sailshq/lodash/lib/index.js:3275:19)
    at Deferred._handleExec (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/machine/lib/private/help-build-machine.js:1016:29)
    at Deferred.exec (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/parley/lib/private/Deferred.js:286:10)
    at Deferred.switch (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/machine/lib/private/help-build-machine.js:1469:16)
    at Object._requestHandler [as block/gettotal] (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/machine-as-action/lib/machine-as-action.js:1153:27)
    at /home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/sails/lib/router/bind.js:248:46
    at routeTargetFnWrapper (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/sails/lib/router/bind.js:392:9)
    at Layer.handle [as handle_request] (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/express/lib/router/layer.js:95:5)
    at next (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/express/lib/router/route.js:137:13)
    at Route.dispatch (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/express/lib/router/layer.js:95:5)
    at /home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/express/lib/router/index.js:281:22
    at Function.process_params (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/express/lib/router/index.js:335:12)
    at next (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/express/lib/router/index.js:275:10)
    at next (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/express/lib/router/route.js:127:14)
    at module.exports (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/sails-hook-flash/lib/flash.js:108:10)
    at routeTargetFnWrapper (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/sails/lib/router/bind.js:392:9)
    at Layer.handle [as handle_request] (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/express/lib/router/layer.js:95:5)
    at next (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/express/lib/router/route.js:137:13)
    at Route.dispatch (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/express/lib/router/layer.js:95:5)
    at /home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/express/lib/router/index.js:281:22
    at param (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/express/lib/router/index.js:354:14)
    at param (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/express/lib/router/index.js:365:14)
    at Function.process_params (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/express/lib/router/index.js:410:3)
    at next (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/express/lib/router/index.js:275:10)
    at next (/home/hnu/go/src/github.com/hyperledger/airmedfoundation-terminal/node_modules/express/lib/router/route.js:127:14)

Success dialogue

  • Cambiar "Uploaded successfully" a "< filename> uploaded successfully to IPFS network. A search hash for this file has been generated."

Documentation

do you have installation manual or documentation please

Nombre de imagen "hash"

Toda imagen descargada se guarda con nombre "hash.png"

  • Cambiar a nombre original de imagen o en su defecto a fecha de descarga.

problem

Hello , thank you for your project, i really like this case. But there some problems for me.

./init.sh

When i run this ./init.sh first , there some problems:

Start sync process
(node:20467) UnhandledPromiseRejectionWarning: RequestError: Error: socket hang up
at new RequestError (/home/fabric/Hyperledger/airmedfoundation-terminal/node_modules/request-promise-core/lib/errors.js:14:15)
at Request.plumbing.callback (/home/fabric/Hyperledger/airmedfoundation-terminal/node_modules/request-promise-core/lib/plumbing.js:87:29)
at Request.RP$callback [as _callback] (/home/fabric/Hyperledger/airmedfoundation-terminal/node_modules/request-promise-core/lib/plumbing.js:46:31)
at self.callback (/home/fabric/Hyperledger/airmedfoundation-terminal/node_modules/request/request.js:185:22)
at emitOne (events.js:116:13)
at Request.emit (events.js:211:7)
at Request.onRequestError (/home/fabric/Hyperledger/airmedfoundation-terminal/node_modules/request/request.js:881:8)
at emitOne (events.js:116:13)
at ClientRequest.emit (events.js:211:7)
at Socket.socketOnEnd (_http_client.js:423:9)
at emitNone (events.js:111:20)
at Socket.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
(node:20467) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:20467) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

node ./node_modules/sails/bin/sails.js l --redis --safe

When i run this first, i got this problem :

info: Starting app...
error: A hook (userconfig) failed to load!
error:
error: Attempted to require('/home/fabric/Hyperledger/airmedfoundation-terminal/config/datastores.js'), but an error occurred:

Error: Cannot find module '../appconfig.json'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object. (/home/fabric/Hyperledger/airmedfoundation-terminal/config/datastores.js:15:14)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at /home/fabric/Hyperledger/airmedfoundation-terminal/node_modules/include-all/lib/help-include-all-sync.js:293:33
at Array.forEach ()
at _recursivelyIncludeAll (/home/fabric/Hyperledger/airmedfoundation-terminal/node_modules/include-all/lib/help-include-all-sync.js:178:11)
at includeAll (/home/fabric/Hyperledger/airmedfoundation-terminal/node_modules/include-all/lib/help-include-all-sync.js:317:5)

error: Could not load Sails app.
error:
error: Tips:
error: • First, take a look at the error message above.
error: • Make sure you've installed dependencies with npm install.
error: • Check that this app was built for a compatible version of Sails.
error: • Have a question or need help? (http://sailsjs.com/support)

I had try different nodejs version, but i can't solve those problems. Cloud you give me some suggestions? Looking forward to your reply. Thank you very much.

Search dialogue

  • Cambiar "Search" a "Paste file's hash here for IPFS search"

Fully Qualified Domain Name

I would like to use a subdomain as FQDN instead of IP address, are there any settings I need to tweak?
Can I use a reverse proxy like Nginx?

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.