Our previous article explored how travel companies can use blockchain to enhance loyalty programs, focusing on generating users’ engagement and participation as a community. This article outlines an architecture and design plan for travel companies in the Web3 era. Specifically, it details a proof of concept (PoC) solution to enable a shared loyalty program through permissioned blockchain technology. The system allows users to own their shared points, use them through different companies, and share them with others.
Architecture
Business Rules
- There are two loyalty point types: local program points and global program points.
- Each company manages its own rules for each loyalty program type. The backend off-chain handles the local program, and the chaincode handles the global program.
- When the customer wants to use their loyalty points, the total points are the sum of local and global program points.
- Only global loyalty points can be transferred to other users.
- The current implementation allows a user to sign up and access any company.
- The architecture allows a separate sign-up/in-process per company. When a customer signs up for any company, it must be checked whether the user exists in the global loyalty program; if the user exists, it must be linked to the new company; if it doesn’t, it must be created.
Architecture Description
The PoC is built using Hyperledger Fabric with the following architecture:
- Each organization represents a company (i.e., Travel Agency, Airline, Hotel, etc.)
- Each company's applications connect to corresponding nodes within their group. This allows each company to manage its customer loyalty points rules or collaborate with other companies.
- The MSP of each organization manages identification per company. Users can belong to one or more than one company within the loyalty program community.
- All organizations are part of a global channel. There is only one channel since the idea is that users within this program can use the points in any company that participates in the program and be able to share the points with other users.
- There is only one orderer peer.
- Backend code manages data off-chain. This backend manages the company's local loyalty program and integrates with the global loyalty program, allowing each company to manage its own rules but be integrated into a greater ecosystem.
Chaincodes and Channels
There is only one channel, as per reasons explained in the architecture section, and it includes the following chaincodes and backend:
User: Manages a unique user that belongs to one or more companies. Essential functions to provide are:- CreateUser: Creates a new user. It contains an array of companies to which the user belongs.
- UpdateUser: Updates company data.
- ManagePoints: Adds/reduces points to the user and updates the attribute rewardSources (an array where all the points transactions are stored).
- TransferPoints: Manages the transfer points. This function is invoked by the rewardIngestion chaincode.
PointsConversion: Manages what rules apply for converting points to dollars (fiat) and how many points a user can earn by action (i.e., for comment, confirm comment). These rules are for earning and using points and can be defined per each organization. The primary functions to provide are:
- SetConversionRules: Points per item (Points to fiat).
- SetJoininRewardPoints: Points per joining.
- SetReviewPoints: Points per review.
- EarnPoints/EarnPointsByReview/earnPointsByConfirmation/ earnPointsByConfirmationOwner/ joiningRewards/ redeemPoints: This function gets the current conversion for the ORG provided, updates the user points, and stores the transaction.
- TransferPoints: Invokes the user chaincode to update the user points and store the transaction.
Off-chain backend includes the following logic:
Company: Manages a company entity information.
-
-
- CreateCompany: Creates a new company.
- UpdateCompany: Updates company data.
-
User: Manages a unique user that belongs to one or more companies.
-
- CreateUser: Creates a new user.
- UpdateUser: Updates user data.
LoyaltyPoints: Manages rules for local loyalty program and integration with global loyalty program:
- ActionToPointsConversion: Points per item (dollars, review).
- PointstoFiatConversion: Dollars per point.
Dapps
For the sake of this use case and to show the implementation of this architecture, we decided to develop two Dapps: one that simulates an airline e-commerce site and the other a travel agency.
For each app, we create:
- Three dummy users.
- Log in with any of those users.
- For the airline, put a fixed number of airline tickets.
- For the travel agency, set several Hotel/Room options.
- Have a list of airplane trips and hotel stays that the user can review.
- Add the functionality for booking airline tickets or hotel/rooms.
- Add functionality for checking points’ status.
- Add functionality for reviewing points history (earned and used)
- Add functionality for transferring points.
- Connect booking and review actions to loyalty points functions.
Conclusion
In this article, we saw that a permissioned blockchain such as Hyperledge Fabric with Dapps is an excellent fit to solve use cases like the shared Loyalty Program for Travelers.
This solution provides the use case with a solid foundation to connect all organizations participating in the ecosystem. It gives each of them a transparent and trustworthy implementation without ceding ownership to a third-party organization. Also, this allows each organization to define its rules regarding its customers and points usage and allows the end user to be part of a system that offers more possibilities for using its loyalty points.
In Encora, we have created deep expertise in Web3 and decentralized solutions using technologies like Hashgraphs and blockchain. This expertise can help our clients find new and better ways to solve their opportunities related to traceability, transparency, and trust, whether B2C or B2B.