Taxonomy Icon

Blockchain

Securing art using blockchain digital certificates

Get the code View the demo

Note: The authors of this code pattern work for Chainyard.

Summary

Recently, a multi-million dollar painting by Andy Warhol was tokenized and sold on blockchain in what was the first transaction of its kind. So clearly these types of transactions are no longer outside the realm of possibility. We have finally democratized the art market! This approach creates accessibility for non-traditional art collectors and enables art sellers to enter new markets on a global scale. This code pattern features an app that instantiates a local blockchain network to store artwork images in digital format on the ledger.

Description

This code pattern is a sample Node.js-based auction application that shows you how to store and retrieve Base64-encoded and Base64-encrypted images on and from a Hyperledger Blockchain ledger. The application launches the Hyperledger Fabric network and then starts the application as a REST API server built on top of Node SDK APIs. The main goal of this application is to demonstrate how to leverage encoding and encryption on a blockchain. This use case demonstrates how to store images of artwork on a blockchain for an art auction. This model can be applied to other types of assets such as forms and videos. There are several approaches to storing the images:

  1. Using IPFS (use paid version) or STORJ
  2. Creating a hash of the image and storing the file on s3 (use this if you need to ensure no unauthorized modifications to the file)
  3. Converting the image to a Base64 string and storing the string in a composer model

This pattern uses the third option. The Base64 command can be done on the command line or as part of a script. The command is available by default in OS X. The syntax is:

$ base64 -i -o

One can also cat the input from a file.

By default, blockchain supports encryption, security, and immutability. These characteristics are fundamental for the art auction use case.

When you have completed this code pattern, you will understand how to:

  • Set up a blockchain network
  • Generate a Base64-encrypted image and store it encrypted on the blockchain ledger
  • Query the chaincode to retrieve an image and store it in a public folder

We challenge you to try using this with other types of assets!

Flow

Flow diagram

  1. Tear down any existing networks and remove any containers or images that are lying around.
  2. Launch the Hyperledger Fabric network.
  3. Launch the Node.js application (REST server wrapper of top of the Node SDK API).
  4. Create the channel “myChannel.”
  5. Install and instantiate the auction chaincode.
  6. Invoke a transaction where the Node.js app transforms a Base64-encrypted image into a string format.
  7. Store the encrypted image on the blockchain ledger.
  8. Query the ledger to get the image data by its imageID and save the image as a thumbnail in a public folder.

Instructions

Find the detailed instructions in the README. These steps explain how to:

  1. Clone the repo.
  2. Launch the Hyperledger Fabric Network and the Node.js app.
  3. Create the network channel and invoke a transaction.