/SPChain

Implementation of SPChain: A Smart and Private Blockchain-enabled Framework for Combining GDPR-Compliant Digital Assets Management with AI models

Primary LanguageHTMLApache License 2.0Apache-2.0

SPChain Implementation

Start up blockchain network locally:

cd spchain
./startFabric.sh

The script will start up the network, install, and instantiate all chaincodes, please wait for a moment until you see the successful message ==== Good! All Chaincodes Installed and Instantiated Successfully!! ====

Now, let's wrap the blockchain network by nodejs, in that way we can interact with the network via RESTful API:

cd javascript
npm install

Enroll Admin and Regist User:

node enrollGalleryAdmin.js
node node registerGalleryUser.js

Start up API server:

node apiserver.js

### Running following instructions under path SPChain/spchain/Demo/ ###
### Remember to change "api" in all python files to your own api (change ip address) ###

This step generates the keys of Service Provider, Third-Party, and Data Subject, then invokes 3A_CC

python Initial_Phase.py  

After that, you will see folders containing keys under path "SPChain/spchain/Demo/" and see the payload in the blockchain server

This step demonstrates flow of uploading artowrks

python Upload_Artworks.py

then follow the instructions described in Upload_Artworks.py:
(1) node setup.js upload -a..
(2) Get result from "setup.js upload" and then invoke artwork_CC
(3) Invoke log_CC

After that, artwork_CC and log_CC will be invoked and showd the payload in the blockchain server

This step demonstrates flow of transferring artowrks

python Transfer_Artworks.py

then follow the instructions described in Transfer_Artworks.py:
(1) Invoke artwork_CC
(2) Invoke wallet_CC
(3) node setup.js transfer..
(4) Invoke artwork_CC
(5) Invoke log_CC

This step demonstrates flow of uploading models and invoking models

python Combine_Models.py

then follow the instructions described in Combine_Models.py:
(1) Upload the model
(2) Read address of selected model first
(3) Running application container, and this step provides "service api"
(4) Invoking the model
(5) Invoke wallet_CC

This step demonstrates flow of granting consents and revoking consents from (by) Data Subject

python Grant_Revoke_Consent.py

then follow the instructions described in Grant_Revoke_Consent.py:
(1) Request Consent from DP
(2) Revoke Consent from DP

This step demonstrates flow of requesting data from Third-Party

python Request_Data.py

then follow the instructions described in Request_Data.py:
(1) Invoke 3A_CC to check policy (consent) and get enhash
(2) Invoke log_CC to log and get sk_data
(3) Use decryptor to decrypt enhash -> get original orbitdb address (i.e., decrypted)
(4) Now we have decrypted address, query this address to get data, and then decrypted data with sk_data -> get final ciphertext