Kubernetes with OpenShift World Tour: Get hands-on experience and build applications fast! Find a workshop!

Create a customer loyalty program with blockchain

Summary

This code pattern is for developers looking to start building blockchain applications with Hyperledger Fabric and IBM Blockchain extension for VS Code. Learn how to set up a Hyperledger Fabric customer rewards program network on a local Fabric network, install and instantiate a smart contract through IBM Blockchain extension for VS Code, and develop a Node.js web application with the Hyperledger Fabric SDK to interact with the deployed network.

Description

Customer loyalty programs allow companies to reward customers who frequently make purchases. Program members earn points on purchases, which translate into some type of reward, such as a discount, freebie, or special customer treatment. The members work toward a certain amount of points to redeem rewards. These programs can have multiple companies as partners to cater to a customer base. However, current loyalty program systems put restraints on the relations between partners and can hamper visibility for members. These restraints can be removed by creating the customer loyalty program on a blockchain network. This blockchain model for a customer loyalty program enhances the value of points to loyalty program members and brings new value to the partners with trusted transactions. Participants in this network have a more level relationship with one another, and points are in the centric position to connect all participants.

This developer code pattern shows you how to create a customer loyalty program as a blockchain web application using Hyperledger Fabric and Node.js. The application allows members to register on the network where they create their accounts. They are identified on the network with their account numbers and create an access key, which they use to sign in. This access key is used as the card ID for making transactions and querying records. A member, once signed in, can make transactions to earn and redeem points from the partners on the network. They can view their transactions as part of the blockchain ledger. This code pattern illustrates the use of permissions as part of the network where members can only view their own transactions.

Similarly for the partners, they register by creating their identity on the network and get access keys to view their records. Partners are allowed to view only transactions they were part of, so they can keep track of all their transactions where they allocated or redeemed points. The web application shows a basic dashboard for the partner, displaying the total points allocated and redeemed to members. As transactions get more complex, partners can perform analyses on their transactions to create informative dashboards.

This code pattern is for developers looking to start building blockchain applications with Hyperledger Fabric and IBM Blockchain extension for VS Code. When you have completed this code pattern, you will understand how to:

  • Set up a Hyperledger Fabric network on IBM Blockchain extension for VS Code
  • Install and instantiate a smart contract through the IBM Blockchain extension on VS Code on a local Fabric connection
  • Develop a Node.js web application with the Hyperledger Fabric SDK to interact with the deployed network

Flow

Diagram customer loyalty program

Note: The blockchain network will have multiple members and partners.

  1. Member is registered on the network.
  2. Member can sign in to make transactions to earn points, redeem points, and view transactions.
  3. Partner is registered on the network.
  4. Partner can sign in to view transactions and display the dashboard.

Instructions

Ready to get started? See the README for all the details.

Ashutosh Nath Agarwal
Raheel Zubairy