Giter Club home page Giter Club logo

consentio-client's Introduction

consentio-client

Client application for experiments reproduction of Consentio Consent Management System (CMS), using Hyperledger Fabric v1.4 via Node.js Fabric SDK. It connects to IBM Blockchain Platform network.

Reproduction

  1. Enroll 4 users (user1, user2, user3, user4) into local wallet with enroll_users.sh.

  2. Reproduce WRITE bar plot (Figure 7 in Consentio article):

    $ ./write.sh <individual_id>
  3. Reproduce READ bar plot (Figure 6 in Consentio article):

    $ ./read.sh 

Automate above with:

# all args optional
$ ./exp.sh <from id> <to id>

Feel free to change volumes in both scripts accordingly to the blockchain network efficiency level.

Using some scripts independently

enrollUser.js

hg@hvvka ~/p/_/m/consentio-client> node enrollUser.js                                                                                                                                     1 master!?
Wallet path: /Users/hg/pwr/_w8/mgr/consentio-client/wallet
Successfully enrolled client "user1" and imported it into the wallet

updateConsent.js

await contract.submitTransaction("updateConsent", "2", "g", "all", "20150101", "20160101", "101", "hippa");
hg@hvvka ~/p/_/m/consentio-client> node updateConsent.js                                                                                                                                          1 master!
Transaction has been submitted.

queryConsent.js

await contract.evaluateTransaction("queryConsent", "{\"selector\":{}, \"use_index\":[\"_design/indexConsentDoc\", \"indexConsent\"]}");
hg@hvvka ~/p/_/m/consentio-client> node queryConsent.js                                                                                                                                             master!
[{"Key":"101all2015010120160101hippa", "Record":{"u_ids":{"2":1}}}]

Consentio chaincode

World state design

{ 
  resource_id|watchdog_id|role_id|time_id : [ind_id_1,..., ind_id_n]
}

value = a list of individual IDs giving consent to the data specified in the key (i.e., the given temporal fragment of a the given resource being available to the given role approved by the given watchdog)

Operations

  • updateRole (watchdog_id, role_id, data_consumer_id, action)

    peer chaincode invoke -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 -C $CHANNEL_NAME -n CHAINCODE_NAME -c \
        '{"Args":["updateRole", "hippa", "all", "dc1", "r"]}'

    action: r (revoke) or g (grant)

  • queryConsent (query_string)

    peer chaincode query -C $CHANNEL_NAME -n CHAINCODE_NAME -c \
        '{"Args":["queryConsent", "{\"selector\":{}, \"use_index\":[\"_design/indexConsentDoc\", \"indexConsent\"]}"]}'
  • updateConsent (patient_id, action, role_id, start_date, end_date, arr[column ids], watchdog_id)

    peer chaincode invoke -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 -C $CHANNEL_NAME -n CHAINCODE_NAME -c \
        '{"Args":["updateConsent", "2", "g", "all", "20150101", "20160101", "101", "hippa"]}'
  • accessConsent (role_id, start_date, end_date, column_ids, watchdog_id, data_consumer_id)

    peer chaincode invoke -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 -C $CHANNEL_NAME -n CHAINCODE_NAME -c \
        '{"Args":["accessConsent", "all", "20150101", "20160101", "101", "hippa", "dc1"]}'
  • initialize (column_id, action, role_id, start_date, end_date, arr[patient ids], watchdog_id)

consentio-client's People

Contributors

hvvka avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

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.