LennartFr / customer-loyalty-program

A customer loyalty program with blockchain using Hyperledger Composer API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

blueband

Call for Code

Call for Code

blueband

Customer Loyalty Program with Blockchain

This blockchain model for a customer loyalty program enhances the value of points to loyalty program members and brings in new value to the partners. Participants in this network have a more level relation among each other and points are in the centric position to connect all participants.

This code pattern is for developers looking to start building blockchain applications with Hyperledger Composer. When the reader has completed this code pattern, they will understand how to:

  • Create basic business network using Hyperledger Composer
  • Deploy the network to an instance of Hyperledger Fabric locally and IBM Blockchain
  • Build a Node.js web application to interact with the blockchain network using Composer API

blueband

Architecture Flow

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

Hyperledger and Blockchain Components we will be working with

  • Hyperledger Composer v0.19.4 Hyperledger Composer is an extensive, open development toolset and framework to make developing blockchain applications easier

  • Hyperledger Fabric v1.1 Hyperledger Fabric is a platform for distributed ledger solutions, underpinned by a modular architecture delivering high degrees of confidentiality, resiliency, flexibility and scalability.

  • IBM Blockchain Starter Plan The IBM Blockchain Platform Starter Plan allows to build and try out blockchain network in an environment designed for development and testing

Featured technologies

  • Nodejs Node.js is an open-source, cross-platform JavaScript run-time environment that executes JavaScript code server-side
  • Bootstrap Bootstrap is an open source toolkit for developing with HTML, CSS, and JS

blueband

Running the Application

Original: https://github.com/raheelzubairy/customer-loyalty-program

Follow these steps to setup and run this code pattern. The steps are described in detail below.

Prerequisites

  • Operating Systems: Ubuntu Linux 14.04 / 16.04 LTS (both 64-bit), or Mac OS 10.12 or higher

  • Docker (Version 17.03 or higher)

  • npm (v5.x)

  • Node (version 8.9 or higher - note version 9 is not supported)

    • to install specific Node version you can use nvm
    1. nvm install 8.9
    2. nvm use 8.9
    3. output: Now using node v8.9.4 (npm 6.1.0)
    • Example: 'nvm install 8.94' results in: "Now using Node v8.9.4, NPM v5.6.0"

1. Install the Hyperledger Composer runtime components and clone the Customer Loyalty Program GitHub Repo

Step 1.1

  • Install composer cli: npm install -g composer-cli
  • Install composer-rest-server: npm install -g composer-rest-server
  • Install generator-hyperledger-composer: npm install -g generator-hyperledger-composer

Step 1.2

Clone the Customer Loyalty Program with Blockchain repo locally. In a terminal, run:

git clone https://github.com/LennartFr/customer-loyalty-program

Step 2. Generate the Business Network Archive

Next we will generate the Business Network Archive (BNA) file from the root directory.
This file will contain your network including:

  • the model defined in the org.clp.biznet.cto file in the models folder
  • the logic behind transactions in the logic.js file in the lib folder
  • permissions defined in the permissions.acl file
  • queries defined in the queries.qry file

Run the following command to create the BNA file:

cd customer-loyalty-program/
npm install

The composer archive create command in package.json has created a file called clp-network@0.0.1.bna.

Step 4. Deploy the Business Network

The BNA file can either be deployed to a local instance of Fabric or to the IBM Blockchain Starter Plan.

blueband

Step 5. Run the Application

At this point you will either have installed the Hyperledger Fabric locally or to the IBM Blockchain Starter Plan! See above for the instructions.

Go into the web-app folder and install the dependency:

cd web-app/
npm install

Start the application:

npm start

The application should now be running at: http://localhost:8000


blueband

Deploy application to the IBM Cloud

If your hosting the network on IBM Blockchain Starter Plan, then you can deploy the app to IBM Cloud.

Links

License

Apache 2.0

About

A customer loyalty program with blockchain using Hyperledger Composer API

License:Apache License 2.0


Languages

Language:JavaScript 39.7%Language:HTML 31.4%Language:Shell 26.3%Language:CSS 2.5%