Archived | Securing art using blockchain digital certificates
Node.js-based auction application can help democratize the art market
Note: The authors of this code pattern work for Chainyard.
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.
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:
- Using IPFS (use paid version) or STORJ
- 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)
- 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!
- Tear down any existing networks and remove any containers or images that are lying around.
- Launch the Hyperledger Fabric network.
- Launch the Node.js application (REST server wrapper of top of the Node SDK API).
- Create the channel “myChannel.”
- Install and instantiate the auction chaincode.
- Invoke a transaction where the Node.js app transforms a Base64-encrypted image into a string format.
- Store the encrypted image on the blockchain ledger.
- Query the ledger to get the image data by its imageID and save the image as a thumbnail in a public folder.
Find the detailed instructions in the README. These steps explain how to:
- Clone the repo.
- Launch the Hyperledger Fabric Network and the Node.js app.
- Create the network channel and invoke a transaction.