IBM / SecuringArt-using-Blockchain-DigitalCertificates

WARNING: This repository is no longer maintained :warning: This repository will not be updated. The repository will be kept available in read-only mode.
16 stars 31 forks source link

WARNING: This repository is no longer maintained :warning:

This repository will not be updated. The repository will be kept available in read-only mode.

Securing Artwork using Blockchain Digital Certificates

This code pattern is a sample auction Node.js based application that demonstrates storing base64 encoded and encrypted images on a Blockchain ledger and retrieving the same. This application launches Hyperledger Fabric network and then starts the application as a REST API server built on top of NodeSDK APIs.

Auction Blockchain Application Credits: Mohan Venkataraman, Sandeep Pulluru and Ratnakar Asara

Disclaimer: The image used in this sample demo has been downloaded from publicly available images on the internet, and the copyright belongs to the respective owners. The usage here is strictly for non-commercial purposes as sample data. We recommend that users create their own sample data as appropriate. All details used in the sample data are fictitious. The information provided in this README.md is subject to change. Also this is based out of fabric-sample balance-transfer example.

When the reader has completed this code pattern, he or she will understand how to:

Flow

  1. Teardown any existing networks, remove any existing containers or images lying around
  2. Launch the Hyperledger Fabric network
  3. Launch the Node.js application (Rest Server wrapper of top of the NodeSDK API)
  4. Create the channel myChannel
  5. Install and instantiate the auction chaincode
  6. Invoke a transaction where the Node.js app transforms a base 64 encrypted image into a string format
  7. Store the encrypted image image on the Blockchain ledger
  8. Query ledger to get the image data by its imageID and save the image as a Thumbnail in a public folder

Prerequisites

Included components

Featured technologies

Steps

  1. Clone the repo
  2. Launch Hyperledger Fabric Network and Node App
  3. Create the Network Channel and Invoke a Transaction

Step 1. Clone the repo

Clone the SecuringArt-using-Blockchain-DigitalCertificates repo locally. In a terminal, run:

git clone https://github.com/IBM/SecuringArt-using-Blockchain-DigitalCertificates

Step 2. Launch Hyperledger Fabric Network and Node App

In one terminal launch hyperledger fabric network and Node.js application (a REST Server wrapper on top of Fabric NodeSDK api) with the following command

cd SecuringArt-using-Blockchain-DigitalCertificates
./bootstrap_app.sh

The above script bootstrap_app.sh performs the following actions:

NOTE: You may be tempted to run http://localhost:4000 at this point - please do not do that; otherwise you will get an UnauthorizedError: No authorization token was found error. After running the bootstrap_app.sh command, immediately go to Create the Network Channel and Invoke a Transaction and run the quicketest.sh command.

Step 3. Create the Network Channel and Invoke a Transaction

In another terminal issue the following command from auction directory.

./quicktest.sh

The above script quicktest.sh performs the following actions:

You should see similar results from running quicktest.sh:

Links

Learn more

License

This code pattern is licensed under the Apache Software License, Version 2. Separate third party code objects invoked within this code pattern are licensed by their respective providers pursuant to their own separate licenses. Contributions are subject to the Developer Certificate of Origin, Version 1.1 (DCO) and the Apache Software License, Version 2.

Apache Software License (ASL) FAQ