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.
-
Enroll 4 users (
user1
,user2
,user3
,user4
) into local wallet with enroll_users.sh. -
Reproduce WRITE bar plot (Figure 7 in Consentio article):
$ ./write.sh <individual_id>
-
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.
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
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.
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}}}]
{
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)
-
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) org
(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)